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: 

Conversion of unit of measure function module.

Former Member
0 Kudos
34,568

Hi All,

Can you let me know the function module that convert the unit of measure from EACH(EA)to cases(CS). I have the material that unit of measure is in EACH(EA). And i have to dispaly in cases(CS).

Regards,

Rakesh Singh

5 REPLIES 5

Former Member
0 Kudos
4,598

Use either

MATERIAL_CONVERT_QUANTITY or MATERIAL_UNIT_CONVERSION.

Srinivas

Former Member
0 Kudos
4,598

Rakesh,

Remember that the Material must be maintained in both the Units of measure before you can convert them unless they belong to the same dimension (eg. KG to G, i.e. kilograms to Grams or MM to CM Millimeters to Centimeters). Judging from your case EA to CS which are dimentionless UoM's you will need all materials involved to be maintained for both EA's and CS's.

Just thought I should add my 2 cents.

Rishi

0 Kudos
4,598

Hi Rakesh,

I'll throw in my two cents worth as well.

Watch for rounding errors with this function (go with MATERIAL_CONVERT_QUANTITY, MATERIAL_UNIT_CONVERSION means that you have to do conversions to base units which can be more work for you).

For details, check my post at:

Cheers,

Brad

Message was edited by: Brad Williams

0 Kudos
4,598

Hi,

Try this.

UNIT_CONVERSION_SIMPLE convert weights from one UOM to another.

Former Member
0 Kudos
4,598

Hi Rakesh,

Try this Function Module:

MD_CONVERT_MATERIAL_UNIT

Im sending you a sample code also.

*& Form f2121_convert_price

*&----


  • Convert price to Base UoM

*----


  • -->P_LV_MEINS Conversion UoM

  • -->P_LV_KBETR Converted Rate

  • -->P_LV_KMEIN Condition unit

  • -->P_LV_MATNR Material Number

  • -->P_LV_KSCHL Condition Type

----


FORM f2121_convert_price USING p_lv_meins

p_lv_kbetr

p_lv_kmein

p_lv_matnr

p_lv_kschl.

DATA: lv_imenge LIKE ekpo-menge,

lv_emenge LIKE ekpo-menge.

lv_imenge = p_lv_kbetr.

CALL FUNCTION 'MD_CONVERT_MATERIAL_UNIT'

EXPORTING

i_matnr = p_lv_matnr

i_in_me = p_lv_kmein

i_out_me = p_lv_meins

i_menge = lv_imenge

IMPORTING

e_menge = lv_emenge

EXCEPTIONS

error_in_application = 1

error = 2

OTHERS = 3.

IF sy-subrc = 0.

p_lv_kbetr = lv_emenge.

ELSE.

CONCATENATE text-009 p_lv_kschl INTO v_err_msg.

ENDIF.

ENDFORM. " f2121_convert_price

Hope this helps you.

Regards,

Anjali.