Skip to Content
0
Former Member
Jan 14, 2008 at 04:11 AM

report alv

48 Views

Hi experts please help me to write the logic to the below requirement

1) Identify header materials with Material Type & Plant, Material Group , Material Number

a) Go to MARA table get the material list for material type, material group, material number equal to selection screen input .

b) go to MARC table with material list (from step a) and plant from selection screen, get the filtered list, remove the materials not satisfying selection criteria

c) get the final list of materials & bom number (STLNR) & WERKS for which BOM exists in given plant by giving list from step b, plant(WERKS ) ,usage (STLAN = 1) ,Alternative bom (STLAL =01” ) from the table MAST and

removing the materials not satisfying selection criteria

d) check BOMs from the above list are valid in STKO with the inputs STLNR , DATUV ( valid date from ) <= SY-DATUM, LOEKZ(Deletion flag) NE “X” , STLST(status) =1 (Active) and save in internal table.

remove the materials not satisfying selection criteria

2) For each material from the list in 1.d retrieve all components in the material BOM.

Using Function Module “CS_BOM_EXPL_MAT_V2”

Inputs for the function module

CAPID = ‘Z1PP’

DATUV = SY-DATUM

DELNL = X (To delete non-stockable items)

EMENG = “1”

MTNRV = material number from 1.d

MEHRS= ‘X”

RNDKZ =’1 ‘

STLAL = ‘1’

STLAN = ‘1’

WERKS = Plant from list 1.d

BREMS = ‘X’

Required information components get collected in STB table

From STB table in Function module

Get IDNRK ( component ) , OJTXP ( Component description ) , MTAR ( material type ) , MNGKO (COMP- QTY ) ,MEINS ( UNIT) DATUV ( valid from date ) , DATUB ( Valid to date )

Header material details are collected in table TOPMAT

MATNR (material number ), MAKTX ( description ) , WERK( plant ) , BMENG ( base qty) ,BME ( unit) EMENG ( required qty ) , EMG ( req qty unit )

Collect the info from FM into internal table

3)delete all material components for which MTAR is NOT EQUAL to ‘PACK’ or ‘VERPAK’ from the above internal table step 2

3) Goto CABN table get the value of ATTIN for ATNAM = “packaging type”

Goto AUSP table, get the value of ATWRT for OBJEK = IDNRK and ATINN = ATTIN from the above step and save it in internal table against each row in step 2

4) Calculate the component quantity in kg using the units of measure conversion in the material master.

For each row of internal table coming from 2 step

Use Function module MD_CONVERT_MATERIAL_UNIT & convert component Quantities into Kg

I_MATNR = IDNRK ( From the internal table step 2 .)

I_IN_ME = MEINS (( From the internal table step 2 )

I_OUT_ME = “KG” (always)

I_MENGE = MNGKO (From the internal table step 2 .)

Get E_MENGE and update in the internal table (2) against each component

Also pass this value against FACTOR

Note: Since EMENG = “1” in step 2 while exploding bom the quantity E_MENGE will be equal to factor . no need to divide the quantity with base quantity

with regards

serma