Skip to content

Instantly share code, notes, and snippets.

@anggakharisma
Created May 4, 2026 14:05
Show Gist options
  • Select an option

  • Save anggakharisma/955120cf33ba85d60db531fd8f0b7a19 to your computer and use it in GitHub Desktop.

Select an option

Save anggakharisma/955120cf33ba85d60db531fd8f0b7a19 to your computer and use it in GitHub Desktop.

Vendor Registration Flow

End-to-End Diagram

flowchart TD
    A([Procurement User]) -->|Sends invitation from UI| B[Invitation Email Sent\nstatus: invited]
    B -->|Vendor replies with documents attached| C[Email Received\nstatus: received]

    C --> D{Document\nExtraction}
    D -->|AI extracts: NPWP, NIB, SPPKP,\nbank account, address, contact| E{Required Docs\nComplete?}

    E -->|Missing documents| F[status: incomplete\nVendor notified by email\nto resubmit]
    F -->|Vendor resubmits| C

    E -->|All required docs present| G[status: pending_review\nProcurement notified]

    G --> H([Procurement Officer\npermission: purchasing_review])
    H -->|Reviews extracted data\nand document scans| I{Verified?}
    I -->|Reject| R([status: rejected\nVendor notified])
    I -->|Send to Finance| J[status: finance_review\nFinance notified]

    J --> K([Finance Officer\npermission: finance_review])
    K -->|Fills accounting fields:\nBUKRS, AKONT, ZTERM,\nZWELS, HBKID, WAERS,\nWITHT, WT_WITHCD| L{Approved?}
    L -->|Reject| R
    L -->|Approve| M[Vendor record created\nin local database]

    M --> N[POST /sap/bc/zbp_api\nZFM_CREATE_BP]

    N --> O{SAP Response}
    O -->|e_type = E\nerror in e_msg| P[Push failed\nError shown in UI]
    O -->|e_type = S\ne_bp = Lifnr| Q[erp_vendor_id saved\nSAP BP badge shown in UI\nstatus: approved ✅]

    style R fill:#fee2e2,stroke:#dc2626,color:#991b1b
    style P fill:#fee2e2,stroke:#dc2626,color:#991b1b
    style Q fill:#dcfce7,stroke:#16a34a,color:#166534
    style F fill:#fef9c3,stroke:#ca8a04,color:#854d0e
Loading

Step-by-Step Explanation

Step 1 — Invitation

A procurement user sends an invitation from the MailBridge UI (Vendor Registrations → Invite). The system:

  • Records the invitation with status invited
  • Sends an email to the prospective vendor listing required documents (NPWP, NIB, SPPKP, Akta Pendirian, bank details, etc.)
  • Sets a registration deadline if specified
  • Optionally waives certain documents per-invitation (e.g. bank details for a vendor already in SAP)

The vendor replies to the dedicated inbox (e.g. vendor-onboarding@company.com) with all documents attached.


Step 2 — Document Intake & AI Extraction

When the email arrives, MailBridge automatically:

  1. Parses the email and all attachments (PDF, scanned images via OCR)
  2. Runs AI extraction to pull structured fields:
    • Company name, contact person, mobile
    • NPWP (Tax ID), NIB, SPPKP number
    • Bank name, bank account number, account holder
    • Address, city, postal code, country
  3. Classifies each attachment by document type (NPWP certificate, NIB, bank statement, etc.)
  4. Validates that all required documents are present per the invitation's checklist:
    • Missing documents → status incomplete, vendor notified by email to resubmit
    • All required docs present → status pending_review

Step 3 — Procurement Review

A user with the Procurement Review permission opens the registration. They see three panels:

Panel Contents
Header Data Key extracted fields: company name, NPWP, NIB, bank account, address
Extracted Data Full raw AI output — editable if corrections are needed
Supporting Documents Actual PDFs with document type tags, viewable inline

The procurement officer verifies the vendor's identity and document completeness.

Action: "Send to Finance" → status moves pending_reviewfinance_review


Step 4 — Finance Review

A user with the Finance Review permission opens the registration. The Finance panel becomes editable. Finance fills in the SAP accounting fields:

UI Field SAP Field Description
Company Code BUKRS Company code the vendor is assigned to
Reconciliation Account AKONT AP reconciliation GL account
Payment Terms ZTERM e.g. NT30, NT60
Payment Method ZWELS e.g. T (transfer), C (check)
House Bank HBKID Bank ID used for payment runs
Currency WAERS Default transaction currency
Withholding Tax Type WITHT e.g. for PPh 23
Withholding Tax Code WT_WITHCD Tax code under the WHT type
Subject to WHT WT_SUBJCT Boolean flag
Liable for Tax LIABLE_TAX Boolean flag

Action: "Approve" → vendor record created locally → SAP push triggered immediately


Step 5 — SAP Business Partner Creation

MailBridge calls SAP via HTTP POST to the custom ABAP function ZFM_CREATE_BP at /sap/bc/zbp_api.

Payload: i_data

Field Source SAP Mapping
lifnr blank = new BP; existing Lifnr = update LIFNR
name1 Extracted: company name NAME1
name2 Extracted: secondary name NAME2
sort1 First 20 chars of vendor name SORT1
street Extracted: street address STREET
house_num1 Extracted: house number HOUSE_NUM1
post_code1 Extracted: postal code POST_CODE1
city1 Extracted: city CITY1
country Extracted (default: ID) COUNTRY
region Extracted: province REGION
telp Extracted: telephone TELP
mobile Extracted: mobile MOBILE
email Extracted: email EMAIL
tax_number Extracted: NPWP STCD1
bukrs Finance input BUKRS
akont Finance input AKONT
zterm Finance input ZTERM
zwels Finance input ZWELS
hbkid Finance input HBKID
waers Finance input WAERS

Payload: bank_detail (array)

Field Source
country Bank country (default: ID)
bank_key Extracted from documents
bank_account_no Extracted from documents
account_holder Extracted from documents
account_name Extracted from documents

Payload: withholding_tax (array)

Field Source
witht Finance input: WHT type
withcd Finance input: WHT code

Note for SAP team: i_data is deserialized correctly by the current ZCL_BP_HTTP_HANDLER. The bank_detail and withholding_tax arrays are sent in the request body but require the handler to be updated to also deserialize those arrays. Until then, bank and WHT data will be ignored on the SAP side.


Step 6 — Post-Creation

SAP Response Result
e_type = "S", e_bp = Lifnr Vendor updated with SAP number. UI shows green SAP BP: XXXXXXXX badge.
e_type = "E", e_msg = reason Error displayed inline in UI. Registration stays approved, push can be retried.

The vendor is now active in both systems and can receive RFQs.


Status Reference

Status Meaning Next Actor
invited Invitation email sent, awaiting vendor response Vendor
received Email received, document processing started System
incomplete Missing required documents Vendor resubmits
pending_review All docs present, awaiting Procurement verification Procurement (purchasing_review permission)
finance_review Procurement approved, awaiting Finance accounting fields Finance (finance_review permission)
approved Finance approved, SAP push completed
rejected Rejected by Procurement or Finance

Permission Model

Permission Who holds it What it allows
vendor_registrations:read All staff View registration list and detail
vendor_registrations:write Procurement admin Send invitations, mark incomplete
vendor_registrations:purchasing_review Procurement officer Send to Finance
vendor_registrations:finance_review Finance officer Fill accounting fields, Approve, Push to SAP

Roles and permissions are configured in Settings → Users & Roles.


SAP Integration Reference

Call Endpoint Trigger
Create / Update Business Partner POST /sap/bc/zbp_api Finance approval
Test SAP connectivity GET /sap/bc/ping Settings → Connectors → Test Connection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment