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

Help with function module for unit conversion

Former Member
0 Likes
627

Hi experts,

Can you please give a sample code for the function module:

MATERIAL_UNIT_CONVERSION (function module documentation ddidnt help me!)

I want to convert material from one unit to others. For ex: from case to packs.

Please give your input.

Thank you.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
509

Hi,

you can also use the FM MD_CONVERT_MATERIAL_UNIT.

Check this example..

PARAMETERS: P_MATNR TYPE MATNR OBLIGATORY.

PARAMETERS: P_IN_ME TYPE MEINS OBLIGATORY.

PARAMETERS: P_OP_ME TYPE MEINS OBLIGATORY.

DATA: V_MENGE TYPE EKPO-MENGE.

CALL FUNCTION 'MD_CONVERT_MATERIAL_UNIT'

EXPORTING

i_matnr = P_MATNR

i_in_me = P_IN_ME

i_out_me = P_OP_ME

i_menge = '1.000'

IMPORTING

E_MENGE = V_MENGE

EXCEPTIONS

ERROR_IN_APPLICATION = 1

ERROR = 2

OTHERS = 3

.

IF sy-subrc <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ELSE.

WRITE: / V_MENGE.

ENDIF.

Thanks,

Naren

2 REPLIES 2
Read only

Former Member
0 Likes
510

Hi,

you can also use the FM MD_CONVERT_MATERIAL_UNIT.

Check this example..

PARAMETERS: P_MATNR TYPE MATNR OBLIGATORY.

PARAMETERS: P_IN_ME TYPE MEINS OBLIGATORY.

PARAMETERS: P_OP_ME TYPE MEINS OBLIGATORY.

DATA: V_MENGE TYPE EKPO-MENGE.

CALL FUNCTION 'MD_CONVERT_MATERIAL_UNIT'

EXPORTING

i_matnr = P_MATNR

i_in_me = P_IN_ME

i_out_me = P_OP_ME

i_menge = '1.000'

IMPORTING

E_MENGE = V_MENGE

EXCEPTIONS

ERROR_IN_APPLICATION = 1

ERROR = 2

OTHERS = 3

.

IF sy-subrc <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ELSE.

WRITE: / V_MENGE.

ENDIF.

Thanks,

Naren

Read only

ferry_lianto
Active Contributor
0 Likes
509

Hi Krishen,

Please check this sample program perhaps it may help.

http://groupc.tripparty.com/html/intania/uploadprogram/1ss.txt

Regards,

Ferry Lianto