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: 
Read only

SALV count functionality

Former Member
0 Likes
1,001

Hi All,

I'm using SALV for the report output. 'COUNT' functionality in menu path (Edit->Calculate->Count) is greyed out.

Please let me know how to activate this function.

Thanks & regards,

Santhosh

4 REPLIES 4
Read only

former_member194669
Active Contributor
0 Likes
728

Try this way


    TRY.
        gr_agg = gr_table->get_aggregations( ).
        CALL METHOD gr_agg->add_aggregation
          EXPORTING
            columnname  = 'SLNUMBER'    " <<<  Pass Field Name
            aggregation = if_salv_c_aggregation=>total
          RECEIVING
            value       = gr_agg_t.
      CATCH cx_salv_data_error .
      CATCH cx_salv_not_found .
      CATCH cx_salv_existing .
    ENDTRY.
.....
.....
.....
TRY. 
    GR_TABLE->DISPLAY().
ENTRY.

a®

Read only

Former Member
0 Likes
728

did u try copying other gui status in saplkkbl?

Read only

naimesh_patel
Active Contributor
0 Likes
728

You need to specify the COUNT coulumn and that count coulumn MUST be type I.

To get the COUNT function active, you need to:

1) Set the COUNT Agreegrate Function


  DATA: lr_functions TYPE REF TO cl_salv_functions_list.

  lr_functions = gr_table->get_functions( ).
  lr_functions->SET_AGGREGATION_COUNT( 'X' ).

2) Set the COUNT Column


  DATA: lr_columns TYPE REF TO cl_salv_columns_table,
  lr_columns = gr_table->get_columns( ).
  TRY.
      lr_columns->SET_COUNT_COLUMN( 'SEATSMAX' ).
    CATCH cx_salv_data_error.                           "#EC NO_HANDLER
  ENDTRY.

Now you COUNT function (Edit > Calculate > Count) should be active.

Regards,

Naimesh Patel

Read only

0 Likes
728

Hi,

Please let me know the data type of the column, whether it should be character or number??

Thanks & regards,

Santhosh