The following is an abap program making used of the BAPI function BAPI_GOODSMVT_CREATE to do Goods Receipts for Purchase Order after importing the data from an external system.
* * BAPI TO Upload Inventory Data * * GMCODE Table T158G - 01 - MB01 - Goods Receipts for Purchase Order * 02 - MB31 - Goods Receipts for Prod Order * 03 - MB1A - Goods Issue * 04 - MB1B - Transfer Posting * 05 - MB1C - Enter Other Goods Receipt * 06 - MB11 * * Domain: KZBEW - Movement Indicator * Goods movement w/o reference * B - Goods movement for purchase order * F - Goods movement for production order * L - Goods movement for delivery note * K - Goods movement for kanban requirement (WM - internal only) * O - Subsequent adjustment of "material-provided" consumption * W - Subsequent adjustment of proportion/product unit material