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

Aggregation functions

Former Member
0 Likes
694

How to most efficient can I symulate Aggregation functions in ABAP?

I know that I can use max min, avg on single field in table, but I need to calculate in program, this values but not on a single field but on expression e.g:

max(kolumn1 - kolumn2 + kolumn3 / kolumn 4) and so one...

Or I miss something in documentation?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
668

I forgot to add that I also need use functionality group by

5 REPLIES 5
Read only

Former Member
0 Likes
668

hi,

exceute the program RSHOWTIM to see more details.

regards

Sandeep.

Read only

Former Member
0 Likes
668

chk these programs

DEMO_DATA_CALCULATE

and checkout for DEMO* programs in SE38

Read only

Former Member
0 Likes
669

I forgot to add that I also need use functionality group by

Read only

0 Likes
668

max(kolumn1 - kolumn2 + kolumn3 / kolumn 4)

It is not possible to achieve the above result via just a SELECT statement you would need to capture the data into internal table and get the result.

SELECT key sum(kolumn1) sum(kolumn2) sum(kolumn3) sum(kolumn4)

into table itab

from ztable

where key in so_key

group by key.

Loop at itab.

lval = itab-kolumn3 / itab-kolumn 4.

lval = kolumn1 - kolumn2 + lval.

if lmax <= lval.

lkey = itab-key.

lmax = lval.

endif.

endloop.

Read only

andreas_mann3
Active Contributor
0 Likes
668

Hi,

look here:

A.