08-20-2007 9:47 AM
Hi Friends,
This is Small and pecular but still iam not getting..
In mseg table Plant (werks) qunatity (menge) and movement type(bwart) and materail(matnr) and material document (MBlnr) is thesre..
I want calculete the qunatity of each plant by the movement type..
here is the problem is... I want calculte quntities by plant..
AT end of ,..
sum.
end at
and collect is its not working..
iwant calulcte the quantity and pass another internal table for for loop and display in differnt rows..
but the calculation is not comming proper..
if wewant all at atimens
we can calulate in loop.
but here plant wise calculation is giving me the problem..
please help me..
iam doing for 6 movemnt type and getting 6 quantity amonts for particaular pant..
please suggetst me..
reagrds,
sam
08-20-2007 9:53 AM
Hi Sampath,
Try this below given logic,.
Declare a temporary internal table. Move all data from you main itab to the temporary itab.
Now,
LOOP AT MAINITAB.
AT END OF plant.
LOOP AT TEMPITAB WHERE PLANT = plant.
AT END OF Mvmttype.
SUM up the quantity here.
ENDAT.
ENDLOOP.
ENDAT.
ENDLOOP.
<b>Reward points for informatory answers.</b>
Best Regards,
Ram.
08-20-2007 10:04 AM
Hi..
You can to use this code:
DATA : BEGIN OF ITAB OCCURS 10,
WERKS TYPE MSEG-WERKS,
BWART TYPE MSEG-BWART,
MBLNR TYPE MSEG-MBLNR,
MENGE TYPE MSGE-MENGE,
END OF ITAB.
DATA : BEGIN OF ITAB1 OCCURS 10,
WERKS TYPE MSEG-WERKS,
BWART TYPE MSEG-BWART,
MENGE TYPE MSGE-MENGE,
END OF ITAB1.
SELECT WERKS BWART MATNR MENGE
FROM MSEG INTO TABLE ITAB.
LOOP AT ITAB.
COLLECT ITAB INTO ITAB1.
ENDLOOP.
<b>Reward if Helpful</b>