2007 Mar 08 1:23 AM
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
2007 Mar 08 1:28 AM
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
2007 Mar 08 3:15 AM
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