Beruflich Dokumente
Kultur Dokumente
FU BAPI_GOODSMVT_CREATE
____________________________________________________
Short Text
Post goods movements with MB_CREATE_GOODS_MOVEMENT
Functionality
You can use this method to create a material document for a goods movement.
You can only create one material document each time you call up the method.
You can use a simulation function before posting the goods movement to check how the data is updated in the
database. The standard system is configured so that the goods movement is posted immediately, without prior
simulation.
Ensure that you transfer the data in the same way as it is managed in the database. For example:
Ensure that the header data of the material document includes the posting date for all transactions/events listed below.
Populate the PSTNG_DATE field (import structure GOODSMVT_HEADER) in the interface BAPI2017_GM_HEAD_01
for this purpose.
Notes
From Release ERP2005 onwards, it is possible to populate customers' own fields in database tables using the
BAPI, without carrying out a modification.
The enhancements are passed on to the BAPI in a container and can be processed within the BAPI function module.
Technically, this is realized via an extension parameter (ExtensionIn) (see below or tab page 'Tables -> Long Text') .
Authorization check
In the MM Inventory Management component, the method does not perform any authorization checks.
Note that the system can also check authorization objects of other applications during the posting of a goods
movement, depending on the business transaction.
Transfer
The following information about the material document that is to be created is passed on to the method:
saphtmlp://htmlviewer.sap.com/051Mi5YR7jMXmdrznYoq2W/HTML000001.htm 11/8/2015
BAPI_GOODSMVT_CREATE Page 2 of 12
Confirmations
Messages are returned in the Return parameter. The parameter documentation shows the return codes and their
meanings.
Further information
The method can only perform your function if no error messages were generated in the Return table. This is the case if
the header data and all the items were processed successfully.
Transaction control is not implemented. The calling program therefore has to execute the Commit Work itself after
this method has been successfully invoked (in other words, if no errors were reported in the Return parameter).
The following example scenarios illustrate which fields have to be populated for which business transactions/events
(code).
Depending on the transaction, you must enter the following in the movement indicator field:
Purchase order
saphtmlp://htmlviewer.sap.com/051Mi5YR7jMXmdrznYoq2W/HTML000001.htm 11/8/2015
BAPI_GOODSMVT_CREATE Page 3 of 12
Movement type
Movement indicator
The following fields may have to be populated (this is not a complete list):
Batch (if the material is handled in batches and no automatic batch assignment has been set up)
Storage location (if no storage location us specified in the purchase order item)
Stock type
Item text
Unloading point
The following fields must not be populated (this is not a complete list):
Account assignment fields (the account assignment is adopted from the purchase order)
Reservation
Receiving/issuing material
Receiving/issuing plant
In the case of a purchase order item with the item category "subcontracting", only the GR item is to be passed
on in the interface. The GI items are determined automatically in the system.
Delivery
Delivery item
Movement type
saphtmlp://htmlviewer.sap.com/051Mi5YR7jMXmdrznYoq2W/HTML000001.htm 11/8/2015
BAPI_GOODSMVT_CREATE Page 4 of 12
Other fields as under "Purchase order known". The system determines the relevant purchase order item via the
delivery/delivery item.
Material number
Plant
Storage location
Vendor
Movement type
Movement indicator
The following fields may have to be populated (this is not a complete list):
Batch (if the material is handled in batches and batches are not assigned automatically)
Stock type
Item text
Unloading point
You cannot populate the following fields (this is not a complete list):
Account assignment fields (automatic creation of purchase order items with account assignment is not
supported)
Reservation
Receiving/issuing material
Receiving/issuing plant
saphtmlp://htmlviewer.sap.com/051Mi5YR7jMXmdrznYoq2W/HTML000001.htm 11/8/2015
BAPI_GOODSMVT_CREATE Page 5 of 12
Material number
Plant
Storage location
Vendor
Movement type
Movement indicator
The following fields may have to be populated in some cases (this is not a complete list)
Batch (if the material is handled in batches and automatic assignment of batch numbers is not set)
Item text
Unloading point
Goods recipient
Account assignment fields (automatic creation of purchase order items with account assignment is not
supported)
Reservation
Receiving/issuing material
Receiving/issuing plant
Receiving/issuing batch
The input combinations listed above for the GM_CODE 01 can be combined within an input table so that they
can be posted in a material document. Items can also be posted for different purchase orders, provided that all
the purchase orders relate to the same vendor.
saphtmlp://htmlviewer.sap.com/051Mi5YR7jMXmdrznYoq2W/HTML000001.htm 11/8/2015
BAPI_GOODSMVT_CREATE Page 6 of 12
When the end product (ordered material of a subcontract order) is posted using movement type 101, the
populated unique identification of the document line (LINE_ID) is additionally needed for the transfer of the
subcontracting components.
More information on LINE_ID and PARENT_ID
Material number
Plant
Storage location
All other fields in the method that are included in this list.
All fields that are not included in the list above. The movement indicator must be initial.
When you post a goods receipt to purchase order with movement type 102, an issue with reference to a
previously posted goods issue, the following fields must also be transferred:
Only if you transfer these fields can you be sure that the link to the original goods movement is retained.
Order
Movement type
Movement indicator
The following fields may have to be populated in some cases (this is not a complete list):
saphtmlp://htmlviewer.sap.com/051Mi5YR7jMXmdrznYoq2W/HTML000001.htm 11/8/2015
BAPI_GOODSMVT_CREATE Page 7 of 12
Batch (if the material is handled in batches and automatic batch number assignment is not set)
Storage location (if storage location has not been specified in the order)
Stock type
Item text
Unloading point
Account assignment fields (the account assignments are adopted from the purchase order)
Reservation
Receiving/issuing material
Receiving/issuing plant
Receiving/issuing batch
Material number
Plant
Storage location
Movement type
Movement indicator
The following fields may have to be populated in some cases (this is not a complete list):
saphtmlp://htmlviewer.sap.com/051Mi5YR7jMXmdrznYoq2W/HTML000001.htm 11/8/2015
BAPI_GOODSMVT_CREATE Page 8 of 12
Batch (if the material is handled in batches and automatic batch number assignment is not set)
Item text
Unloading point
Goods recipient
Reservation
Receiving/issuing material
Receiving/issuing plant
Receiving/issuing batch
Reservation number
Reservation item
Movement indicator
The following fields may have to be populated in some cases (this is not a complete list):
Batch (if the material is handled in batches and automatic batch number assignment is not set)
saphtmlp://htmlviewer.sap.com/051Mi5YR7jMXmdrznYoq2W/HTML000001.htm 11/8/2015
BAPI_GOODSMVT_CREATE Page 9 of 12
Item text
Unloading point
Goods recipient
Movement type
Material
Plant
Material number
Plant
Storage location
Movement type
Movement indicator
The following fields may have to be populated in some cases (this is not a complete list):
Receiving material
Receiving plant
Receiving batch (if material is handled in batches and you want to change batches)
saphtmlp://htmlviewer.sap.com/051Mi5YR7jMXmdrznYoq2W/HTML000001.htm 11/8/2015
BAPI_GOODSMVT_CREATE Page 10 of 12
Batch (if the material is handled in batches and automatic batch number assignment is not set)
Item text
Account assignment fields (for automatic posting lines: expense/income from stock transfer)
Reservation
You can use the Cancel method to reverse goods movements. But you may also want to cancel a goods
movement without referring to a material document (see the Cancel method).
If you want to work without referring to the document, you have to populate the BAPI_GM_ITEM_CREATE-
XSTOB field in the interface (import table GOODSMVT_ITEM). In this case, the system converts the movement
type assigned in the interface to the reversal movement type. Alternatively, you can set the reversal movement
type in the interface. In this case, the BAPI_GM_ITEM_CREATE_XSTOB field must be transferred blank.
If you want to cancel a goods movement with reference to a reservation (without using the Cancel method) you
can only transfer the BAPI_GM_ITEM_CREATE_XSTOB field if it is populated. Movement types are not
transferred when you post with reference to a reservation, as the movement type is contained in the reservation
item.
saphtmlp://htmlviewer.sap.com/051Mi5YR7jMXmdrznYoq2W/HTML000001.htm 11/8/2015
BAPI_GOODSMVT_CREATE Page 11 of 12
Material number
Plant
Further entries are not allowed. The entry quantity for the ordered material of a subcontract order must be zero.
Components
Plant
Material number
Storage location
All other fields in the method that are included in this list.
All fields that are not in the list above. The movement indicator must be blank.
When you post a subsequent adjustment, the following fields must also be transferred:
Only if you transfer these fields can you be sure that the link to the original goods movement is retained.
Parameters
GOODSMVT_HEADER
GOODSMVT_CODE
TESTRUN
saphtmlp://htmlviewer.sap.com/051Mi5YR7jMXmdrznYoq2W/HTML000001.htm 11/8/2015
BAPI_GOODSMVT_CREATE Page 12 of 12
GOODSMVT_REF_EWM
GOODSMVT_HEADRET
MATERIALDOCUMENT
MATDOCUMENTYEAR
GOODSMVT_ITEM
GOODSMVT_SERIALNUMBER
RETURN
GOODSMVT_SERV_PART_DATA
EXTENSIONIN
Exceptions
Function Group
MB_BUS2017
saphtmlp://htmlviewer.sap.com/051Mi5YR7jMXmdrznYoq2W/HTML000001.htm 11/8/2015