SAP BAPI_GOODSMVT_CREATE Function Module for Post goods movements with MB_CREATE_GOODS_MOVEMENT
BAPI_GOODSMVT_CREATE is a standard bapi goodsmvt create SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Post goods movements with MB_CREATE_GOODS_MOVEMENT processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for bapi goodsmvt create FM, simply by entering the name BAPI_GOODSMVT_CREATE into the relevant SAP transaction such as SE37 or SE38.
Function Group: MB_BUS2017
Program Name: SAPLMB_BUS2017
Main Program: SAPLMB_BUS2017
Appliation area: M
Release date: 23-Jul-1998
Mode(Normal, Remote etc): Remote-Enabled
Update:

Function BAPI_GOODSMVT_CREATE pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION 'BAPI_GOODSMVT_CREATE'"Post goods movements with MB_CREATE_GOODS_MOVEMENT.
EXPORTING
GOODSMVT_HEADER = "Material Document Header Data
GOODSMVT_CODE = "Assign Code to Transaction for Goods Movement
* TESTRUN = ' ' "Simulate Goods Movement
* GOODSMVT_REF_EWM = "BAPI Communication Structure: Material Document EWM Ref.
IMPORTING
GOODSMVT_HEADRET = "Material Document Number/Material Document Year
MATERIALDOCUMENT = "Number of Material Document
MATDOCUMENTYEAR = "Material Document Year
TABLES
GOODSMVT_ITEM = "Material Document Items
* GOODSMVT_SERIALNUMBER = "Serial Number
RETURN = "Return Messages
* GOODSMVT_SERV_PART_DATA = "
* EXTENSIONIN = "Reference Structure for BAPI Parameters EXTENSIONIN/EXTENSIONOUT
IMPORTING Parameters details for BAPI_GOODSMVT_CREATE
GOODSMVT_HEADER - Material Document Header Data
Data type: BAPI2017_GM_HEAD_01Optional: No
Call by Reference: No ( called with pass by value option)
GOODSMVT_CODE - Assign Code to Transaction for Goods Movement
Data type: BAPI2017_GM_CODEOptional: No
Call by Reference: No ( called with pass by value option)
TESTRUN - Simulate Goods Movement
Data type: BAPI2017_GM_GEN-TESTRUNDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
GOODSMVT_REF_EWM - BAPI Communication Structure: Material Document EWM Ref.
Data type: /SPE/BAPI2017_GM_REF_EWMOptional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for BAPI_GOODSMVT_CREATE
GOODSMVT_HEADRET - Material Document Number/Material Document Year
Data type: BAPI2017_GM_HEAD_RETOptional: No
Call by Reference: No ( called with pass by value option)
MATERIALDOCUMENT - Number of Material Document
Data type: BAPI2017_GM_HEAD_RET-MAT_DOCOptional: No
Call by Reference: No ( called with pass by value option)
MATDOCUMENTYEAR - Material Document Year
Data type: BAPI2017_GM_HEAD_RET-DOC_YEAROptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for BAPI_GOODSMVT_CREATE
GOODSMVT_ITEM - Material Document Items
Data type: BAPI2017_GM_ITEM_CREATEOptional: No
Call by Reference: No ( called with pass by value option)
GOODSMVT_SERIALNUMBER - Serial Number
Data type: BAPI2017_GM_SERIALNUMBEROptional: Yes
Call by Reference: No ( called with pass by value option)
RETURN - Return Messages
Data type: BAPIRET2Optional: No
Call by Reference: No ( called with pass by value option)
GOODSMVT_SERV_PART_DATA -
Data type: /SPE/BAPI2017_SERVICEPART_DATAOptional: Yes
Call by Reference: Yes
EXTENSIONIN - Reference Structure for BAPI Parameters EXTENSIONIN/EXTENSIONOUT
Data type: BAPIPAREXOptional: Yes
Call by Reference: Yes
Copy and paste ABAP code example for BAPI_GOODSMVT_CREATE Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.| DATA: | ||||
| lt_goodsmvt_item | TYPE STANDARD TABLE OF BAPI2017_GM_ITEM_CREATE, " | |||
| lv_goodsmvt_header | TYPE BAPI2017_GM_HEAD_01, " | |||
| lv_goodsmvt_headret | TYPE BAPI2017_GM_HEAD_RET, " | |||
| lv_goodsmvt_code | TYPE BAPI2017_GM_CODE, " | |||
| lv_materialdocument | TYPE BAPI2017_GM_HEAD_RET-MAT_DOC, " | |||
| lt_goodsmvt_serialnumber | TYPE STANDARD TABLE OF BAPI2017_GM_SERIALNUMBER, " | |||
| lt_return | TYPE STANDARD TABLE OF BAPIRET2, " | |||
| lv_testrun | TYPE BAPI2017_GM_GEN-TESTRUN, " SPACE | |||
| lv_matdocumentyear | TYPE BAPI2017_GM_HEAD_RET-DOC_YEAR, " | |||
| lv_goodsmvt_ref_ewm | TYPE /SPE/BAPI2017_GM_REF_EWM, " | |||
| lt_goodsmvt_serv_part_data | TYPE STANDARD TABLE OF /SPE/BAPI2017_SERVICEPART_DATA, " | |||
| lt_extensionin | TYPE STANDARD TABLE OF BAPIPAREX. " |
|   CALL FUNCTION 'BAPI_GOODSMVT_CREATE' "Post goods movements with MB_CREATE_GOODS_MOVEMENT |
| EXPORTING | ||
| GOODSMVT_HEADER | = lv_goodsmvt_header | |
| GOODSMVT_CODE | = lv_goodsmvt_code | |
| TESTRUN | = lv_testrun | |
| GOODSMVT_REF_EWM | = lv_goodsmvt_ref_ewm | |
| IMPORTING | ||
| GOODSMVT_HEADRET | = lv_goodsmvt_headret | |
| MATERIALDOCUMENT | = lv_materialdocument | |
| MATDOCUMENTYEAR | = lv_matdocumentyear | |
| TABLES | ||
| GOODSMVT_ITEM | = lt_goodsmvt_item | |
| GOODSMVT_SERIALNUMBER | = lt_goodsmvt_serialnumber | |
| RETURN | = lt_return | |
| GOODSMVT_SERV_PART_DATA | = lt_goodsmvt_serv_part_data | |
| EXTENSIONIN | = lt_extensionin | |
| . " BAPI_GOODSMVT_CREATE | ||
ABAP code using 7.40 inline data declarations to call FM BAPI_GOODSMVT_CREATE
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.| "SELECT single MAT_DOC FROM BAPI2017_GM_HEAD_RET INTO @DATA(ld_materialdocument). | ||||
| "SELECT single TESTRUN FROM BAPI2017_GM_GEN INTO @DATA(ld_testrun). | ||||
| DATA(ld_testrun) | = ' '. | |||
| "SELECT single DOC_YEAR FROM BAPI2017_GM_HEAD_RET INTO @DATA(ld_matdocumentyear). | ||||
Search for further information about these or an SAP related objects