SAP Good Movement BAPI, SAP Good Movement IDoc

List of important SAP Good Movement BAPI (Create,Cancel & Getdetails)

SAP Good Movement BAPI: SAP MM-IM offers a package of SAP Good Movement BAPIs to read, update or create Material Document. Usually, the relative SAP Good Movement BAPI for Good Movement start with BAPI_GOODSMVT_*.

SAP Good Movement BAPI : Create

Let’s start with SAP Good Movement BAPI to create a Material Document.
The BAPI to consider is BAPI_GOODSMVT_CREATE. This BAPI will post goods movements.
Within BAPI_GOODSMVT_CREATE there is a call to the standard function module MB_CREATE_GOODS_MOVEMENT which generate the SAP Material Doument.

BAPI_GOODSMVT_CREATE Sample ABAP Code

Here ABAP code showing how to create in ABAP program a SAP Material Document with the Standard BAPI_GOODSMVT_CREATE.
PS: This code is not mine, check the source here. You can use as a template for your ABAP Program using this SAP BAPI.

You can find an other sample ABAP program reading a file and creating SAP Material Document for each line of the file here.

Check also   List of Main SAP WM BAPI ( SAP Warehouse Management BAPI)

Create a Material Document with Equipment ( Serial number )

A common business case (for example in SAP PM Plant Management or SAP QM for Quality Management), you may have to create document material in SAP not for the material itself but for Equipment.
Actually, SAP Equipment is identified both by :

  • Material Number
  • Serial Number

Check more on SAP PM Equipment Creation Explained – General Data (1)

The same SAP BAPI situed above BAPI_GOODSMVT_CREATE can make the job.
You have just to fill the table GOODSMVT_SERIALNUMBER with list of Equipments.

Find an ABAP Code Sample to create a Material Document with multiple equipment for a material
(Create single Material Document with Multiple Equipment)

Read more about

Check also   List of SAP PM Main Tables ( Plant Maintenance ) grouped by PM Topics

Cancel Good Movement BAPI 

In order to reverse Goods Movements, use the standard BAPI BAPI_GOODSMVT_CANCEL. This SAP BAPI will call in its processing the fm MB_CANCEL_GOODS_MOVEMENT responsible to cancelling an existing SAP Good Movement.
You can cancel the whole Good Movement as you can partially can the Material Document.

You have to set some additional information as:

  • GOODSMVT_PSTNG_DATA: Posting date
  • GOODSMVT_PR_UNAME: User Name for Printing Goods Receipt/Issue Slip

Don’t forget to call a  ‘BAPI_TRANSACTION_COMMIT’ to commit modification to Database.

Read SAP Good Movement BAPI 

BAPI_GOODSMVT_GETDETAIL

The BAPI BAPI_GOODSMVT_GETDETAIL will display Details for Material Document.
It is very helpful if you want to get a quick overview ( in ABAP ) of the Material Document.

The input are:

  • MATERIALDOCUMENT- Material Document Number
  • MATDOCUMENTYEAR – Material Document Year

and The output are:

  • GOODSMVT_HEADER – Material Document Header
  • BAPI_GOODSMVT_GETITEMS Display Detailed List of Material Documents
  • GOODSMVT_ITEMS – Material Document Items

BAPI_GOODSMVT_GETITEMS

The BAPI BAPI_GOODSMVT_GETITEMS will display a detailed List of Material Documents.
This BAPI are more Search BAPI. Acutally in input you can fill tables with range of value for

  • Range for Material
  • Plant Ranges
  • Range for Stor. Loc.
  • Range for Batch
  • Mvt Type Ranges
  • Range for Special Stock Indicator
  • Trans./Event Type Range
  • Range for Posting Date
  • Vendor Range
  • Range for User Name
  • Range for Purchasing Document

And the Return of the BAPI_GOODSMVT_GETITEMS are two tables with the list of :

  • GOODSMVT_HEADER – Table for Material Document Header
  • GOODSMVT_ITEMS – Table for Materail Document Item

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *