物料单位转换
1。 将指定单位转化为基本单位(KZMEINH = 'X'),或由基本单位转化为指定单位(KZMEINH = ' ')
CALL FUNCTION 'MATERIAL_UNIT_CONVERSION'
EXPORTING
* INPUT = 0
KZMEINH = ' '
matnr = '物料号'
meinh = '单位'
* MEINS = ' '
* EXTENDED_CONV = ' '
* TYPE_UMR = ' '
* NO_OUTPUT = ' '
* CHARGE =
* CHARG_CUOBJ =
* WERKS =
* IMPORTING
* ADDKO =
* MEINS =
* OUTPUT =
* UMREN =
* UMREZ =
* BATCH_CONVERSION_ERROR =
* KZWSO =
* EXCEPTIONS
* CONVERSION_NOT_FOUND = 1
* INPUT_INVALID = 2
* MATERIAL_NOT_FOUND = 3
* MEINH_NOT_FOUND = 4
* MEINS_MISSING = 5
* NO_MEINH = 6
* OUTPUT_INVALID = 7
* OVERFLOW = 8
* OTHERS = 9
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
2。把指定单位转换为另外一个指定单位
CALL FUNCTION 'MD_CONVERT_MATERIAL_UNIT'
EXPORTING
i_matnr = '物料号'
i_in_me = '输入单位'
i_out_me = '输出单位'
i_menge = '数量'
IMPORTING
E_MENGE = '输出数量'
EXCEPTIONS
ERROR_IN_APPLICATION = 1
ERROR = 2
OTHERS = 3
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.