SAP MB_UNIT_CONVERSION Function Module for NOTRANSL: BESTANDSFÜHRUNG: Steuern von Umrechnungen der abeweichenden Meng









MB_UNIT_CONVERSION is a standard mb unit conversion 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: BESTANDSFÜHRUNG: Steuern von Umrechnungen der abeweichenden Meng 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 unit conversion FM, simply by entering the name MB_UNIT_CONVERSION into the relevant SAP transaction such as SE37 or SE38.

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



Function MB_UNIT_CONVERSION 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_UNIT_CONVERSION'"NOTRANSL: BESTANDSFÜHRUNG: Steuern von Umrechnungen der abeweichenden Meng
EXPORTING
* ERFME = ' ' "
* CUOBJ = "
* ERFMG = 0 "
* MATNR = ' ' "Material Number
* MEINS = ' ' "Base Unit of Measure
* MENGE = 0 "Quantity in base unit of measure
* UMREN = 1 "
* UMREZ = 0 "
* CHARG = "Batch
* WERKS = "Plant

IMPORTING
O_ERFME = "
O_ERFMG = "
O_MEINS = "Base Unit of Measure
O_MENGE = "
O_UMREN = "
O_UMREZ = "

EXCEPTIONS
CONVERSION_NOT_FOUND = 1 DIFFERENT_DIMENSION = 2 DIVISION_BY_ZERO = 3 OVERFLOW = 4 T006D_ENTRY_MISSING = 5 T006_ENTRY_MISSING = 6
.



IMPORTING Parameters details for MB_UNIT_CONVERSION

ERFME -

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

CUOBJ -

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

ERFMG -

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

MATNR - Material Number

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

MEINS - Base Unit of Measure

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

MENGE - Quantity in base unit of measure

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

UMREN -

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

UMREZ -

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

CHARG - Batch

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

WERKS - Plant

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

EXPORTING Parameters details for MB_UNIT_CONVERSION

O_ERFME -

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

O_ERFMG -

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

O_MEINS - Base Unit of Measure

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

O_MENGE -

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

O_UMREN -

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

O_UMREZ -

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

EXCEPTIONS details

CONVERSION_NOT_FOUND -

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

DIFFERENT_DIMENSION -

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

DIVISION_BY_ZERO - Division by zero trapped

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

OVERFLOW -

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

T006D_ENTRY_MISSING - No entry in T006D (dimensions)

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

T006_ENTRY_MISSING - No entry in T006 (units of measurement)

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

Copy and paste ABAP code example for MB_UNIT_CONVERSION 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_erfme  TYPE MSEG-ERFME, "   SPACE
lv_o_erfme  TYPE MSEG-ERFME, "   
lv_conversion_not_found  TYPE MSEG, "   
lv_cuobj  TYPE INOB-CUOBJ, "   
lv_erfmg  TYPE MSEG-ERFMG, "   0
lv_o_erfmg  TYPE MSEG-ERFMG, "   
lv_different_dimension  TYPE MSEG, "   
lv_matnr  TYPE MARA-MATNR, "   SPACE
lv_o_meins  TYPE MARA-MEINS, "   
lv_division_by_zero  TYPE MARA, "   
lv_meins  TYPE MARA-MEINS, "   SPACE
lv_o_menge  TYPE MSEG-MENGE, "   
lv_overflow  TYPE MSEG, "   
lv_menge  TYPE MSEG-MENGE, "   0
lv_o_umren  TYPE MSEG, "   
lv_t006d_entry_missing  TYPE MSEG, "   
lv_umren  TYPE MSEG, "   1
lv_o_umrez  TYPE MSEG, "   
lv_t006_entry_missing  TYPE MSEG, "   
lv_umrez  TYPE MSEG, "   0
lv_charg  TYPE MSEG-CHARG, "   
lv_werks  TYPE MSEG-WERKS. "   

  CALL FUNCTION 'MB_UNIT_CONVERSION'  "NOTRANSL: BESTANDSFÜHRUNG: Steuern von Umrechnungen der abeweichenden Meng
    EXPORTING
         ERFME = lv_erfme
         CUOBJ = lv_cuobj
         ERFMG = lv_erfmg
         MATNR = lv_matnr
         MEINS = lv_meins
         MENGE = lv_menge
         UMREN = lv_umren
         UMREZ = lv_umrez
         CHARG = lv_charg
         WERKS = lv_werks
    IMPORTING
         O_ERFME = lv_o_erfme
         O_ERFMG = lv_o_erfmg
         O_MEINS = lv_o_meins
         O_MENGE = lv_o_menge
         O_UMREN = lv_o_umren
         O_UMREZ = lv_o_umrez
    EXCEPTIONS
        CONVERSION_NOT_FOUND = 1
        DIFFERENT_DIMENSION = 2
        DIVISION_BY_ZERO = 3
        OVERFLOW = 4
        T006D_ENTRY_MISSING = 5
        T006_ENTRY_MISSING = 6
. " MB_UNIT_CONVERSION




ABAP code using 7.40 inline data declarations to call FM MB_UNIT_CONVERSION

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 ERFME FROM MSEG INTO @DATA(ld_erfme).
DATA(ld_erfme) = ' '.
 
"SELECT single ERFME FROM MSEG INTO @DATA(ld_o_erfme).
 
 
"SELECT single CUOBJ FROM INOB INTO @DATA(ld_cuobj).
 
"SELECT single ERFMG FROM MSEG INTO @DATA(ld_erfmg).
 
"SELECT single ERFMG FROM MSEG INTO @DATA(ld_o_erfmg).
 
 
"SELECT single MATNR FROM MARA INTO @DATA(ld_matnr).
DATA(ld_matnr) = ' '.
 
"SELECT single MEINS FROM MARA INTO @DATA(ld_o_meins).
 
 
"SELECT single MEINS FROM MARA INTO @DATA(ld_meins).
DATA(ld_meins) = ' '.
 
"SELECT single MENGE FROM MSEG INTO @DATA(ld_o_menge).
 
 
"SELECT single MENGE FROM MSEG INTO @DATA(ld_menge).
 
 
 
DATA(ld_umren) = 1.
 
 
 
 
"SELECT single CHARG FROM MSEG INTO @DATA(ld_charg).
 
"SELECT single WERKS FROM MSEG INTO @DATA(ld_werks).
 


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!