Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

about report program

Former Member
0 Likes
457

select sum(money) from table group by rate.

this is query for sum gropu by rate.

how to write this query for internal table

1 ACCEPTED SOLUTION
Read only

athavanraja
Active Contributor
0 Likes
444

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

3 REPLIES 3
Read only

athavanraja
Active Contributor
0 Likes
445

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

Read only

0 Likes
444

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

Read only

Former Member
0 Likes
444

or if you are filling the internal table in a loop, you can also use the COLLECT statement.