SAP OIB_MATERIAL_UNIT_CONVERSION Function Module for Convert quantities between non-base UoMs
OIB_MATERIAL_UNIT_CONVERSION is a standard oib material 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 Convert quantities between non-base UoMs 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 oib material unit conversion FM, simply by entering the name OIB_MATERIAL_UNIT_CONVERSION into the relevant SAP transaction such as SE37 or SE38.
Function Group: OIB_QCI_TOOLS
Program Name: SAPLOIB_QCI_TOOLS
Main Program: SAPLOIB_QCI_TOOLS
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function OIB_MATERIAL_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 'OIB_MATERIAL_UNIT_CONVERSION'"Convert quantities between non-base UoMs.
EXPORTING
IV_MATNR = "Input material
* IV_PLANT = "Plant
* IV_CHARG = "Batch number
IV_INUOM = "Input UoM
IV_OUTUOM = "Target UoM
IV_QUANTITY = "Input quantity in inuom
* IV_BASUOM = "Input Material Base Unit of Measure
IMPORTING
EV_QUANTITY = "Output quantity
EV_FACTOR = "Output factor
EXCEPTIONS
ERROR_MATERIAL_READ = 1 CONVERSION_FAILED = 2
IMPORTING Parameters details for OIB_MATERIAL_UNIT_CONVERSION
IV_MATNR - Input material
Data type: MARA-MATNROptional: No
Call by Reference: No ( called with pass by value option)
IV_PLANT - Plant
Data type: T001W-WERKSOptional: Yes
Call by Reference: No ( called with pass by value option)
IV_CHARG - Batch number
Data type: MCHA-CHARGOptional: Yes
Call by Reference: No ( called with pass by value option)
IV_INUOM - Input UoM
Data type: T006-MSEHIOptional: No
Call by Reference: No ( called with pass by value option)
IV_OUTUOM - Target UoM
Data type: T006-MSEHIOptional: No
Call by Reference: No ( called with pass by value option)
IV_QUANTITY - Input quantity in inuom
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
IV_BASUOM - Input Material Base Unit of Measure
Data type: MARA-MEINSOptional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for OIB_MATERIAL_UNIT_CONVERSION
EV_QUANTITY - Output quantity
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
EV_FACTOR - Output factor
Data type: FOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
ERROR_MATERIAL_READ -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
CONVERSION_FAILED -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for OIB_MATERIAL_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_iv_matnr | TYPE MARA-MATNR, " | |||
| lv_ev_quantity | TYPE MARA, " | |||
| lv_error_material_read | TYPE MARA, " | |||
| lv_iv_plant | TYPE T001W-WERKS, " | |||
| lv_ev_factor | TYPE F, " | |||
| lv_conversion_failed | TYPE F, " | |||
| lv_iv_charg | TYPE MCHA-CHARG, " | |||
| lv_iv_inuom | TYPE T006-MSEHI, " | |||
| lv_iv_outuom | TYPE T006-MSEHI, " | |||
| lv_iv_quantity | TYPE T006, " | |||
| lv_iv_basuom | TYPE MARA-MEINS. " |
|   CALL FUNCTION 'OIB_MATERIAL_UNIT_CONVERSION' "Convert quantities between non-base UoMs |
| EXPORTING | ||
| IV_MATNR | = lv_iv_matnr | |
| IV_PLANT | = lv_iv_plant | |
| IV_CHARG | = lv_iv_charg | |
| IV_INUOM | = lv_iv_inuom | |
| IV_OUTUOM | = lv_iv_outuom | |
| IV_QUANTITY | = lv_iv_quantity | |
| IV_BASUOM | = lv_iv_basuom | |
| IMPORTING | ||
| EV_QUANTITY | = lv_ev_quantity | |
| EV_FACTOR | = lv_ev_factor | |
| EXCEPTIONS | ||
| ERROR_MATERIAL_READ = 1 | ||
| CONVERSION_FAILED = 2 | ||
| . " OIB_MATERIAL_UNIT_CONVERSION | ||
ABAP code using 7.40 inline data declarations to call FM OIB_MATERIAL_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 MATNR FROM MARA INTO @DATA(ld_iv_matnr). | ||||
| "SELECT single WERKS FROM T001W INTO @DATA(ld_iv_plant). | ||||
| "SELECT single CHARG FROM MCHA INTO @DATA(ld_iv_charg). | ||||
| "SELECT single MSEHI FROM T006 INTO @DATA(ld_iv_inuom). | ||||
| "SELECT single MSEHI FROM T006 INTO @DATA(ld_iv_outuom). | ||||
| "SELECT single MEINS FROM MARA INTO @DATA(ld_iv_basuom). | ||||
Search for further information about these or an SAP related objects