SAP COM_PRODUCT_UNIT_CONVERSION Function Module for









COM_PRODUCT_UNIT_CONVERSION is a standard com product 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 to perform a specific ABAP function and below is the pattern details, 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 com product unit conversion FM, simply by entering the name COM_PRODUCT_UNIT_CONVERSION into the relevant SAP transaction such as SE37 or SE38.

Function Group: COM_PRODUCT_UNIT_API
Program Name: SAPLCOM_PRODUCT_UNIT_API
Main Program:
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Remote-Enabled
Update:



Function COM_PRODUCT_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 'COM_PRODUCT_UNIT_CONVERSION'"
EXPORTING
IV_PRODUCT_GUID = "Product
IV_INPUT = "
IV_UNIT = "
* IV_BASE_UNIT = ' ' "
* IV_FLAG_UNIT = ' ' "
* IV_USE_NET_WEIGHT = ' ' "
* IV_CURRENT = 'X' "
* IV_TIMESTAMP = "
* IV_PRWB = ' ' "

IMPORTING
EV_BASE_UNIT = "
EV_OUTPUT = "Output Value
EV_NUMERATOR = "
EV_DENOMINATOR = "
EV_ADD_CONST = "

EXCEPTIONS
WRONG_CALL = 1 NO_UNITS_FOUND = 2 BASE_UNIT_NOT_FOUND = 3 IV_UNIT_NOT_FOUND = 4 CONVERSION_NOT_FOUND = 5 OVERFLOW = 6
.



IMPORTING Parameters details for COM_PRODUCT_UNIT_CONVERSION

IV_PRODUCT_GUID - Product

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

IV_INPUT -

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

IV_UNIT -

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

IV_BASE_UNIT -

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

IV_FLAG_UNIT -

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

IV_USE_NET_WEIGHT -

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

IV_CURRENT -

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

IV_TIMESTAMP -

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

IV_PRWB -

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

EXPORTING Parameters details for COM_PRODUCT_UNIT_CONVERSION

EV_BASE_UNIT -

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

EV_OUTPUT - Output Value

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

EV_NUMERATOR -

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

EV_DENOMINATOR -

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

EV_ADD_CONST -

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

EXCEPTIONS details

WRONG_CALL -

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

NO_UNITS_FOUND -

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

BASE_UNIT_NOT_FOUND -

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

IV_UNIT_NOT_FOUND -

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

CONVERSION_NOT_FOUND -

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)

Copy and paste ABAP code example for COM_PRODUCT_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_wrong_call  TYPE STRING, "   
lv_ev_base_unit  TYPE COMT_UNIT, "   
lv_iv_product_guid  TYPE COMT_PRODUCT_GUID, "   
lv_iv_input  TYPE COMT_QUANTITY, "   
lv_ev_output  TYPE COMT_QUANTITY, "   
lv_no_units_found  TYPE COMT_QUANTITY, "   
lv_iv_unit  TYPE COMT_UNIT, "   
lv_ev_numerator  TYPE COMT_NUMERATOR, "   
lv_base_unit_not_found  TYPE COMT_NUMERATOR, "   
lv_iv_base_unit  TYPE COMT_UNIT, "   ' '
lv_ev_denominator  TYPE COMT_DENOMINATOR, "   
lv_iv_unit_not_found  TYPE COMT_DENOMINATOR, "   
lv_ev_add_const  TYPE ADDKO, "   
lv_iv_flag_unit  TYPE COMT_BOOLEAN, "   ' '
lv_conversion_not_found  TYPE COMT_BOOLEAN, "   
lv_overflow  TYPE COMT_BOOLEAN, "   
lv_iv_use_net_weight  TYPE COMT_BOOLEAN, "   ' '
lv_iv_current  TYPE COMT_BOOLEAN, "   'X'
lv_iv_timestamp  TYPE COMT_TIMESTAMP, "   
lv_iv_prwb  TYPE COMT_BOOLEAN. "   SPACE

  CALL FUNCTION 'COM_PRODUCT_UNIT_CONVERSION'  "
    EXPORTING
         IV_PRODUCT_GUID = lv_iv_product_guid
         IV_INPUT = lv_iv_input
         IV_UNIT = lv_iv_unit
         IV_BASE_UNIT = lv_iv_base_unit
         IV_FLAG_UNIT = lv_iv_flag_unit
         IV_USE_NET_WEIGHT = lv_iv_use_net_weight
         IV_CURRENT = lv_iv_current
         IV_TIMESTAMP = lv_iv_timestamp
         IV_PRWB = lv_iv_prwb
    IMPORTING
         EV_BASE_UNIT = lv_ev_base_unit
         EV_OUTPUT = lv_ev_output
         EV_NUMERATOR = lv_ev_numerator
         EV_DENOMINATOR = lv_ev_denominator
         EV_ADD_CONST = lv_ev_add_const
    EXCEPTIONS
        WRONG_CALL = 1
        NO_UNITS_FOUND = 2
        BASE_UNIT_NOT_FOUND = 3
        IV_UNIT_NOT_FOUND = 4
        CONVERSION_NOT_FOUND = 5
        OVERFLOW = 6
. " COM_PRODUCT_UNIT_CONVERSION




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

 
 
 
 
 
 
 
 
 
DATA(ld_iv_base_unit) = ' '.
 
 
 
 
DATA(ld_iv_flag_unit) = ' '.
 
 
 
DATA(ld_iv_use_net_weight) = ' '.
 
DATA(ld_iv_current) = 'X'.
 
 
DATA(ld_iv_prwb) = ' '.
 


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!