Symptom
- Error message: LB/031, M7 389
- Message: Of the required quantity of material xxxxxx, xx xxx remain(s) open
Environment
SAP S/4HANA Cloud Public Edition
Reproducing the Issue
- Request URL: /sap/opu/odata/sap/API_MATERIAL_DOCUMENT_SRV/A_MaterialDocumentHeader
- Payload:
{
"MaterialDocumentHeaderText": "XXXXXXXXXXX",
"GoodsMovementCode": "01",
"to_MaterialDocumentItem": {
"results": [
{
"Material": "XXXXXXX",
"Plant": "1XXX",
"StorageLocation": "1XXX",
"Batch": "XXXXX",
"BatchBySupplier": "",
"GoodsMovementType": "101",
"GoodsMovementRefDocType": "B",
"PurchaseOrder": "4XXXXXXXX",
"PurchaseOrderItem": "10",
"EntryUnit": "EA",
"QuantityInEntryUnit": "1",
"IsCompletelyDelivered": false,
"ManufactureDate": "2025-XX-XXT00:00:00"
},
{
"Material": "XXXXXXXX",
"Plant": "1XXX",
"Batch": "2XXXXXX",
"GoodsMovementType": "543",
"Supplier": "7XXXXX",
"InventorySpecialStockType": "O",
"PurchaseOrder": "4XXXXXX",
"PurchaseOrderItem": "10",
"EntryUnit": "EA",
"QuantityInEntryUnit": "2"
}
]
}
}
Cause
Payload is not properly maintained:
Need to additionally assign "MaterialDocumentLine" (to 101 + 543 posting) and "MaterialDocumentParentLine" (to 543 posting only). Only like this, the system can keep the relation between finished material and components, and input data of the 543 like batch is taken into account appropriately.
Resolution
- Modify the provided payload as follows:
{
"MaterialDocumentHeaderText": "XXXXXXXXXXXXXX",
"GoodsMovementCode": "01",
"to_MaterialDocumentItem": {
"results": [
{
"MaterialDocumentLine": "0001", >>>>>>>>>>>>>>>>>>>>add this line here
"Material": "XXXXXX",
"Plant": "1XXX",
"StorageLocation": "1XXX",
"Batch": "2XXXXXXX",
"BatchBySupplier": "",
"GoodsMovementType": "101",
"GoodsMovementRefDocType": "B",
"PurchaseOrder": "4XXXXXXXXX",
"PurchaseOrderItem": "10",
"EntryUnit": "EA",
"QuantityInEntryUnit": "1",
"IsCompletelyDelivered": false,
"ManufactureDate": "2025-XX-XXT00:00:00"
},
{
"MaterialDocumentLine": "0002", >>>>>>>>>>>>>>>>>>> add this line here
"MaterialDocumentParentLine": "0001", >>>>>>>>>>>>>>>>> add this line here
"Material": "XXXXXX",
"Plant": "1XXX",
"Batch": "2XXXXXXXXX",
"GoodsMovementType": "543",
"Supplier": "7XXXXXX",
"InventorySpecialStockType": "O",
"PurchaseOrder": "4XXXXXXXX",
"PurchaseOrderItem": "10",
"EntryUnit": "EA",
"QuantityInEntryUnit": "X"
}
]
}
}
Using the modified payload, the post works successfully, and generates the material document.
Keywords
Error LB/031, M7389, subcontracting purchase order, api, sap s/4hana cloud public edition, material document, goods movement, payload, batch, supplier, inventory special stock type, quantity in entry unit, material document line , KBA , MM-IM-GF-2CL , Basic Functions (Public Cloud) , Problem
SAP Knowledge Base Article - Public