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: 

Convert Unit of measure

former_member156446
Active Contributor
0 Kudos

hai guyz

I have req to change the unit of measure from base unit of measure to stock unit of measure. I have Matnr, werks, and unit of measure.

I need to convert the value (labst) and Unit of measure to stock unit of measure.

I tried writing some code in selecting data from marm there I am getting the unit but not the final value.

I tired using *CALL FUNCTION 'MATERIAL_UNIT_CONVERSION'

  • EXPORTING

  • INPUT = lt_buff-labst

  • matnr = lt_buff-matnr

  • meinh = lt_buff-meins

  • MEINS = lv_ea <b>( what to give here? to get stock unit of measure?)</b>

  • CHARGE = lt_buff-charg

  • WERKS = lt_buff-werks

  • IMPORTING

  • MEINS = lt_buff-meins

  • OUTPUT = lt_buff-labst.

5 REPLIES 5

naimesh_patel
Active Contributor

Use this FM:

  CALL FUNCTION 'MD_CONVERT_MATERIAL_UNIT'
    EXPORTING
      I_MATNR                    = l_MATNR
      I_IN_ME                    = l_MEINS   "<<  UOM - in which you have quantity
      I_OUT_ME                   = LF_MEINS " << UOM in which you want the quantity
      I_MENGE                    = LF_E_MENGE  "<< quantity
    IMPORTING
      E_MENGE                    = LF_I_MENGE  " << converted Qty
*   EXCEPTIONS
*     ERROR_IN_APPLICATION       = 1
*     ERROR                      = 2
*     OTHERS                     = 3

Regards,

Naimesh Patel

0 Kudos

why is that only some materials are getting converted and some are not ?

0 Kudos

They should have the conversion factors maintained in the material master for that material.

Regards,

Naimesh Patel

mahaboob_pathan
Contributor
0 Kudos

Hi,

check this fm --> CF_UT_UNIT_CONVERSION

For materials ->

MATERIAL_CONVERT_QUANTITY or MATERIAL_UNIT_CONVERSION.

UNIT_CONVERSION_SIMPLE convert weights from one UOM to another.

or

There exits the conversion routine for that particular field in its domain level..

copy that conversion routine and search for that in SE37 your conversion routine

you will find the function module this gives you the internal and external formats

Fms are listed below for MEINS

CONVERSION_EXIT_CUNIT_INPUT Conversion exit for commercial (3-char) measurement unit INPUT

CONVERSION_EXIT_CUNIT_OUTPUT Conversion exit for commercial (3-char) measurement unit OUTPUT

For convertiung quantity into base unit of measure you can do this way

CALL FUNCTION 'ME_CONVERSION_MEINS' "#EC *

EXPORTING

i_matnr = "give material number"

i_mein1 = "Unit of measurement "

i_meins = "base unit of measure

i_menge = "quantity

IMPORTING

menge = "quantioty in your required measurement

EXCEPTIONS

error_in_conversion = 1

no_success = 2

OTHERS = 3.

HOpe this helps you

Reward if useful

Message was edited by:

Mahaboob Pathan

former_member156446
Active Contributor
0 Kudos

thank you guyz