2008 Jun 09 10:08 PM
Hi Everybody,
I need a FM to convert Lenght form one Unit of Measure to another.
Can someone help me with that please?
Thanks,
Sneha Singh.
2008 Jun 09 10:40 PM
Hi check this sample code
CALL FUNCTION 'MATERIAL_UNIT_CONVERSION'
EXPORTING
input = list-kulab
matnr = list-matnr
meinh = l_lvsme
meins = list-meins
charge = list-charg
werks = list-werks
IMPORTING
output = list-kulab
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.
2008 Jun 09 10:34 PM
You may try with FM:OIU_QCI_CONVERT_UOM
there are many functional modules based on requirements, can you bit little clear what is ur requirement.
//Kiran
2008 Jun 09 10:40 PM
Hi check this sample code
CALL FUNCTION 'MATERIAL_UNIT_CONVERSION'
EXPORTING
input = list-kulab
matnr = list-matnr
meinh = l_lvsme
meins = list-meins
charge = list-charg
werks = list-werks
IMPORTING
output = list-kulab
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.
2008 Jun 09 10:42 PM
2008 Jun 09 10:57 PM
2008 Jun 09 11:01 PM
if this is regarding the unit of a material attached to a sales order, you can also do the following.
PERFORM convert-unit-cost CHANGING lv_kwmeng
form convert-unit-cost changing p_kwmeng.
DATA l_convert TYPE p LENGTH 03. CLEAR l_convert.
l_convert = vbap-umvkz / vbap-umvkn.
p_kwmeng = p_kwmeng * l_convert.
endform.
Where p_kwmeng is what you wanna convert.
In this particular example
vbap-meins = M and vbap-vrkme = ROL
lv_kwmeng = 1ROL
1 ROL = 4M.
vbap-umvkz = 4. vbap-umvkn = 1.
conversion factor = 4/1 = 4.
p_kwmeng = 1 * 4 = 4M.
Hope it helps.
Regards
Sameer