Skip to Content
0
Former Member
Nov 27, 2009 at 01:26 PM

How can I activate the average calculation with cl_salv_hierseq_table class

238 Views

Hi there,

Iu2019m using class cl_salv_hierseq_table to display a two level hierarchy (header and item) list.

For some reason it seams that those calculations are active by default with class cl_salv_table but not for cl_salv_hierseq_table.

I tried every suggestion from the class documentation and SAP help and nothing seams to work, the menu calculation options are always inactive except for the total calculation.

After the cl_salv_hierseq_table=>factory...

And before cl_salv_hierseq_table->display( )

I triedu2026u2026.

cl_salv_aggregations = cl_salv_hierseq_table->get_aggregations( 1 )

cl_salv_aggregations->add_aggregation( 'COLUMN1' )

COLUMN1 is a currency column in header level table

u2026u2026..

cl_salv_aggregations = cl_salv_hierseq_table->get_aggregations( 2 )

cl_salv_aggregations->add_aggregation( 'COLUMN2' )

COLUMN2 is a dec column in item level table

u2026u2026..

cl_salv_aggregations = cl_salv_hierseq_table->get_aggregations( 2 )

cl_salv_aggregations->add_aggregation( columnname = 'COLUMN2' aggregation = if_salv_c_aggregation=>average )

u2026u2026..

cl_salv_aggregations = cl_salv_hierseq_table->get_aggregations( 2 )

cl_salv_aggregations->set_aggregation_allowed( 'COLUMN2' )

u2026u2026..

cl_salv_aggregations = cl_salv_hierseq_table->get_aggregations( 2 )

cl_salv_aggregations->set_numerical_aggregation( ).

cl_salv_aggregations->set_aggregation_allowed( 'COLUMN2' )

cl_salv_aggregations->add_aggregation( columnname = 'COLUMN2' aggregation = if_salv_c_aggregation=>average )

u2026u2026..

cl_salv_aggregations = cl_salv_hierseq_table->get_aggregations( 2 )

cl_salv_aggregations->add_aggregation( 'COLUMN2' )

cl_salv_aggregation = cl_salv_aggregations->get_aggregation( 'COLUMN2' )

cl_salv_aggregation->set( if_salv_c_aggregation=>average )

Any help will be appreciated!