Skip to main content
Creates a supplier invoice in SAP (A_SupplierInvoice in API_SUPPLIERINVOICE_PROCESS_SRV). Display name “SAP Create Supplier Invoice”. Off by default. supplier_invoice_status decides how it lands:
  • A parks it. This is the default.
  • B parks it as complete.
  • 5 asks SAP to post it to the ledger.

Authentication and enablement

Requires a workspace SAP integration. base_url and authorization are injected. Enable the tool and bind the integration.

Check for a duplicate first

The tool does not look for an existing invoice before it creates one. Search with sap_read_supplier_invoice on invoicing_party and reference_starts_with first; that page explains why a prefix match catches re-keyed references. Both tools cut the supplier’s reference to 16 characters the same way, so the keys match.

Inputs

PO reference lines (line_items): purchase_order, purchase_order_item and supplier_invoice_item_amount are required. Optional: plant, tax_code, tax_jurisdiction, document_currency, the quantity fields (quantity_in_purchase_order_unit, purchase_order_quantity_unit, purchase_order_qty_unit_iso_code, qty_in_purchase_order_price_unit, purchase_order_price_unit), and the goods receipt the line settles (reference_document, reference_document_fiscal_year, reference_document_item). A PO line can also carry account_assignments, for the case where the invoice splits a line differently from the purchase order. Each entry takes any of cost_center, gl_account, profit_center, wbs_element, internal_order, business_area, functional_area, controlling_area, amount, quantity, quantity_unit, tax_code, tax_jurisdiction, text and document_currency. Send them only when the split differs from the PO item’s own. Withholding tax (withholding_tax), on the header: withholding_tax_type, withholding_tax_code, withholding_tax_base_amount and withholding_tax_amount are all required — SAP refuses a partial line rather than defaulting it. document_currency is optional. G/L lines (gl_account_items), for charges with no PO line such as freight or handling: gl_account (10 digits, zero-padded, e.g. 0041000000) and supplier_invoice_item_amount are required. Optional: debit_credit_code (S debit, H credit), tax_code, tax_jurisdiction, cost_center, internal_order, profit_center, business_area, wbs_element, functional_area, assignment_reference, supplier_invoice_item_text, quantity, quantity_unit, document_currency. G/L lines take the header company_code. Lines are numbered 1, 2, 3 in the order given, PO lines and G/L lines separately; a line number in the input is ignored. Either list can also be passed as a ${VAR_N} reference or a path into one. Nothing else is defaulted or derived. plant, tax_code, payment_terms, quantity and debit_credit_code are sent only when supplied; when they are absent SAP applies the purchase order’s or the supplier’s own values.

Outputs

  • supplier_invoice_number, fiscal_year, status (SAP’s), post_requested and posted.
  • company_code, invoicing_party, invoice_gross_amount, document_currency, supplier_invoice_id_by_invoicing_party, document_date and posting_date as SAP stored them. Dates are written out, e.g. “October 8, 2026”.
  • line_item_count: PO reference lines only. G/L lines are not counted.
  • tax_amount and tax_code: what was sent in tax_items, not a figure SAP calculated.
  • truncated: each field that was cut.
  • sap_messages: what SAP said about the document, such as a payment block, a tolerance warning or a duplicate reference. None of these appear in the document itself, so read them.
  • full_details: the document as SAP returned it.
  • sap_url when the connection has a Fiori launchpad URL.
5 asks SAP to post; it does not guarantee a post. A payment block, a tolerance or a closed period can leave the invoice parked while the call still succeeds. Check posted, not post_requested.

Limits and side effects

  • Writes to SAP. A posted invoice cannot be undone with this tool; in SAP a posted document is reversed, not deleted.
  • Sent once. The create is never retried: a resend after a late answer once created a duplicate invoice. If the call times out (60 seconds) or SAP’s response cannot be read, the invoice may exist anyway. Search with sap_read_supplier_invoice before calling again.
  • No local balance check. An invoice whose lines do not add up to invoice_gross_amount is refused by SAP with M8/186.
  • Tax is never computed here. Without tax_items or tax_is_calculated_automatically, a taxed invoice is parked without its tax, or refused on posting with M8/186.
  • Withholding tax is not supported. Attach the invoice image with sap_upload_attachment after creating it.

Expected errors

SAP’s own messages are appended to the error text, so a refusal names SAP’s reason.