2011 Feb 17 11:19 PM
Hi All,
I have a dynamic internal Table and i want to calculate the sum of QTY if MAT is same
Say ITAB is my dynamic internal table With below entries
MAT QTY
A 1
A 2
A 3
B 4
B 5
C 6I want my dynamic internal table to look like
A 6
B 9
C 61) I tried below code
LOOP AT <itab> INTO <WA>.
assign <WA> TO <WA_TEMP>.
assign component 'MAT' of structure <wa> to <fs>.
at end of <fs>.
SUM. *" SUM Not allowed with in loop assigning*
ENDAT.
ENDLOOP.Would appreciate if anyone can comment on the issue
Thanks in advance
Hi All,
I have a dynamic internal Table and i want to calculate the sum of QTY if MAT is same
Say ITAB is my dynamic internal table With below entries
MAT QTY
A 1
A 2
A 3
B 4
B 5
C 6I want my dynamic internal table to look like
A 6
B 9
C 61) I tried below code
LOOP AT <itab> INTO <WA>.
assign <WA> TO <WA_TEMP>.
assign component 'MAT' of structure <wa> to <fs>.
at end of <fs>.
SUM. *" SUM Not allowed with in loop assigning*
ENDAT.
ENDLOOP.Would appreciate if anyone can comment on the issue
Thanks in advance
2011 Feb 17 11:48 PM
Hello David,
I would try to use COLLECT within the loop of itab instead of SUM.
Cheers,
Sougata.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |