Application Development and Automation 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: 
Read only

UoM conversion for decimal quantities

Bharath84
Participant
0 Likes
980

Hi All,

For sales doc having UoM other than EA(each) it should be converted to EA.

For sales doc 900807278 the Quantity(FKIMG) has value 0.120 and Sales UoM(VRKME) as SP.

call function 'MD_CONVERT_MATERIAL_UNIT'

   exporting

        i_matnr              = it_vbrk-matnr

        i_in_me              = it_vbrk-vrkme

        i_out_me             = 'EA'

        i_menge              = it_vbrk-fkimg      "Quantity

  importing

       e_menge              = it_vbrk-fkimg1      "Converted Qty

   exceptions

        error_in_application = 1

        meinh_not_found      = 2

        others               = 3.

After this FM, the quantity is not converting. Is this due to the quantity in decimals.

How to convert to EA and the quantity(FKIMG). Please give me the solution.

Thanks,

Haritha

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
877

Hi,

I few things:

it_vbrk is suppost to be the header table, so you dont matnr and others fields..check your code.

Second,

you can use write, sth like this

write it_vbrk-fkimg to l_quantity unit it_vbrk-vrkme.

Regards

Miguel

5 REPLIES 5
Read only

Former Member
0 Likes
877

You Ask:

"Is this due to the quantity in decimals."

I would have to say no.  Is the FM perhaps returning sy-subrc = 2?

Neal

Read only

0 Likes
877

Hi Neal,

Yes, it is returning sy-subrc = 2.

Regards,

Haritha

Read only

0 Likes
877

So do you understand that this is the whole answer to your problem?  If EA is not in MARM, then your can't convert to it...

Neal

Read only

Former Member
0 Likes
877

Hi Haritha,

I have not used the MD_CONVERT_MATERIAL_UNIT, but I have used UNIT_CONVERSION_SIMPLE and I have not had any issues.

Give it a try.

Regards,

Steve

Read only

Former Member
0 Likes
878

Hi,

I few things:

it_vbrk is suppost to be the header table, so you dont matnr and others fields..check your code.

Second,

you can use write, sth like this

write it_vbrk-fkimg to l_quantity unit it_vbrk-vrkme.

Regards

Miguel