cheking the material for base unit or convert it to base unit.
I have a requirement asa follows.
I Have an internal table ITAB1 in that i have some 200 records. In that ITAB1 i have
MATNR and MEINS field and iam selecting those fields from MSEG table.
Now my requirment is i have to check for base unit of that particular.
now let us say iam getting in my ITAB1.
now i have to check the base material for that material. if both the base unit and what i got i same then its ok. or if the both are not same then it should convert to the base unit.
how can i do that.
To this FM u have to pass the material number, Input unit(itab1-meins), Output unit(Base unit-mara-meins), Quantity. In Importing parameter E_MENGE pass one variable. After FM call u will receive the converted value in this variable.
Just check the where used list of the FM to see the sample code.
CALL FUNCTION 'MD_CONVERT_MATERIAL_UNIT' EXPORTING I_MATNR = P_MATNR I_IN_ME = P_MEEHT "Input unit I_OUT_ME = P_AUSME "Base unit I_MENGE = P_MENGE "Input Quantity IMPORTING E_MENGE = I_AUMENGE "Quantity in base unit. EXCEPTIONS ERROR_IN_APPLICATION = 1 OTHERS = 2.