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: 

Help with finding error in a report

Former Member
0 Kudos
155

I was trying to test the function module ''MD_CONVERT_MATERIAL_UNIT''. It is working perfectly when I test in se37 for a material number. However when I code in a report like below, it gives error message 'The material number so and so does n't have conversion with unit so and so'.

I have defined the work areas/variables as exaclty how it is defined in function module.

w_menee = 'LB'.

w1_menee = 'PAC'.

CALL FUNCTION 'MD_CONVERT_MATERIAL_UNIT'

EXPORTING

I_MATNR = w_matnr

I_IN_ME = w_menee

I_OUT_ME = w1_menee

I_MENGE = c_menge "constants: c_menge type ekpo-menge value '1.000'.

IMPORTING

E_MENGE = w_menge.

Can you please tell me where could be the problem?

Thank you

2 REPLIES 2

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
80

Make sure that you are passing the internal representation of the unit of measure, sometimes there is external formatting on these that totaly change the value. You can use the function module CONVERSION_EXIT_CUNIT_INPUT to convert it to the internal representation, then try passing this. When testing the FM, it might do the conversion on the fly, but not in the program.

Regards,

Rich Heilman

ferry_lianto
Active Contributor
0 Kudos
80

Hi Krishen,

Please try to convert material prior to call FM MD_CONVERT_MATERIAL_UNIT.


...

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    INPUT =  w_matnr
  IMPORTING
    OUTPUT = w_matnr.

w_menee = 'LB'.
w1_menee = 'PAC'.

CALL FUNCTION 'MD_CONVERT_MATERIAL_UNIT'
  EXPORTING
    I_MATNR = w_matnr
    I_IN_ME = w_menee
    I_OUT_ME = w1_menee
    I_MENGE = c_menge       "constants: c_menge type ekpo-menge value '1.000'.
  IMPORTING
    E_MENGE = w_menge.

...

Regards,

Ferry Lianto