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

using aggregation in ABAP code for internal table

Former Member
0 Likes
1,242

I have written following code to get cumulative amount on a date but i have to hit database for each record.

Can't I use some function similar to SUM for doing the same thing on internal table??It would increase my performance.

code is:

SELECT SUM( DEB_CRE_LC ) FROM /BIC/AZFIAR_O500

INTO LV_BALMONTH WHERE DEBITOR = LV_DEBITOR AND

CALMONTH GE LV_STARTMONTH AND CALMONTH LE LV_LASTCALMON.

I want to put ZFIAR data to internal table and read and do SUM thing..is it possible?? withotut usiong loop.

regards,

rakesh

3 REPLIES 3
Read only

Former Member
0 Likes
618

You can use SUM statement at the time of selecting data to an internal table...

Do not know if any keyword is there to do similar activity...

Thanks

Read only

prasoon_sahay
Participant
0 Likes
618

You have loop on your internal table, then use COLLECT or SUM ststement

Read only

Former Member
0 Likes
618

Hi Rajesh,

types : begin of ty_tab,

date type dats,

DEB_CRE_LC type ..... " delare type & is the filed need to summerized

end of ty_tab,

data: itab type standard table of ty_tab.

SELECT date

SUM( DEB_CRE_LC ) as DEB_CRE_LC FROM /BIC/AZFIAR_O500

INTO corresponding fields of itab

where CALMONTH GE LV_STARTMONTH AND CALMONTH LE LV_LASTCALMON

group by date. " date is the field available in your ODS/transparent table

simulate the above code in your program...

Hope this will work..