08-09-2006 8:59 AM
Hi All!
Can anybody give me the alternative code to collect statement.I mean i want the same functionality as that of collect statement which I want to apply to two numeric columns.Presently using collect I am unable to get the sum of the second column.
Regards
Praneeth
08-09-2006 9:04 AM
Hi,
Use
loop at itab into wa_tab1.
LOOP AT ITAB into wa_tab2 where field2 = wa_tab1-field2.
l_total = l_total + wa_tab2-field2.
endloop.
wa_tab2-field2 = l_total.
append wa_tab2 to ITAB2.
append
endloop.
ITAB2 would have the summarized data.
Best regards,
Prashant
08-09-2006 9:03 AM
The only other alternative is to use variables to count and modify statement.
Basically,
Loop at itab.
at new field1.
clear total.
endat.
total = total + qty.
at end of field1.
read table itab1 with itab.
modify itab1 index sy-tabix.
endat.
Endloop.
Regards
anurag
08-09-2006 9:04 AM
Hi,
Use
loop at itab into wa_tab1.
LOOP AT ITAB into wa_tab2 where field2 = wa_tab1-field2.
l_total = l_total + wa_tab2-field2.
endloop.
wa_tab2-field2 = l_total.
append wa_tab2 to ITAB2.
append
endloop.
ITAB2 would have the summarized data.
Best regards,
Prashant