SAP B1 ← Expense Reports (Purchase Invoice Draft + Receipt)
Approved expense report (Concur/Expensify) → SAP B1 Purchase Invoice posted to /Drafts first for human review, splitting recoverable vs non-recoverable VAT lines and carrying project/cost-center coding. The receipt image is attached via Attachments2 and linked through AttachmentEntry. Idempotent on the expense report id.
Steps in this flow
- Approved Expense Report Webhook
- Guard: Expense Report
- SL Login (B1SESSION)
- Split VAT: Recoverable vs Non-Recoverable
- Map Lines → DocumentLines (+ CostingCode)
- POST /Attachments2 (Receipt)
- POST /Drafts (oPurchaseInvoices)
- Retry on 401 (re-login)
- Notify AP: Draft Ready for Review