Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

UNIT_CONVERSION_SIMPLE

Former Member
0 Likes
6,200

I am using UNIT_CONVERSION_SIMPLE to convert my quantity from DRS to KG or DRS to Gallons and it always gives out an error Units of different dimensions cannot be converted. I debugged it and found that its because the Dimension Keys DIMID do not match for the unit in and out. I looked up MARM and there is a conversion for DRS to KG. How to use this FM

* Convert ATP value to Sales Unit entered
  CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
    EXPORTING
      input                = wa_wmdvex-com_qty
      unit_in              = gv_meins
      unit_out             = gv_vrkme
    IMPORTING
      output               = wa_wmdvex-com_qty
    EXCEPTIONS
      conversion_not_found = 1
      division_by_zero     = 2
      input_invalid        = 3
      output_invalid       = 4
      overflow             = 5
      type_invalid         = 6
      units_missing        = 7
      unit_in_not_found    = 8
      unit_out_not_found   = 9
      OTHERS               = 10.

  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

1 ACCEPTED SOLUTION
Read only

former_member194669
Active Contributor
0 Likes
3,674

Hi,

Try to use fm MATERIAL_UNIT_CONVERSION

aRs

3 REPLIES 3
Read only

ferry_lianto
Active Contributor
0 Likes
3,674

Hi,

Please check this link for sample code perhaps it may help.

http://sap.niraj.tripod.com/id64.html

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
3,674

HI,

check if the uom DRS ,KG, GALLON exist in the table t006 and get the exact key .

and then use the function module accordinlgy.

Thansk

Mahesh

Read only

former_member194669
Active Contributor
0 Likes
3,675

Hi,

Try to use fm MATERIAL_UNIT_CONVERSION

aRs