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: 

regarding conversion of stock qty in kg to stock qty in liters

Former Member
0 Kudos
257

Hi all,

can any one help me how to covert the stock in qty to sctock in ltrs.

i have used to following code for that but it was showing zero values. can any one help me in this issue.

IF i_final-meins NE 'KG'.

i_bestand_bal_kg = 'KG'.

CALL FUNCTION 'MD_CONVERT_MATERIAL_UNIT'

EXPORTING

i_matnr = i_mara-matnr

i_in_me = i_final-meins

i_out_me = i_bestand_bal_kg

i_menge = i_final-menge3

IMPORTING

e_menge = i_final-menge4

EXCEPTIONS

error_in_application = 1

error = 2

OTHERS = 3.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ELSE.

i_final-menge4 = i_final-menge3.

ENDIF.

i_bestand_bal_lt = 'L'.

CALL FUNCTION 'MD_CONVERT_MATERIAL_UNIT'

EXPORTING

i_matnr = i_mara-matnr

i_in_me = i_final-meins

i_out_me = i_bestand_bal_lt

i_menge = i_final-menge3

IMPORTING

e_menge = i_final-menge5

EXCEPTIONS

error_in_application = 1

error = 2

OTHERS = 3.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Thanks in advance,

ramana prasad

3 REPLIES 3

raymond_giuseppi
Active Contributor
0 Kudos
130

Liters and kilograms do not belong to the same dimension, so are your material conversion units defined?

If the conversion between KG and L doesnt exist for each of your material, no conversion can be executed (so giving Zero)

Regards

0 Kudos
130

See Entering Alternative Units of Measure in <a href="http://help.sap.com/printdocu/core/Print46c/en/data/pdf/LOMDMM/LOMDMM.pdf">Material Master (LO-MD-MM)</a>

Regards

Former Member
0 Kudos
130

Hi Rama,

The base unit of a material is maintained in MARA-MEINS, the alternative units for that material will be maintained in MARM-MEINH.

Please see whether alternative unit "KG " is maintained in MARM table for that material.If its maintained then only the function module will give correct values.

Regards

Avi...