BAPI_INCOMINGINVOICE_CREATE — Create Incoming Invoice via BAPI (MIRO Equivalent)
BAPI_INCOMINGINVOICE_CREATE posts a vendor invoice in Logistics Invoice Verification, mirroring transaction MIRO, and writes directly to the invoice document (RBKP/RSEG) plus triggering the FI posting. It does not commit on its own, so BAPI_TRANSACTION_COMMIT must follow. The RETURN table, not sy-subrc, is the only reliable success indicator.
Covers what BAPI_INCOMINGINVOICE_CREATE actually does against a purchase order or account assignment, which parameters carry the header, item, tax and G/L data, and why interfaces built around this BAPI break when RETURN handling and the commit step are done carelessly. Also covers the recurring functional causes of failed postings and where the S/4HANA API landscape sits relative to it.
Published 16 Sept 2026· 976 words
What it does
BAPI_INCOMINGINVOICE_CREATE creates a Logistics Invoice Verification document, the same object produced by transaction MIRO. It books a vendor invoice against one or more purchase order items, or against a direct G/L or material account assignment, and on successful posting generates the resulting FI accounting document in the same step. This is a posting BAPI, not a parking BAPI: unlike BAPI_INCOMINGINVOICE_PARK, it does not leave the invoice in a preliminary, editable state. It writes the invoice header to RBKP and the line items to RSEG, updates purchase order history, and can trigger invoice blocking (payment block, quantity or price variance block) exactly as MIRO would, depending on tolerance configuration.
Important parameters
Core importing and exporting parameters used in almost every call.
- HEADERDATA - invoice header: invoice date, posting date, gross amount, currency, reference document number, vendor, company code
- ITEMDATA - one row per invoice line: PO number, PO item, invoiced quantity, item amount, tax code
- TAXDATA - tax lines when tax amounts are entered or adjusted manually rather than left to automatic calculation
- GLACCOUNTDATA - G/L account assignment lines for account-assigned or non-PO postings
- WITHTAXDATA - withholding tax lines where withholding tax is relevant to the vendor
- VENDORITEMSPLITDATA - splits the vendor line across multiple payment terms or partial amounts
- RETURN - table of BAPIRET2 messages, the only trustworthy success/failure signal
- INVOICEDOCNUMBER - exporting parameter, the created invoice document number
- FISCALYEAR - exporting parameter, fiscal year of the created document
Commit behaviour
The BAPI does not commit. It performs the posting logic and returns a document number that exists in the current update task but is not yet durable. BAPI_TRANSACTION_COMMIT (or an explicit COMMIT WORK in the calling program) is required to make the invoice persist. Interfaces that omit this step, or that call the BAPI inside a loop and commit only once at the end, will see INVOICEDOCNUMBER populated for every call yet find some or all of those documents missing afterward, because a later rollback in the same LUW silently undoes earlier successful postings that were never separately committed.
Return handling
RETURN is a table of BAPIRET2 structures, not a single flag, and sy-subrc after the call is not a reliable indicator because the function module itself frequently returns zero even when the posting failed. The correct check is to scan RETURN for any entry with TYPE equal to E or A; only then does the invoice not exist. A common interface bug is checking only whether RETURN is empty, which misses genuine warning-level entries (TYPE W) that flag duplicate invoice suspicion, price variance, or quantity variance while the document still posts. A second, more damaging bug: INVOICEDOCNUMBER can come back non-blank from an internal simulation pass even when a later validation step in the same call rejects the posting, so code that treats a filled document number as proof of success, without also confirming RETURN has no E or A entries, ends up logging false successes and, on retry logic, double-posting the same invoice.
ECC vs S/4HANA
BAPI_INCOMINGINVOICE_CREATE remains valid and widely used in S/4HANA for custom back-end integrations and batch invoice loads; it has not been formally deprecated. For new integrations, particularly those exposed to external systems or built as part of a Fiori-based extension, SAP's preferred entry point is a released API-first service for supplier invoice creation rather than a direct BAPI call, but the BAPI is still the pragmatic choice for internal RFC-based interfaces and migration cutover loads where the calling program already runs inside the SAP system.
Common pitfalls
Failures traced back to this BAPI in real interfaces are almost always master data or timing issues surfaced through a generic-looking error message.
- PO item not yet goods-receipted when GR-based invoice verification is active, rejected with a GR-quantity error even though the PO and vendor are otherwise fine
- PO item already fully invoiced or blocked for further invoicing, common when the interface retries a previously successful call after a false failure read
- Tax code passed does not match the tax code default on the PO, producing a tax amount mismatch that MIRO would have auto-corrected interactively but the BAPI posts literally
- Currency or exchange rate differs from the PO currency and no rate is passed, causing rounding or valuation differences that trip price tolerance limits
- Duplicate invoice check firing as a warning rather than an error, allowing a duplicate posting to slip through when RETURN is only checked for hard errors
- Withholding tax data omitted for a vendor subject to withholding, leaving an FI-side inconsistency that only surfaces during payment run
Whose problem this is
A posting that returns an error message is functional territory first: PO status, GR posting, tolerance keys, and tax code configuration explain most rejections. A posting that returns no error but leaves no document, or double-posts, is a developer issue in commit handling or RETURN evaluation. Functional needs the exact RETURN message text and the PO/GR history; developer needs the interface log showing whether commit was called and what RETURN contained at the point of the decision.
Related SAP objects
Reviewed pages this object connects to in the ERPClimb knowledge graph.
Source: ERPClimb — https://erpclimb.com/sap-bapis/bapi-incominginvoice-createERPClimb is an independent platform and is not affiliated with SAP SE. Reference pages are written and reviewed by SAP consultants for learning and troubleshooting.