SAP BAPIObjectBAPI_GOODSMVT_CREATEModuleMM_P2P

BAPI_GOODSMVT_CREATE — BAPI_GOODSMVT_CREATE Goods Movement Posting

BAPI_GOODSMVT_CREATE posts a goods movement document, creating the material document and accounting document behind receipts, issues, and transfer postings. It mirrors MB1A, MB1B, MB1C, and the movement logic inside MIGO. It does not commit on its own, so BAPI_TRANSACTION_COMMIT must follow, and the RETURN table must be scanned for E and A type entries before treating the posting as successful.

This page covers what BAPI_GOODSMVT_CREATE does, its key import and export parameters, why it requires an explicit commit call, and the specific ways interfaces misread its RETURN table. It also lists the recurring integration failures seen when this BAPI is wired into external systems for automated goods receipts and issues.

Published 16 Sept 2026· 1,077 words

What it does

BAPI_GOODSMVT_CREATE posts a goods movement against the material inventory management object, producing the pair of documents behind every stock movement: the material document (header and items) and, where relevant, the linked accounting document. It mirrors the manual goods movement transactions MB1A, MB1B, and MB1C, and reproduces the posting logic that sits behind MIGO. It covers goods receipts against purchase orders or production orders, goods issues to cost centers or orders, and transfer postings between storage locations, plants, or stock types. The scenario is not chosen by transaction code but by the combination of GM_CODE (movement category) at header level and the movement type on each item line. It is one of the most heavily used BAPIs in P2P and shop-floor integrations because almost every automated receipt or issue coming from a non-SAP system, scanner, or warehouse control platform runs through it.

Important parameters

  • GOODSMVT_HEADER - header structure carrying posting date, document date, and the username to be recorded as the entering party
  • GOODSMVT_CODE - single-field structure carrying GM_CODE, which selects the movement scenario (goods receipt against purchase order, goods receipt against production order, goods issue, transfer posting) and determines which item fields become mandatory
  • GOODSMVT_ITEM - table of item lines, one row per document line, carrying MATERIAL, PLANT, STGE_LOC, BATCH, MOVE_TYPE, MOVE_STLOC for the target location on transfers, ENTRY_QNT, ENTRY_UOM, and reference fields such as PO_NUMBER and PO_ITEM for receipts against purchasing documents
  • TESTRUN - import flag; when set to X the BAPI validates the movement without creating any document
  • GOODSMVT_SERIALNUMBER - optional table for serial numbers on serialized materials, required when the material master demands serial number entry
  • GOODSMVT_HEADRET - export structure returning MAT_DOC and DOC_YEAR once a document is actually created
  • RETURN - export table of BAPIRET2 message lines, the only reliable indicator of success, warning, or failure

Commit behaviour

BAPI_GOODSMVT_CREATE does not commit the database update itself. The caller must issue BAPI_TRANSACTION_COMMIT, typically with WAIT set, immediately after checking RETURN. If this step is forgotten, the function can still populate GOODSMVT_HEADRET with what looks like a valid material document number and year, but nothing is written to the database once the logical unit of work ends. In RFC or background contexts this produces a specific failure pattern: the calling program logs a successful posting, a downstream read of the material document a moment later returns not found, and the discrepancy only surfaces when someone reconciles interface logs against MSEG.

Return handling

RETURN is a table, not a single status flag, and success is not the same as an empty table. Every line must be inspected for TYPE equal to E or A; a table that contains only informational or success messages still represents a completed posting, while a single E line anywhere in the set means no document was created regardless of what GOODSMVT_HEADRET shows. A common interface bug is checking IF RETURN IS INITIAL and declaring success on that basis alone, which misses the far more common case where RETURN is non-empty but contains only success text. Another recurring bug is reading only the first line of RETURN when the BAPI raised several messages, discarding the one that actually explains the rejection, such as a closed posting period or a missing storage location. Matching on the MESSAGE text field instead of the ID and NUMBER pair is also fragile, because the text changes with logon language while ID and NUMBER do not.

ECC vs S/4HANA

BAPI_GOODSMVT_CREATE remains valid and widely used in S/4HANA. SAP has not withdrawn it, and it continues to sit behind manual postings and many custom interfaces. For online, user-facing entry the recommended path is MIGO rather than a direct BAPI call, and some newer S/4HANA scenarios expose goods movement posting through released API services intended for cloud and side-by-side extension use. Where those newer services exist and fit the scenario they are worth evaluating, but for classic point-to-point ABAP integration this BAPI is still the standard choice and is not deprecated.

Common pitfalls

  • GM_CODE and movement type mismatch: passing a movement type valid only for issues while GM_CODE selects a goods receipt scenario produces an E message that gets swallowed by interfaces that only check for a returned document number
  • Missing PO_NUMBER and PO_ITEM on a receipt intended to reference a purchase order, which posts an unplanned goods receipt instead of the PO-referenced one and breaks purchase order history
  • Batch field left blank for batch-managed or valuation-type materials, which either auto-generates an unexpected batch or throws an error depending on batch level configuration
  • Posting period closed for the posting date supplied, visible only as an E message in RETURN and easy to miss in high-volume batch jobs
  • TESTRUN left set to X in a production job, so every call reports success while no document is ever created
  • Using this BAPI with a negative quantity to reverse an earlier movement instead of calling BAPI_GOODSMVT_CANCEL, which breaks the document reference chain and distorts negative stock and valuation reporting
  • Storage location not maintained for the material and plant combination, rejecting the posting with a configuration-level error rather than a data-level one

Whose problem this is

Functional consultants own the movement type, GM_CODE, and organizational data that determine what a valid posting looks like. Developers own the interface code calling the BAPI and the commit logic around it. When a posting fails, the developer needs the full RETURN table dump and the exact payload sent; the functional side needs confirmation of which movement type and reference document were expected for that scenario.

Related SAP objects

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

Source: ERPClimb — https://erpclimb.com/sap-bapis/bapi-goodsmvt-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.