‎2008 May 26 9:36 AM
HI,
Please help for the following:
when there are multiple location codes(lgort) for a particular material no.(matnr) then goto table MCHB fetch staorage location where mchb-matnr = resb-matnr and mchb-werks=resb-matnr.then check the first character of the field CHARG of table mchb if it is NE '3' then fetch storage location (lgort) and sum up stock quantity(CLABS) for each location code.
when there is only one storage loc'n then goto Mard table and fetch lgort where mard-matnr = resb-matnr and mard-werks=resb-werks.
Thanks.
‎2008 May 26 9:55 AM
‎2008 May 27 5:11 AM
hi,
My doubt is how to check if there are multiple entries for a particular material no. i am not getting how to write this logic.
‎2008 May 27 5:29 AM
pick all the storage loc for all the materials (for ur selelction) in one shot then SORT and loop the int. table
have a variable COUNT and use the AT END MATNR to proceed further
‎2008 May 27 5:46 AM
Hai Ramya,
1st step - select the all stroage location(LGORT) from MARD for ur input MATNR and WERKS to internal table itab_mard .
2nd step - select the batch number-CHARG and quantity from MCHB using for all entries in ITAB_MARD-MATNR and ITAB_MARD-WERKS and ITAB_MARD-LGORT into itab_mchb.
delete ITAB_MCHB where CHARG+0(1) <> '3'.
data :begin of itab3 occurs 0,
matnr type matnr,
werks type werks,
lgort type lgort_g,
qty type menge_d,
end of itab3.
loop at itab_mard.
loop at itab_mchb where matnr = itab_mard-matnr and
werks = itab_mard-werks and
lgort = itab_mard-lgort.
lv_qty = lv_qty + itab_mchb-qty.
endloop.
itab3-matnr = itab_mard-matnr.
itab3-werks = itab_mard-werks.
itab3-lgort = itab_mard-lgort_g.
itab3-qty = lv_qty.
append itab3.
clear lv_qty.
endloop.
ITAB3 having stroage location wise quantity.
Thanks & Regards,
Durai.V