02 — System Diagram

🔍 Open the Interactive Diagram Viewer — pan, zoom, per-area tabs, the full ERD and a focus mode. SupplierInvoice is the hub table, so its links can be hidden to declutter the overview.

Regenerate the viewer after any DSL, menu_config.yaml or diagram_config.yaml change: python scripts/build_diagram_viewer.py sap_ap.

flowchart TD
  INV[SupplierInvoice]
  INVL[SupplierInvoiceLine]
  POL[InvoiceMatchPolicy]
  M[InvoiceMatch]
  ML[InvoiceMatchLine]
  MX[MatchException]
  CM[SupplierCreditMemo]
  AP[ApTransaction]
  AE[AccountingEntry]
  PS[PaymentStatus]
  PC[PurchaseCommitment]
  EDM[ExternalDocumentMapping]

  INV --> INVL
  INV --> M
  POL --> M
  M --> ML
  INVL --> ML
  M --> MX
  ML --> MX
  INV --> CM
  INV --> AP
  CM --> AP
  AP --> AE
  INV --> PS

PurchaseCommitment and ExternalDocumentMapping refer to network records (orders, invoices) by network id, not by foreign key.

Purchase to pay across the network

sequenceDiagram
  participant P as Purchasing
  participant I as Inventory
  participant O as Orchestrator
  participant F as SAP AP
  P->>O: purchasing.order_placed
  O->>F: deliver
  F->>O: finance.purchase_commitment_posted (SAP PO 45008…)
  O->>P: deliver (External ERP Reference)
  Note over F: supplier invoice registered
  F->>P: purchasing.purchase_order_status (direct, read-only)
  F->>I: inventory.purchase_order_receipts (direct, read-only)
  F->>O: finance.invoice_match_completed / _exception
  F->>O: finance.ap_posted, finance.payment_status_changed
  I->>O: inventory.receipt_rejected / _quarantined
  O->>F: deliver (unposted matches back to exception)