物料单位转换
单位转换关系查询
MM03->附加数据->计量单位
单位转换关系取数
表:MARM
字段:MEINH,UMREZ,UMREN
SELECT
MATNR,
MEINH,
UMREZ,
UMREN
FROM MARM
INTO TABLE @DATA(LT_MARM)
FOR ALL ENTRIES IN @LT_MARA
WHERE MATNR = @LT_MARA-MATNR
AND MARM~UMREZ <> MARM~UMREN.
SORT LT_MARM BY MATNR.
“物料单位转换率
GS_MARA-KLJSL = LS_MARM-UMREN / LS_MARM-UMREZ.
单位转换函数
MD_CONVERT_MATERIAL_UNIT
CALL FUNCTION 'MD_CONVERT_MATERIAL_UNIT'
EXPORTING
I_MATNR = LS_IN-MATNR
I_IN_ME = LS_IN-VRKME
I_OUT_ME = LS_OUT-MEINS
I_MENGE = LS_IN-MENGE
IMPORTING
E_MENGE = LS_out-MENGE
EXCEPTIONS
ERROR_IN_APPLICATION = 1
ERROR = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
CONCATENATE '没有物料' lv_matnr '的转换因子和计量单位' into ls_out-message.