SAP BAPIObjectBAPI_BILLINGDOC_CREATEMULTIPLEModuleSD_O2C

BAPI_BILLINGDOC_CREATEMULTIPLE — Create Billing Documents from References

BAPI_BILLINGDOC_CREATEMULTIPLE creates one or more billing documents (invoices, credit memos, debit memos) from deliveries or sales orders, mirroring the mass billing transaction VF04 or a manual VF01 call. It processes a list of reference documents in one call, returns the resulting billing document numbers in a separate success table, and requires an explicit external commit since it does not commit its own work.

Covers what BAPI_BILLINGDOC_CREATEMULTIPLE does against the billing document object, which parameters actually exist on its interface, and why lazy RETURN handling is the single biggest source of silent data loss with this BAPI. Also covers commit behaviour, real integration pitfalls, and how the object sits alongside the S/4HANA billing API.

Published 16 Sept 2026· 1,014 words

What it does

The BAPI acts on the billing document object, the same object created by transaction VF01 for single documents or VF04 for mass runs. It takes a list of references to deliveries or sales orders that are due for billing, applies the same billing type and copy control logic VF01 would apply, and generates the resulting invoice, credit memo, or debit memo header and item records. It is built for bulk processing: a single call can be handed dozens or hundreds of reference documents, each of which may produce zero, one, or several billing documents depending on split criteria such as payer, incoterms, or billing block status. It does not replace the pricing engine or copy control configuration; it triggers the same underlying logic that VF01 uses interactively.

Important parameters

  • BILLINGDATAIN - the table of references to be billed, one row per delivery or sales order (and item, if partial billing is required), carrying the reference document number, reference document category, and billing type override where applicable
  • TESTRUN - simulation flag; when set, the BAPI runs pricing and copy control but does not write any billing document, useful for pre-checking a batch before committing to it
  • POSTING - flag controlling whether the created billing document should also trigger the FI posting step in the same call, rather than leaving it to a separate posting run
  • RETURN - the standard BAPIRET2 message table returned for every call, carrying one or more messages per reference document processed
  • SUCCESSFULLYPROCESSED (or equivalent success table) - lists which reference documents were actually converted into billing documents and returns the generated billing document number against each one

Commit behaviour

The BAPI does not commit its own database changes. Like almost every BAPI in the sales and distribution area, it expects the calling program to issue an explicit commit, typically BAPI_TRANSACTION_COMMIT, after inspecting RETURN and deciding the run was clean. Skip the commit and the billing document numbers reported back to the caller as created will not actually persist once the session or LUW ends; the number range slot is still consumed, but no document exists at that number. This is the classic cause of an interface that reports success, hands a document number to a downstream system, and then that number turns out to be unreadable in VF03 because it was never committed.

Return handling

RETURN alone does not tell the full story for this BAPI. A call processing multiple reference documents can partially succeed: some references produce billing documents cleanly, others fail on a billing block, a missing condition record, or a foreign trade data gap, and all of that lands as separate rows in RETURN, mixed together with informational messages. Checking only whether RETURN contains any type E or A message and treating everything else as a full success is the most common bug: a batch of fifty deliveries where three fail still returns a non-empty RETURN, but the other forty-seven did generate documents. The correct pattern is to reconcile the count and identity of documents in the success table against the original input list, treat any reference document missing from that success table as failed regardless of what RETURN says about it, and only then decide whether to commit the batch as a whole or roll it back entirely.

ECC vs S/4HANA

The BAPI remains callable and functionally supported in S/4HANA; it has not been formally deprecated. S/4HANA does offer a released OData-based billing document API for newer integration scenarios, and new Fiori-oriented or cloud-facing builds are generally steered toward that released API rather than the classic BAPI. For existing custom interfaces and batch billing jobs already built on this BAPI, migration is not mandatory, but any new interface work should evaluate the released API first before defaulting to the BAPI out of habit.

Common pitfalls

  • Mixing delivery-related and order-related references in the same call when copy control is only configured for one path, producing silent skips for the unsupported category
  • Leaving TESTRUN set in a production job, so the interface logs apparent success with no actual documents created
  • Assuming the input count equals the output count; split criteria such as different payers or incoterms on one delivery can produce several billing documents from a single reference, or the reverse
  • Foreign trade or export data missing on the reference document, which fails silently in this BAPI in a way VF01 would flag more visibly on screen
  • Missing external commit, so a batch that reports created document numbers rolls back invisibly and downstream systems chase document numbers that were never persisted
  • Number range buffering meaning failed attempts still consume a document number, which later looks like a numbering gap during reconciliation

Whose problem this is

A failed or partial billing run is first a functional question: check copy control between the reference document type and the billing type, billing block status, and pricing procedure determination in VF01 manually against the same reference. If VF01 succeeds manually but the BAPI fails, bring the exact BILLINGDATAIN payload and the full RETURN and success table content to development; that pairing is what narrows it to an interface bug versus a configuration gap.

Related SAP objects

Reviewed pages this object connects to in the ERPClimb knowledge graph.

Source: ERPClimb — https://erpclimb.com/sap-bapis/bapi-billingdoc-createmultipleERPClimb is an independent platform and is not affiliated with SAP SE. Reference pages are written and reviewed by SAP consultants for learning and troubleshooting.