Rudeus
Rudeus

Reputation: 9

How to display subtotals without a grand total in SAP SALV?

I'm working with the CL_SALV_TABLE class in SAP to create an ALV report. My goal is to display subtotals for specific columns, but I do not want a grand total at the end of the report.

I've managed to add subtotals using the following code:

    PERFORM get_column USING 'ERFMG' my_columns CHANGING my_column.
    my_column->set_quantity_column( 'ERFME' ).

    my_alv->get_sorts( )->add_sort( columnname = 'MATNR' subtotal = abap_true sequence = if_salv_c_sort=>sort_up ).
    my_alv->get_sorts( )->add_sort( columnname = 'MAKTX' subtotal = abap_true sequence = if_salv_c_sort=>sort_up ).
    my_alv->get_aggregations( )->add_aggregation( columnname = 'LABST' aggregation = if_salv_c_aggregation=>total ).
    my_alv->get_aggregations( )->add_aggregation( columnname = 'ERFMG' aggregation = if_salv_c_aggregation=>total ).

However, the issue is that a grand total is still being displayed at the bottom of the report, which I want to suppress.

I've searched online and found several solutions for handling this in the traditional ALV grid (using CL_GUI_ALV_GRID), but nothing specific to CL_SALV_TABLE. Is there a way to display only the subtotals without showing a grand total at the end? Any insights or alternative approaches would be greatly appreciated!

Upvotes: 0

Views: 398

Answers (0)

Related Questions