Skip to Content
0
Former Member
Aug 30, 2007 at 03:25 PM

UNIT_CONVERSION_SIMPLE

2038 Views

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.