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: 

CL_SALV_TABLES -> Texts in Subtotal line

thomas_mueller8
Participant
0 Kudos
527

Hello,

the task is to write a report where you see 1 (subtotal) line per BUKRS, KUNNR, VBELN. This report is using CL_SALV_TABLE. So far I managed the output with aggregations and subtotal. Now they want to have additional information (texts) in the subtotal line for further columns like BLDAT, BUDAT, etc.

How can this be obtained? Only by sorting (Meth. ADD_SORT) w/o subtotal or is there another way?

alv->get_sorts( )->add_sort( columnname = 'BUKRS' subtotal = abap_false ).
alv->get_sorts( )->add_sort( columnname = 'KUNNR' subtotal = abap_false ).
alv->get_sorts( )->add_sort( columnname = 'NAME1' subtotal = abap_false ).

* Definition Subtotal

alv->get_sorts( )->add_sort( columnname = 'BELNR' subtotal = abap_true ).
alv->get_sorts( )->set_compressed_subtotal( 'BELNR' ).

* Sum on Amount in HW

aggregations = alv->get_aggregations( ).
aggregations->add_aggregation( columnname = 'DMSHB'
aggregation = if_salv_c_aggregation=>total ).

1 REPLY 1

Sandra_Rossi
Active Contributor
0 Kudos
443

SALV don't allow to program all possible features of the underlying control (CL_GUI_ALV_GRID). Direct access to the latter allows changing the text of any column of a subtotal line (you can search the forum for GET_SUBTOTALS).

So, you could try getting the instance of CL_GUI_ALV_GRID which is generated by SALV, and manipulate directly the control. There are some blog post(s) and questions/answers about how to get the instance (different solutions). E.g. GET_GLOBALS_FROM_SLVC_FULLSCR.