Quantcast
Channel: SCN: Message List - ABAP Development
Viewing all articles
Browse latest Browse all 10425

cl_salv_hierseq_table - subtotal on two fields

$
0
0

Hello Experts,

 

In a report, I would need to have subtotals based on two fields, that is, at every change of field1 and field2, the subtotal shall be shown.

So far, I have taken the sample report SALV_DEMO_HIERSEQ_SIMPLE and added the following part for aggregation and sort:

 

*********************************
   try.

       gr_agg = gr_hierseq->get_aggregations( 2 ).

     CATCH cx_salv_data_error.

   endtry.

   gr_agg->add_aggregation( 'PRICE' ).
   gr_agg->add_aggregation( 'SEATSMAX' ).
   gr_agg->add_aggregation( 'PAYMENTSUM' ).



   g_level_total = gr_hierseq->get_sorts( 1 ).

   g_level_total->add_sort( columnname = 'CARRID' ).
   g_level_total->add_sort( columnname = 'CONNID' subtotal = abap_true ).


**************************************

Unfortunately, the result is that I have actually subtotals when CONNID is changing, while instead I would like to have them when both CARRID and CONNID is changing.

In the screen-shot below (obtained by changing in debug mode the master table rows content) it's shown that for different CARRID but same CONNID, I'm obtaining a subtotal for the CONNID, while instead I would need to have subtotals for, respectively:  AA - 26,  AB - 26.  AC - 26

Image022.PNG

 

Could you please help me in finding which is the best way to satisfy my need?

 

Thanks a lot in advance.

 

JepiF


Viewing all articles
Browse latest Browse all 10425

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>