‎2009 Apr 28 4:19 PM
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
‎2009 Apr 28 4:36 PM
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®
‎2009 Apr 28 4:48 PM
‎2009 Apr 28 5:15 PM
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
‎2009 Apr 29 11:02 AM
Hi,
Please let me know the data type of the column, whether it should be character or number??
Thanks & regards,
Santhosh