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

A Problem with a simple SALV Aggregation example.

Former Member
0 Likes
1,706

Hi. I am running the following code:

TRY.

lr_aggr = lr_aggrs->get_aggregation( columnname = 'SEATSMAX' ).

CATCH cx_salv_not_found INTO gr_error.

ENDTRY.

TRY.

lr_aggr->set( aggregation = if_salv_c_aggregation=>maximum ).

CATCH cx_salv_data_error INTO gr_error.

ENDTRY.

The lr_aggr->set( aggregation = if_salv_c_aggregation=>maximum ) is failing because I am not getting a good reference from the lr_aggr = lr_aggrs->get_aggregation( columnname = 'SEATSMAX' ) method above. All of my prior references are ok because I am doing other methods against the same ALV grid, but for some reason, the AGGREGATION is not working.

Can anyone see anything that I might be doing wrong?

Thank you!

Andy

1 ACCEPTED SOLUTION
Read only

MarcinPciak
Active Contributor
0 Likes
835

Hi Andy,

Yup it is wrong. Use the code below:


data: lr_aggr TYPE REF TO cl_salv_aggregations,
        lr_salv  TYPE REF TO cl_salv_table.

lr_aggr = lr_salv->get_aggregations( ).
lr_aggr->add_aggregation( 'SEATSMAX' ).

This will work:)

Regards

Marcin

2 REPLIES 2
Read only

MarcinPciak
Active Contributor
0 Likes
836

Hi Andy,

Yup it is wrong. Use the code below:


data: lr_aggr TYPE REF TO cl_salv_aggregations,
        lr_salv  TYPE REF TO cl_salv_table.

lr_aggr = lr_salv->get_aggregations( ).
lr_aggr->add_aggregation( 'SEATSMAX' ).

This will work:)

Regards

Marcin

Read only

Former Member
0 Likes
835

HI,

Refer to the demo program SALV_TEST_TABLE

lr_aggregations = gr_table->get_aggregations( )