‎2007 Apr 23 6:11 AM
Hi All,
I am developing a report to display the weight of delivery items in KG.
I have Gross Weight and Net Weight, which may or may not be in KG in the table.
But I need to display the output in terms of KG.
Please help me on how to go with it.
There is a function module MATERIAL_UNIT_CONVERSION but I dont know what exact parameters to pass.
Please help me with an example.
Thanks.
‎2007 Apr 23 6:14 AM
Hi,
Use the fun module
UNIT_CONVERSION_SIMPLE or
MD_CONVERT_MATERIAL_UNIT
see the sample code:
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
INPUT = p_act_in
UNIT_IN = p_uom_in
UNIT_OUT = w_unit_out
IMPORTING
OUTPUT = w_act_out
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.
reward points if useful
regards,
Anji
‎2007 Apr 23 6:15 AM
Please try this FM.
MD_CONVERT_MATERIAL_UNIT
MATERIAL_UNIT_CONVERSION
MC_UNIT_CONVERSION
UNIT_CONVERSION_SIMPLE
using MATERIAL_UNIT_CONVERSION is as shown
report zrich_0002.
data: input type p decimals 3 value '10.000'.
data: begin of xtmp,
menge type mseg-menge,
meins type mseg-meins,
end of xtmp.
data: imara like mara.
Get base UOM
select single * from mara into imara
where matnr = '000000000040006541'.
The uoms must be of the internal format, check against T006a
do conversion
call function 'MATERIAL_UNIT_CONVERSION'
exporting
input = input
matnr = imara-matnr
meins = 'GLL' " Must be internal
meinh = 'OZA' " Must be internal
importing
meins = xtmp-meins
output = xtmp-menge
exceptions
conversion_not_found = 01
input_invalid = 02
material_not_found = 03
meinh_not_found = 04
meins_missing = 05
no_meinh = 06
output_invalid = 07
overflow = 08.
check sy-subrc = 0.
regards
navjot
‎2007 Apr 23 6:15 AM
Anitha,
First of all, check whether that weight is stored in Grs or in KGs, if it is in KG, u can proceed, if it is in Grs, convert it into Kg and procced with further calculations.
I think this hint vl help u.
Regards,
Sujatha.
‎2007 Apr 23 6:17 AM
Hi
Yes .MATERIAL_UNIT_CONVERSION can convert the Matrial Unit into desired conversions.
To know how to use this properly or what's the parameters have to pass
try to see the Where Used List of the Function Module.
You can know in better way.
Regards,
Sreeram