Populate GOODSMVT_HEADER: set PSTNG_DATE (posting date in YYYYMMDD), DOC_DATE (document date), and REF_DOC_NO (production order number).
Populate GOODSMVT_CODE with GM_CODE = '02' which corresponds to goods receipt for a production order.
Add a row to the GOODSMVT_ITEM table: set MATERIAL (material number), PLANT, STGE_LOC (storage location), MOVE_TYPE = '101', ENTRY_QNT (quantity), ORDERID (production order number), and MOVE_PLANT.
Call BAPI_GOODSMVT_CREATE via RFC; inspect the RETURN table for message type 'E' (error) or 'S' (success); the MATERIALDOCUMENT and MATDOCUMENTYEAR fields in the output header contain the created material document number.
If RETURN contains no errors, call BAPI_TRANSACTION_COMMIT with WAIT = 'X' to synchronously commit the LUW before returning the material document number to the caller.
For serial/lot-managed materials, additionally populate GOODSMVT_SERIALNUMBER (for serial numbers) or pass the batch number in the BATCH field of GOODSMVT_ITEM.
Known gotchas
GM_CODE '02' is specifically for goods receipt for production orders; using GM_CODE '01' (goods receipt for purchase order) with a production order number will result in error message M7 022 'Order type not allowed'.
Quantity unit in ENTRY_UOM must match the base unit of measure on the material master; passing a different UoM without the appropriate conversion factor set in the material master causes a unit conversion error at posting.
BAPI_GOODSMVT_CREATE does not raise ABAP exceptions for business logic errors — it only populates the RETURN table; callers that do not inspect RETURN before committing may commit incomplete or erroneous postings.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp