Sunday, March 22, 2015

SAP APO unit conversion


1. To get the Base Unit of Measure, use the FM:

  CALL FUNCTION '/SAPAPO/DM_MATID_GET_MATERIAL'
       EXPORTING
            iv_matid           = iv_matid
       IMPORTING
            ev_meins           = lv_meins --> Here you will get base unit of measure
       EXCEPTIONS
            material_not_found = 1
            OTHERS             = 2. 

2. Now, use the following FM to get the factor between base unit of measure and the alternative unit of measure.

CALL FUNCTION '/SAPAPO/DM_UNIT_CONVERSION'
       EXPORTING
            i_matid            = iv_matid
            i_meins_from       = iv_basme
            i_meins_to         = lv_meins
       IMPORTING
            e_umref            = lv_factor
       EXCEPTIONS
            material_not_found = 1
            conversion_error   = 2
            OTHERS             = 3.
3. Multiply the quantity with the factor, to get the converted quantity in alternate unit of measure.