SAP MB_CREATE_GOODS_MOVEMENT Function Module for General function module for posting of goods movements









MB_CREATE_GOODS_MOVEMENT is a standard mb create goods movement SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for General function module for posting of goods movements 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 mb create goods movement FM, simply by entering the name MB_CREATE_GOODS_MOVEMENT into the relevant SAP transaction such as SE37 or SE38.

Function Group: MBWL
Program Name: SAPLMBWL
Main Program: SAPLMBWL
Appliation area: M
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:



Function MB_CREATE_GOODS_MOVEMENT 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 'MB_CREATE_GOODS_MOVEMENT'"General function module for posting of goods movements
EXPORTING
IMKPF = "Input data for material document header
* XLISU = 'X' "Call up order statistics
* XQMSR = ' ' "
* MSR_MB_DATA = "
* XSITKZ = "SiT: Destination for Goods Issue from Issuing SiT
* XALLP = ' ' "Only post if all items are o.k.
* XALLB = ' ' "
* XALLR = ' ' "Reset all data (same as initial call)
* CTCOD = ' ' "Transaction Code
* XQMCL = ' ' "Call up from QM
* OLD_SUBRC = ' ' "SUBRC of preceding call
* IPKCOM = "Communication structure Kanban
* X_AUTHORITY = ' ' "Authorization Check

IMPORTING
EMKPF = "Output data for material document header
E_LVS_TAFKZ = "
ES_MKPF = "

TABLES
EMSEG = "Output Data of Material Document Items
IMSEG = "Input Data of Material Document Items
* IMSEG_CSL_TOKEN = "IMSEG Enhancement for CSL (Cross-System Lock)
* ET_MSEG = "
* IACCOUNTING = "Purchasing Fields Account Assignment Inventory Management
* IACCOUNTING_CR = "Purchasing Fields Acct Assignment Inv. Mgmt (Currencies)
.




Customer Function user exits

Below is a list of CUSTOMER FUNCTION exit user exits that are available within this program and maybe relevant for this FM.
EXIT_SAPLMBWL_400 call customer function: transfer of details to GR

IMPORTING Parameters details for MB_CREATE_GOODS_MOVEMENT

IMKPF - Input data for material document header

Data type: IMKPF
Optional: No
Call by Reference: No ( called with pass by value option)

XLISU - Call up order statistics

Data type:
Default: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)

XQMSR -

Data type:
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

MSR_MB_DATA -

Data type: MSR_T_MB_DATA
Optional: Yes
Call by Reference: No ( called with pass by value option)

XSITKZ - SiT: Destination for Goods Issue from Issuing SiT

Data type: SITKZ
Optional: Yes
Call by Reference: No ( called with pass by value option)

XALLP - Only post if all items are o.k.

Data type:
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

XALLB -

Data type:
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

XALLR - Reset all data (same as initial call)

Data type:
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

CTCOD - Transaction Code

Data type: SY-TCODE
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

XQMCL - Call up from QM

Data type:
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

OLD_SUBRC - SUBRC of preceding call

Data type: EMKPF-SUBRC
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

IPKCOM - Communication structure Kanban

Data type: PKCOM
Optional: Yes
Call by Reference: No ( called with pass by value option)

X_AUTHORITY - Authorization Check

Data type:
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXPORTING Parameters details for MB_CREATE_GOODS_MOVEMENT

EMKPF - Output data for material document header

Data type: EMKPF
Optional: No
Call by Reference: No ( called with pass by value option)

E_LVS_TAFKZ -

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

ES_MKPF -

Data type: MKPF
Optional: No
Call by Reference: Yes

TABLES Parameters details for MB_CREATE_GOODS_MOVEMENT

EMSEG - Output Data of Material Document Items

Data type: EMSEG
Optional: No
Call by Reference: No ( called with pass by value option)

IMSEG - Input Data of Material Document Items

Data type: IMSEG
Optional: No
Call by Reference: No ( called with pass by value option)

IMSEG_CSL_TOKEN - IMSEG Enhancement for CSL (Cross-System Lock)

Data type: APPEND_CSL_TOKEN
Optional: Yes
Call by Reference: No ( called with pass by value option)

ET_MSEG -

Data type: MSEG
Optional: Yes
Call by Reference: No ( called with pass by value option)

IACCOUNTING - Purchasing Fields Account Assignment Inventory Management

Data type: ACCOUNTING
Optional: Yes
Call by Reference: Yes

IACCOUNTING_CR - Purchasing Fields Acct Assignment Inv. Mgmt (Currencies)

Data type: ACCOUNTING_CR
Optional: Yes
Call by Reference: Yes

Copy and paste ABAP code example for MB_CREATE_GOODS_MOVEMENT 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:
lv_emkpf  TYPE EMKPF, "   
lt_emseg  TYPE STANDARD TABLE OF EMSEG, "   
lv_imkpf  TYPE IMKPF, "   
lv_xlisu  TYPE IMKPF, "   'X'
lv_xqmsr  TYPE IMKPF, "   SPACE
lv_msr_mb_data  TYPE MSR_T_MB_DATA, "   
lv_xsitkz  TYPE SITKZ, "   
lt_imseg  TYPE STANDARD TABLE OF IMSEG, "   
lv_xallp  TYPE IMSEG, "   SPACE
lv_e_lvs_tafkz  TYPE IMSEG, "   
lv_xallb  TYPE IMSEG, "   SPACE
lv_es_mkpf  TYPE MKPF, "   
lt_imseg_csl_token  TYPE STANDARD TABLE OF APPEND_CSL_TOKEN, "   
lv_xallr  TYPE APPEND_CSL_TOKEN, "   SPACE
lt_et_mseg  TYPE STANDARD TABLE OF MSEG, "   
lv_ctcod  TYPE SY-TCODE, "   SPACE
lt_iaccounting  TYPE STANDARD TABLE OF ACCOUNTING, "   
lv_xqmcl  TYPE ACCOUNTING, "   SPACE
lt_iaccounting_cr  TYPE STANDARD TABLE OF ACCOUNTING_CR, "   
lv_old_subrc  TYPE EMKPF-SUBRC, "   SPACE
lv_ipkcom  TYPE PKCOM, "   
lv_x_authority  TYPE PKCOM. "   SPACE

  CALL FUNCTION 'MB_CREATE_GOODS_MOVEMENT'  "General function module for posting of goods movements
    EXPORTING
         IMKPF = lv_imkpf
         XLISU = lv_xlisu
         XQMSR = lv_xqmsr
         MSR_MB_DATA = lv_msr_mb_data
         XSITKZ = lv_xsitkz
         XALLP = lv_xallp
         XALLB = lv_xallb
         XALLR = lv_xallr
         CTCOD = lv_ctcod
         XQMCL = lv_xqmcl
         OLD_SUBRC = lv_old_subrc
         IPKCOM = lv_ipkcom
         X_AUTHORITY = lv_x_authority
    IMPORTING
         EMKPF = lv_emkpf
         E_LVS_TAFKZ = lv_e_lvs_tafkz
         ES_MKPF = lv_es_mkpf
    TABLES
         EMSEG = lt_emseg
         IMSEG = lt_imseg
         IMSEG_CSL_TOKEN = lt_imseg_csl_token
         ET_MSEG = lt_et_mseg
         IACCOUNTING = lt_iaccounting
         IACCOUNTING_CR = lt_iaccounting_cr
. " MB_CREATE_GOODS_MOVEMENT




ABAP code using 7.40 inline data declarations to call FM MB_CREATE_GOODS_MOVEMENT

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.

 
 
 
DATA(ld_xlisu) = 'X'.
 
DATA(ld_xqmsr) = ' '.
 
 
 
 
DATA(ld_xallp) = ' '.
 
 
DATA(ld_xallb) = ' '.
 
 
 
DATA(ld_xallr) = ' '.
 
 
"SELECT single TCODE FROM SY INTO @DATA(ld_ctcod).
DATA(ld_ctcod) = ' '.
 
 
DATA(ld_xqmcl) = ' '.
 
 
"SELECT single SUBRC FROM EMKPF INTO @DATA(ld_old_subrc).
DATA(ld_old_subrc) = ' '.
 
 
DATA(ld_x_authority) = ' '.
 


Search for further information about these or an SAP related objects



Comments on this SAP object

What made you want to lookup this SAP object? Please tell us what you were looking for and anything you would like to be included on this page!