Create single Material Document with Multiple Equipment

The following is a sample ABAP code to Create single Material Document with Multiple Equipment.
If you have to move multiple Materials from Different Plant or Storage location with the same Movement Type, you have to create ONE Material Document for each Material/Plant/Storage Location.

Prepare Data

Set GM_CODE

GM_CODE is very important. It defines the nature of Good Movement.

The full list for GM_CODE is:

Table Description
GM_CODE Transaction Description
01 MB01 Post Goods Receipt for PO
02 MB31 Goods Receipt for Production Order
03 MB1A Goods Withdrawal
04 MB1B Transfer Posting
05 MB1C Other Goods Receipts
06 MB11 Goods Movement
07 MB04 Subsequ.Adj.of Mat.ProvidedConsmp.

For example, if you want to transfer stock for a plant to an other, use 04 as GM_CODE for Transfer Posting.

Set Movement Type on Item level

Next, you have to set the movement type.
Here a link to the complete list of SAP Movement Types.

In the following ABAP Sample Code, we will be using 311 for?Transfer of storage location to storage location in one step.

Equipment / Serial Number Data

Once the header and the Items are set for Material Document, we have to set the equipment

Within a loop of equipment ( Serial Number), for each serial Number found for the material in the item, we add a new line to GOODSMV_SERIALNUMBER with the following data:

  • GOODSMV_SERIALNUMBER-matdoc_itm?=?1?
  • GOODSMV_SERIALNUMBER-serialno = “the serial number”

ABAP Simple Code

?