2022 Aug 12 4:58 PM
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 ).
2022 Aug 12 5:33 PM
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.