‎2008 May 27 1:24 PM
Hi,
i have an internal table with field plant and quantity.
i want total of quantity according to same plant.
eg.
plant quantity
p1 100
p1 200
total 300
p2 100
total 100
p3 200
p3 200
total 400
plz. help me.
‎2008 May 27 1:26 PM
Hi vishal,
You can use Collect statement in your case.
Loop at <internal table>
Collect <internal table>.
Endloop.
Then watchout for the contents of the internal table.
Reward points if this helps,
Kiran
‎2008 May 27 1:26 PM
‎2008 May 27 1:26 PM
Hi,
U can use control Break statements like AT END OF <field>. ENDAT. In this u can use SUM keyword.
or u can use COLLECT statememt.
Best regards,
raam
‎2008 May 27 1:27 PM
hi,
loop at itab.
at new plant.
***you can sum or collect your records in another table.
endat.
endloop.
hope this will help u out.
‎2008 May 27 1:28 PM
Hi
You can do the following way.
data: beign of itab occurs 0,
plant type char4,
qty type i,
end of itab.
Assume data is available at this internal table.
data: it_out like itab occurs 0.
loop at itab.
collect itab into it_out.
endloop.
You can get the sum based on yr plant.
Reward points if it is helpful.
Regards
Raja
‎2008 May 27 1:30 PM
Hi,
You can use at end and collect statement.
"Using collect.
loop at itab into wa.
collect wa into itab2.
endloop.
OR
"Using at end.
loop at itab.
at end of plant.
sum.
write : itab-pant, itab-quantity.
endat.
endloop.
Thanks,
Sriram Ponna.
‎2008 May 27 1:31 PM
Hi,
There are two ways.
1. You can use COLLECT key word.
LOOP AT ITAB.
COLLECT ITAB.
ENDLOOP.
2. You can use SUM keyword.
LOOP AT ITAB.
AT END OF COMPANY.
SUM.
ENDAT.
ENDLOOP.