Finance package

SAP supplier invoice posting with 3-way match

A captured supplier invoice is matched to the SAP PO and goods receipts; variances outside tolerance go to AP, and matched invoices are posted to S/4HANA.

Connects to SAP S/4HANA

OfficialHeadless / APIAdvanced~35 min setupv1.0.0

About this package

What it does

SAP supplier invoice posting with 3-way match takes invoices from your capture or OCR tool into SAP S/4HANA without blind posting. The capture tool posts the invoice header and line (supplier, invoice number, PO and item, quantity, unit price, gross amount) to the workflow.

The workflow reads the purchase order item from API_PURCHASEORDER_PROCESS_SRV and every goods receipt for it from API_MATERIAL_DOCUMENT_SRV (movement type 101), totals the received quantity and computes the quantity, unit price and amount variances. The Invoice tolerance decision table, modelled on SAP tolerance keys, decides whether the invoice is within tolerance.

Matched invoices are posted straight to A_SupplierInvoice with the PO and goods receipt reference, and the SAP invoice number and fiscal year are logged. Exceptions go to accounts payable on a task form showing PO, received and invoiced side by side, with a reason code lookup and Approve variance, Hold and Reject buttons; approved variances are posted with the chosen payment block.

Headless / API

Starts when your invoice capture / OCR tool posts the extracted invoice to the workflow start API or inbound webhook.

Another system starts it over REST or an inbound webhook. No UI is needed; people only appear where a decision needs a human.

The flow

Step by step

  1. 1

    Invoice captured

    The capture tool posts the supplier, invoice number, PO line, quantity, unit price and gross amount.

  2. 2

    PO and goods receipts

    A_PurchaseOrderItem gives the ordered quantity and price; A_MaterialDocumentItem lists the goods receipts, which are totalled.

  3. 3

    Variances

    Quantity over receipt, price variance % and amount variance are computed and logged.

  4. 4

    Tolerance

    The Invoice tolerance decision table decides whether the invoice is within tolerance.

  5. 5

    Exception review

    Outside tolerance, AP gets a task form with a reason code lookup and Approve variance / Hold / Reject.

  6. 6

    Post to SAP

    Matched or approved invoices are posted to A_SupplierInvoice; the SupplierInvoice and FiscalYear are logged.

SAP supplier invoice three-way match — A captured supplier invoice is matched to the SAP PO item and goods receipts; within tolerance it is posted, otherwise AP decides on a task form. The same canvas you get in the designer after installing.

Forms

Inputs and task forms

The inputs a caller passes when it starts a run, and the forms people complete when the process needs a decision.

Start inputs

SAP supplier invoice three-way match

Passed by the calling system

Supplier invoice number * invoice_reference · textThe supplier's own invoice number
Supplier * supplier · textSAP supplier (invoicing party), e.g. 17300001
Company code * company_code · textSAP company code
Invoice date * document_date · dateYYYY-MM-DDDate on the invoice
Purchase order * purchase_order · textSAP PO number on the invoice
PO item * po_item · textPO item number (10, 20…)
Invoiced quantity * invoiced_quantity · number0Quantity on the invoice line
Invoiced unit price * invoiced_unit_price · number0Net unit price on the invoice line
Gross amount * gross_amount · number0Invoice total including tax
Currency * currency · textInvoice currency
Capture id capture_id · textId of the document in your capture / OCR tool, for traceability
AP approver (user id) ap_user_id · textOptional: UserTasks user id who handles exceptions; the install-time default otherwise

User Task

Invoice exception

Invoice {{invoice_reference}} outside tolerance: {{exception_reason}} · 2-column grid · own header and theme

Reason code * reason_code · lookupPrefilled: {{suggested_code}}
Reason reason_text · text
Payment block payment_block · text
Buyer / supplier contacted buyer_contacted · boolean
Comment comment · textarea
Approve varianceHoldReject

Headless

Call it from your systems

Every workflow can be started over REST, MCP or the CLI, whatever its trigger, with the sample input below. Runs start straight away on the published version; replace <workflow id> with the id the install created.

REST

shell
curl -X POST "$USERTASKS_URL/api/v1/workflows/start" \
  -H "Authorization: Bearer $USERTASKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"workflow_id":"<workflow id>","variables":{"invoice_reference":"NW-88213","supplier":"17300001","company_code":"1010","document_date":"2026-10-27","purchase_order":"4500001245","po_item":"10","invoiced_quantity":100,"invoiced_unit_price":12.9,"gross_amount":1535.1,"currency":"EUR","capture_id":"CAP-2026-10-27-0042"}}'

CLI

shell
usertasks workflows inputs <workflow id>          # the start form: keys, types, required
usertasks workflows run <workflow id> --input invoice_reference=NW-88213 --input supplier=17300001 --input company_code=1010 --input document_date=2026-10-27 … --wait

Inbound webhook

shell
usertasks webhooks create <workflow id>          # prints the hook slug and secret once
curl -X POST "$USERTASKS_URL/api/webhooks/inbound?hook=<slug>" \
  -H "Authorization: Bearer <webhook secret>" -H "Content-Type: application/json" \
  -d '{"invoice_reference":"NW-88213","supplier":"17300001","company_code":"1010","document_date":"2026-10-27","purchase_order":"4500001245","po_item":"10","invoiced_quantity":100,"invoiced_unit_price":12.9,"gross_amount":1535.1,"currency":"EUR","capture_id":"CAP-2026-10-27-0042"}'

What's included

8 assets, ready to adapt

TypeNameDetails
Data tableInvoice match logEvery captured supplier invoice: the PO and goods receipt it was matched to, the variances, the decision and the SAP invoice document.
Data tableVariance reason codesWhy a variance was accepted, rejected or held. The exception form looks the code up and fills the description and the SAP payment block.
IntegrationSAP S/4HANA
API referenceGet goods receiptsGET /API_MATERIAL_DOCUMENT_SRV/A_MaterialDocumentItem?$filter=PurchaseOrder eq '{{purchase_order}}' and PurchaseOrderItem eq '{{po_item}}' and GoodsMovementType eq '101' and GoodsMovementIsCancelled eq false — API_MATERIAL_DOCUMENT_SRV A_MaterialDocumentItem: goods receipt lines (movement type 101) posted for the purchase order item.
API referenceGet purchase order itemGET /API_PURCHASEORDER_PROCESS_SRV/A_PurchaseOrderItem(PurchaseOrder='{{purchase_order}}',PurchaseOrderItem='{{po_item}}') — API_PURCHASEORDER_PROCESS_SRV A_PurchaseOrderItem: ordered quantity, net price and price unit, currency, tax code and GR-based invoice verification flag.
API referencePost supplier invoicePOST /API_SUPPLIERINVOICE_PROCESS_SRV/A_SupplierInvoice — API_SUPPLIERINVOICE_PROCESS_SRV A_SupplierInvoice: create the invoice with its purchase order reference line (to_SuplrInvcItemPurOrdRef) against the goods receipt. Returns SupplierInvoice and FiscalYear.
Decision tableInvoice tolerance5 rules — Three-way match tolerances (like SAP tolerance keys PP / DQ / BW). First matching rule wins; anything not caught is within tolerance.
WorkflowSAP supplier invoice three-way match27 steps — A captured supplier invoice is matched to the SAP PO item and goods receipts; within tolerance it is posted, otherwise AP decides on a task form.

Invoice match log · 1 sample rows

Match referenceSupplier invoice no.SupplierPOPO itemInvoiced qtyReceived qtyPO priceInvoiced pricePrice variance %Amount varianceMatch resultStatusReason codeSAP invoiceFiscal year

Variance reason codes · 5 sample rows

CodeDescriptionSAP payment blockTypical action

Requirements

What you connect it to

Credentials never travel in a package. The install wizard asks for what your environment must provide, or installs it incomplete until you finish setup.

Needs

  • REST API — A REST API integration: set its base URL and credentials on install.
  • Assignees — People in your workspace to receive the User Tasks (picked on install).
  • Inbound webhook — An inbound webhook created for the workflow, so other systems can start it.

After installing

  1. SAP S/4HANA integration: base URL https://<host>/sap/opu/odata/sap, Basic authentication with the communication user of arrangements for SAP_COM_0053 (purchase orders), SAP_COM_0108 (material documents) and SAP_COM_0057 (supplier invoices); set sap-client in the integration headers.
  2. CSRF: posting A_SupplierInvoice needs an x-csrf-token. Call SAP through API Management or a BTP destination that fetches it, or fetch it (GET with x-csrf-token: Fetch) and pass it to the optional x-csrf-token header input of Post supplier invoice.
  3. Assignees: pick the default AP person who handles exceptions (runs can pass ap_user_id).
  4. Set the Invoice tolerance rules to your tolerance keys and edit the Variance reason codes; point your capture tool at the start API.

Asked for on install

  • Integration “SAP S/4HANA”Required

    • Passwordconfig.auth_config.password
    • Base urlconfig.base_urldefault https://s4.sap.example.com/sap/opu/odata/sap· optional
  • Workflow “SAP supplier invoice three-way match” assigneesRequired

    • User for step “Invoice exception”nodes.18.config.assignee_id

Install

Install it in your workspace

Works on UserTasks cloud and on any self-hosted instance. Installing creates the assets above; nothing runs until you complete setup and start it.

In the app

  1. Download sap-supplier-invoice-three-way-match-1.0.0.utpkg.
  2. Open Automations → Packages and drag the file onto the page (or choose Import package). Browse gallery there lists every gallery package without downloading by hand.
  3. Pick the file. The wizard verifies the checksum, every file hash and the signature, and shows the readme.
  4. Review the changes (what is created) and the data rows.
  5. Fill in the requirements, or tick Keep incomplete and finish later with Complete setup.
  6. Done: the workflow is published and active once setup is complete.

With the CLI

shell
curl -fLO https://usertasks.com/gallery/sap-supplier-invoice-three-way-match-1.0.0.utpkg
usertasks packages inspect sap-supplier-invoice-three-way-match-1.0.0.utpkg       # offline: checksum, hashes, signature
usertasks packages install sap-supplier-invoice-three-way-match-1.0.0.utpkg --dry-run
usertasks packages install sap-supplier-invoice-three-way-match-1.0.0.utpkg       # prompts for each requirement
usertasks packages install sap-supplier-invoice-three-way-match-1.0.0.utpkg --keep-incomplete --yes   # in CI; finish with:
usertasks packages complete sap-supplier-invoice-three-way-match -f values.yaml

Verify the download

File SHA-256
768d08cd81f1332e9ed1e4094f328e03eab4b312113a0947b43b3c8dfff6d82b
Package checksum (what is signed)
sha256:c95f75ecb904d6b1822941b6b0b70e6275f6c7aafa3b614602e9ee30894521e7
Signer
Unsigned preview build — compare the SHA-256 above

shasum -a 256 sap-supplier-invoice-three-way-match-1.0.0.utpkg should print the file SHA-256. How gallery packages are signed.

Versions

Version 1.0.0

  1. v1.0.02026-10-28First release.

Installing a newer version upgrades in place: local credentials and requirement values are kept, and changes you made are flagged first. How packages work

More packages

Related

Browse the whole gallery