‎2006 Feb 12 12:21 PM
select sum(money) from table group by rate.
this is query for sum gropu by rate.
how to write this query for internal table
‎2006 Feb 12 12:27 PM
data: begin of itab occurs 0 ,
rate
money
end of itab .
sort itab by rate money .
loop at itab .
at end of rate .
sum .
endat .
endloop .
Regards
Raja
‎2006 Feb 12 12:27 PM
data: begin of itab occurs 0 ,
rate
money
end of itab .
sort itab by rate money .
loop at itab .
at end of rate .
sum .
endat .
endloop .
Regards
Raja
‎2006 Feb 12 12:43 PM
here is the code sample.
data: begin of itab occurs 0 ,
rate(1) ,
money(16) type p decimals 2 ,
end of itab .
move: '1' to itab-rate ,
'10' to itab-money .
append itab .
clear itab .
move: '1' to itab-rate ,
'20' to itab-money .
append itab .
clear itab .
move: '1' to itab-rate ,
'30' to itab-money .
append itab .
clear itab .
move: '2' to itab-rate ,
'20' to itab-money .
append itab .
clear itab .
move: '2' to itab-rate ,
'40' to itab-money .
append itab .
clear itab .
move: '2' to itab-rate ,
'50' to itab-money .
append itab .
clear itab .
sort itab by rate money .
loop at itab .
at end of rate .
sum .
write:/ itab-rate ,
itab-money .
endat .
endloop .
Regards
Raja
Reward the helpful answers by clicking the radiobutton
‎2006 Feb 12 3:46 PM
or if you are filling the internal table in a loop, you can also use the COLLECT statement.