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

Material Quantity Conversion

Former Member
0 Likes
10,870

Hi Folks,

My requirement is i need to defacult the unit of measure to 'PCE' in my selection screen.

Here my requirement is if the materials base unit of measure is in 'PCE'S and in the selection screen if they passed other unit of measurements like 'KG' 'LB' then i need to convert the quantity of that material form PCE' to KG'S or LB'S.

Please guide me how to achieve this requirement.

Thanks,

Vinay.

14 REPLIES 14
Read only

Former Member
0 Likes
5,208

Use FM MATERIAL_CONVERT_QUANTITY

Read only

0 Likes
5,208

hi thankyou for your reply can you please expalin me abt the parameters of this function module.

Read only

0 Likes
5,208
CALL FUNCTION 'MATERIAL_CONVERT_QUANTITY'
  EXPORTING
    PI_MATERIAL_SRC          = P_MATNR   "MATERIAL NUMBER
    PI_MEINH_SRC             = P_MEINH1  "SOURCE UOM
*   PI_MEINS_SRC             =
    PI_QUANTITY_SRC          = P_QUAN1    "QUANTITY
    PI_MATERIAL_DST          = P_MEINH2  "TARET UOM
*   PI_MEINH_DST             =
*   PI_MEINS_DST             =
 IMPORTING
    PE_QUANTITY_DST          = P_QUAN2   "CONVERTED QUANTITY
*   PE_MEINH_DST             =
*   PE_MEINS_DST             =
 EXCEPTIONS
   WRONG_CALL               = 1
   MATERIAL_NOT_FOUND       = 2
   NO_CONVERSION            = 3
   OTHERS                   = 4
Read only

0 Likes
5,208

HI i runned the function module manually by your inputs but no luck .

Read only

0 Likes
5,208

SORY TRY THIS

CALL FUNCTION 'MATERIAL_CONVERT_QUANTITY'
  EXPORTING
    PI_MATERIAL_SRC          = P_MATNR   "MATERIAL NUMBER
    PI_MEINH_SRC             = P_MEINH1  "SOURCE UOM
*   PI_MEINS_SRC             =
    PI_QUANTITY_SRC          = P_QUAN1    "QUANTITY
    PI_MATERIAL_DST          =  P_MATNR   "MATERIAL NUMBER
    PI_MEINH_DST             = P_MEINH2  "TARET UOM
*   PI_MEINS_DST             =
 IMPORTING
    PE_QUANTITY_DST          = P_QUAN2   "CONVERTED QUANTITY
*   PE_MEINH_DST             =
*   PE_MEINS_DST             =
 EXCEPTIONS
   WRONG_CALL               = 1
   MATERIAL_NOT_FOUND       = 2
   NO_CONVERSION            = 3
   OTHERS                   = 4

Edited by: GTREN on Jun 3, 2009 1:46 PM

Read only

5,208

It is giving an error message as use a number field,

Read only

Former Member
5,208

Hi,

Use FM MD_CONVERT_MATERIAL_UNIT.

  call function 'MD_CONVERT_MATERIAL_UNIT'
       exporting
            i_matnr  = i_matnr
            i_in_me  = i_meinh_in
            i_out_me = i_meinh_out
            i_menge  = ld_menge_in
       importing
            e_menge  = ld_menge_out
       exceptions
            others   = 4.
  e_subrc = sy-subrc.
  if e_subrc is initial.
********
  endif.

Regards,

Raju.

Read only

0 Likes
5,208

Just what I was looking for. Simple is best!

Thanks,

Tim

Read only

Former Member
0 Likes
5,208

Hi Vinay,

Please try using the below FM for your issue.

CF_UT_UNIT_CONVERSION

Regards,

jana

Read only

SujeetMishra
Active Contributor
0 Likes
5,208

Hello Vinay,

Please Use below FM:

MATERIAL_CONVERT_QUANTITY

CIF_GEN_CONVERT_QUANTITY_ISO

Have a Nice Day,

Regards,

Sujeet

Read only

Former Member
0 Likes
5,208

You need to take care while using the FM 'MD_CONVERT_MATERIAL_UNIT' because, if the quantity conversion factor is not maintained for a particular material that quantity then the FM give the error message.

You can check via T-Code MM03 whether the quantity conversion factor is maintained for that material or not.

use the below code for the quantity conversion

CALL FUNCTION 'MD_CONVERT_MATERIAL_UNIT'

EXPORTING

i_matnr = material number

i_in_me = from quantity

i_out_me = to quantity

i_menge = input quantity

IMPORTING

e_menge = output quantity

EXCEPTIONS

error_in_application = 1

error = 2

OTHERS = 3.

IF sy-subrc NE 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

Read only

0 Likes
5,208

hI sheelesh,thankyou for your reply.

Do you have any idea that how we will calculate the sales of the material by using movement types.

Read only

Former Member
0 Likes
5,208

Hi,

You may use the FM "UNIT_CONVERSION_SIMPLE".

CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'

EXPORTING

INPUT = < Total units>

UNIT_IN = <The unit of measurement selected by the user>

UNIT_OUT = <PCE>

IMPORTING

OUTPUT = <Here you will get the converted total units>

  • EXCEPTIONS

  • CONVERSION_NOT_FOUND = 1

  • DIVISION_BY_ZERO = 2

  • INPUT_INVALID = 3

  • OUTPUT_INVALID = 4

  • OVERFLOW = 5

  • TYPE_INVALID = 6

  • UNITS_MISSING = 7

  • UNIT_IN_NOT_FOUND = 8

  • UNIT_OUT_NOT_FOUND = 9

  • OTHERS = 10

Hope this will help you.

Regards,

Smart Varghese

Read only

Former Member
0 Likes
5,208

Try this FM u will get the desired result.....

CF_UT_UNIT_CONVERSION