Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

UOM of Conversion

Former Member
0 Kudos
530

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.

1 ACCEPTED SOLUTION

former_member156446
Active Contributor
0 Kudos
169

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.

5 REPLIES 5

Former Member
0 Kudos
169

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

former_member156446
Active Contributor
0 Kudos
170

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.

Former Member
0 Kudos
169

you can use this fm also

CH_CONVERT_UNITS

0 Kudos
169

Hi,

You can try with UNIT_CONVERSION_SIMPLE

Ranjith.

former_member184551
Contributor
0 Kudos
169

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