SAP MB_CANCEL_GOODS_MOVEMENT Function Module for NOTRANSL: Allgemeiner Funktionsbaustein zum Stornieren eines Materialbeleg









MB_CANCEL_GOODS_MOVEMENT is a standard mb cancel 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 NOTRANSL: Allgemeiner Funktionsbaustein zum Stornieren eines Materialbeleg 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 cancel goods movement FM, simply by entering the name MB_CANCEL_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_CANCEL_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_CANCEL_GOODS_MOVEMENT'"NOTRANSL: Allgemeiner Funktionsbaustein zum Stornieren eines Materialbeleg
EXPORTING
BUDAT = "Posting date
* XLISU = X "Checkbox
* BFWMS = "Control posting for external WMS
* IF_SPE_BUDAT_UHR = "Time of Goods Issue (Local, Relating to a Plant)
* IF_SPE_BUDAT_ZONE = "Time Zone
* IF_SPE_MDNUM_EWM = "
* IF_SPE_LOGSYS = "
* IF_LE_VBELN = "Delivery
* I_BKTXT = "
* MBLNR = "Material document number
* MBLPO = "Material document item
* MJAHR = "Material Document Year
* TCODE = "Transaction
* PR_UNAME = "
* VBUND = "
* XALLP = X "Checkbox
* CALLED_BY = "Clear identification of caller of MB_CREATE_GOODS_MOVEMENT

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

TABLES
* EMSEG = "Output data: material document item
* IMSEG = "Input data: material document item
* MBLPO_TAB = "
* MBLNR_TAB = "
* MBLNR_TAB_CSL_TOKEN = "IMSEG Enhancement for CSL (Cross-System Lock)
* ET_MSEG = "
.




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_CANCEL_GOODS_MOVEMENT

BUDAT - Posting date

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

XLISU - Checkbox

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

BFWMS - Control posting for external WMS

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

IF_SPE_BUDAT_UHR - Time of Goods Issue (Local, Relating to a Plant)

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

IF_SPE_BUDAT_ZONE - Time Zone

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

IF_SPE_MDNUM_EWM -

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

IF_SPE_LOGSYS -

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

IF_LE_VBELN - Delivery

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

I_BKTXT -

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

MBLNR - Material document number

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

MBLPO - Material document item

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

MJAHR - Material Document Year

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

TCODE - Transaction

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

PR_UNAME -

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

VBUND -

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

XALLP - Checkbox

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

CALLED_BY - Clear identification of caller of MB_CREATE_GOODS_MOVEMENT

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

EXPORTING Parameters details for MB_CANCEL_GOODS_MOVEMENT

EMKPF - Output data: 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_CANCEL_GOODS_MOVEMENT

EMSEG - Output data: material document item

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

IMSEG - Input data: material document item

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

MBLPO_TAB -

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

MBLNR_TAB -

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

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

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

ET_MSEG -

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

Copy and paste ABAP code example for MB_CANCEL_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_budat  TYPE MKPF-BUDAT, "   
lv_emkpf  TYPE EMKPF, "   
lt_emseg  TYPE STANDARD TABLE OF EMSEG, "   
lv_xlisu  TYPE XFELD, "   X
lv_bfwms  TYPE IMKPF-BFWMS, "   
lv_if_spe_budat_uhr  TYPE WAUHR, "   
lv_if_spe_budat_zone  TYPE TZNZONE, "   
lv_if_spe_mdnum_ewm  TYPE /SPE/MDNUM_EWM, "   
lv_if_spe_logsys  TYPE /SPE/_LOGSYS_MD, "   
lv_if_le_vbeln  TYPE VBELN_VL, "   
lv_i_bktxt  TYPE IMKPF-BKTXT, "   
lt_imseg  TYPE STANDARD TABLE OF IMSEG, "   
lv_mblnr  TYPE MSEG-MBLNR, "   
lv_e_lvs_tafkz  TYPE MSEG, "   
lv_mblpo  TYPE MSEG-ZEILE, "   
lv_es_mkpf  TYPE MKPF, "   
lt_mblpo_tab  TYPE STANDARD TABLE OF MKPF, "   
lv_mjahr  TYPE MSEG-MJAHR, "   
lt_mblnr_tab  TYPE STANDARD TABLE OF MBWO_MBLNR_TAB, "   
lv_tcode  TYPE SY-TCODE, "   
lt_mblnr_tab_csl_token  TYPE STANDARD TABLE OF APPEND_CSL_TOKEN, "   
lt_et_mseg  TYPE STANDARD TABLE OF MSEG, "   
lv_pr_uname  TYPE IMKPF-PR_UNAME, "   
lv_vbund  TYPE IMKPF-VBUND, "   
lv_xallp  TYPE XFELD, "   X
lv_called_by  TYPE CALLED_BY. "   

  CALL FUNCTION 'MB_CANCEL_GOODS_MOVEMENT'  "NOTRANSL: Allgemeiner Funktionsbaustein zum Stornieren eines Materialbeleg
    EXPORTING
         BUDAT = lv_budat
         XLISU = lv_xlisu
         BFWMS = lv_bfwms
         IF_SPE_BUDAT_UHR = lv_if_spe_budat_uhr
         IF_SPE_BUDAT_ZONE = lv_if_spe_budat_zone
         IF_SPE_MDNUM_EWM = lv_if_spe_mdnum_ewm
         IF_SPE_LOGSYS = lv_if_spe_logsys
         IF_LE_VBELN = lv_if_le_vbeln
         I_BKTXT = lv_i_bktxt
         MBLNR = lv_mblnr
         MBLPO = lv_mblpo
         MJAHR = lv_mjahr
         TCODE = lv_tcode
         PR_UNAME = lv_pr_uname
         VBUND = lv_vbund
         XALLP = lv_xallp
         CALLED_BY = lv_called_by
    IMPORTING
         EMKPF = lv_emkpf
         E_LVS_TAFKZ = lv_e_lvs_tafkz
         ES_MKPF = lv_es_mkpf
    TABLES
         EMSEG = lt_emseg
         IMSEG = lt_imseg
         MBLPO_TAB = lt_mblpo_tab
         MBLNR_TAB = lt_mblnr_tab
         MBLNR_TAB_CSL_TOKEN = lt_mblnr_tab_csl_token
         ET_MSEG = lt_et_mseg
. " MB_CANCEL_GOODS_MOVEMENT




ABAP code using 7.40 inline data declarations to call FM MB_CANCEL_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.

"SELECT single BUDAT FROM MKPF INTO @DATA(ld_budat).
 
 
 
DATA(ld_xlisu) = X.
 
"SELECT single BFWMS FROM IMKPF INTO @DATA(ld_bfwms).
 
 
 
 
 
 
"SELECT single BKTXT FROM IMKPF INTO @DATA(ld_i_bktxt).
 
 
"SELECT single MBLNR FROM MSEG INTO @DATA(ld_mblnr).
 
 
"SELECT single ZEILE FROM MSEG INTO @DATA(ld_mblpo).
 
 
 
"SELECT single MJAHR FROM MSEG INTO @DATA(ld_mjahr).
 
 
"SELECT single TCODE FROM SY INTO @DATA(ld_tcode).
 
 
 
"SELECT single PR_UNAME FROM IMKPF INTO @DATA(ld_pr_uname).
 
"SELECT single VBUND FROM IMKPF INTO @DATA(ld_vbund).
 
DATA(ld_xallp) = X.
 
 


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!