In this sample we create a goods receipt for a goods movement with BAPI_GOODSMVT_CREATE. The Parameter “GM_CODE” represents the transaction code that would be used to post the movement as dialog user. The value “01” is replaced by SAP with the transaction code MB01. MB01 is used to create a goods receipt for purchase order. Further values for this parameter would be “02” for goods receipt for order (MB31) or “05” for other goods receipts (MB1C).
Important values for the header data structure are the Posting Date of the Document, the Username, and the Document Date. The item data rows are filled in our example with reference to the purchase order. The parameter MOVE_TYPE “101” is the Movement Type for the goods receipt for purchase order into warehouse/stores. The Storage Location for the goods can be set in the parameter “STGE_LOC”. Since we create a goods movement for a purchase order, we have to set the parameters PO_NUMBER and the PO_ITEM with the Purchase Order Number and the Purchase Order Item. The Movement Indicator in the parameter “MVT_IND” specifies the type of document that constitutes the basis for the movement. Possible types are Purchase Order or Delivery Note for example.
If a goods receipt is successfully created the function returns the material document number and the year.
To get the function running a connection object (Con) must be available.