Symptom
When using the API_MATERIAL_DOCUMENT to post the goods receipt for a Production Order, the material document generated with Transaction/Event type "WE - Goods Receipt for Purchase Order" rather than "WF - Goods Receipt for Order"
Environment
- SAP S/4HANA Cloud
Reproducing the Issue
You post a Goods Receipt for a Production Order in 'Post Goods Movement' - MM Document refers to VGART = WF
You post a Goods Receipt for a Production Order via the API - MM Document refers to VGART = WE
{
"DocumentDate": "/Date()/",
"PostingDate": "/Date()/",
"GoodsMovementCode": "01",
"to_MaterialDocumentItem": [
{
"Plant": "1010",
"GoodsMovementType": "101",
"ManufacturingOrder": "00000123456",
"GoodsMovementRefDocType": "F",
"EntryUnit": "ST",
"QuantityInEntryUnit": "1"
}
]
}
The following values are supported for the GoodsMovementCode property:
01 - Goods Receipt for Purchase Order
02 - Goods Receipt for Production Order
03 - Goods Issue
04 - Transfer Posting
05 - Other Goods Receipt
06 - Reversal of Goods Movements
07 - Subsequent Adjustment with Regard to a Subcontract Order
Cause
VGART
WE Goods Receipt for Purchase Order
WF Goods Receipt for Order
The Material Document transaction type is assigned automatically by the system based on the transaction code assigned to the posting from the customising in table T158. In a cloud environment this is delivered content which cannot be changed via an SSCUI.
T158
TCODE TRTYP BLART BLAUM VGART
MB01 H WE PR WE <<<-----
MB1A H WA PR WA
MB1B H WA PR WA
MB1C H WA PR WA
MIGO H WE PR WE
MIGO_GI H WA PR WA
MIGO_GO H WE PR WF <<<-----
MIGO_GR H WE PR WE
MIGO_GS H WE PR WO
MIGO_TR H WA PR WA
During the goods movement posting via the API, if you are you filling GOODSMVT_CODE = 01 in the payload, this refers to MB01 as per table T158G, which has VGART= WE assigned as per table T158.
T158G
GMCODE TCODE
01 MB01 <<---
02 MB31
03 MB1A
04 MB1B
05 MB1C
06 MB11
07 MB04
Checking table T158 only the following transactions refer to VGART = WF
TCODE TRTYP BLART VGART
MB31 H WE WF
MIGO_GO H WE WF
VL02N_F H WL WF
VL32N_F H WE WF
Resolution
In the payload, ensure that you enter GOODSMVT_CODE = 02, this should then consider transaction MB31 which refers to VGART = WF.
{
"DocumentDate": "/Date()/",
"PostingDate": "/Date()/",
"GoodsMovementCode": "02", <<------
"to_MaterialDocumentItem": [
{
"Plant": "1010",
"GoodsMovementType": "101",
"ManufacturingOrder": "00000123456",
"GoodsMovementRefDocType": "F",
"EntryUnit": "ST",
"QuantityInEntryUnit": "1"
}
]
}
Keywords
API, Post Goods Movement, MIGO, VGART, Transaction Type, WE, WF, Payload, GoodsMovementCode, TCODE2, API_MATERIAL_DOCUMENT_SRV, A_MaterialDocumentHeader , KBA , MM-IM-VDM-SGM-2CL , VDM Stock and Goods Movements (Public Cloud) , MM-IM-GF-BAPI-2CL , BAPIs for Goods Movements (Public Cloud) , How To