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

SALV aggregation

madhura_lobo
Product and Topic Expert
Product and Topic Expert
0 Likes
3,485

Hi,

I am using CL_SALV_TABLE. I want the function aggregate (totals) to be enabled.

Though the following is done, the aggreagte totals does not get enabled at the top of the ALV.

gr_functions = gr_table->get_functions( ).

gr_functions->set_all( abap_true ).

I even tried this

call METHOD gr_functions->SET_AGGREGATION_TOTAL

exporting

VALUE = 'X'.

Still no results.

Can anyone please direct as to how to get the aggregation total enabled in SALV.

Regards,

Madhura Lobo

5 REPLIES 5
Read only

Former Member
0 Likes
1,569

Hi,

Go to SE 38...Put salv* and press f4..u will get list of sample salv program....

For your info:

http://www.se80.co.uk/sapreports/s/salv/salv_test_table_refresh.htm

http://www.se80.co.uk/sapreports/s/salv/salv_demo_tree_metadata.htm

May it helps you.

Regards,

DS.

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,569

METHOD set_aggregations.

DATA: lf_aggrs TYPE REF TO cl_salv_aggregations.

lf_aggrs = pc_alv->get_aggregations( ).

TRY.

CALL METHOD lf_aggrs->add_aggregation

EXPORTING

columnname = 'NETPR'

aggregation = if_salv_c_aggregation=>total.

CALL METHOD lf_aggrs->add_aggregation

EXPORTING

columnname = 'LFIMG'

aggregation = if_salv_c_aggregation=>total.

CATCH cx_salv_data_error . "#EC NO_HANDLER

CATCH cx_salv_not_found . "#EC NO_HANDLER

CATCH cx_salv_existing . "#EC NO_HANDLER

ENDTRY.

ENDMETHOD. "set_aggregations

Edited by: Keshav.T on Aug 23, 2010 4:18 PM

Read only

0 Likes
1,569

Thanks for the reply.

But this does not work. Have already tried it.

Read only

0 Likes
1,569

Are there columns in your field catalog that can be aggregated at all, i.e. amount fields? Otherwise the aggregate functions will not show up despite SET_ALL = true.

Thomas

Read only

0 Likes
1,569

Using the code provided by Keshav.T, and if you have fields to aggregate the totals should show up at the very bottom of the grid.

To have the totals show at the top, add this line:


lf_aggrs->set_aggregation_before_items( 'X' ).