cancel
Showing results for 
Search instead for 
Did you mean: 

ALV Filter count records

stefan_kagelmacher
Participant
0 Kudos

hello,

i have a little wd component. one view includes an alv. this alv has a dynamic title, which displays the number of selected records. as example the select received 1000 records, the title will display this value. if you use the filter function, you could change the visible data records. as example after using the filter there are only 500 records left. my data table but has still 1000 records, the title diaplays 100 records. on which place the runtime environment storages the actual data (500 records) and how can i get access?

could anyone help please.

regards

stefan

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

it can achieved by following this: you might find that i answer before that how to get the filter value....so building on the same we can get the number of rows after filtering....

follow this thread: which i wrote before...

and add the following code at the end...right before the "ENDIF"


data counter type i.

data lt_rows type IF_SALV_BS=>T_TYPE_ROW.
data lt_row_outside type IF_SALV_BS=>T_TYPE_ROW.

  DATA lo_nd_flight_list_1 TYPE REF TO if_wd_context_node.
  DATA lt_flight_list_1 TYPE wd_this->elements_flight_list_1.

* navigate from <CONTEXT> to <FLIGHT_LIST_1> via lead selection
  lo_nd_flight_list_1 = wd_context->path_get_node( path = `CHANGING.FLIGHT_LIST_1` ).

  lo_nd_flight_list_1->get_static_attributes_table( IMPORTING table = lt_flight_list_1 ).


 cl_salv_wd_filter=>execute(
    exporting
      t_input        = lt_flight_list_1
      t_fields       = l_value->if_salv_wd_field_settings~t_fields

      r_config_model = l_value
    changing
      t_rows         = lt_rows
      t_row_outside  = lt_row_outside
    exceptions
      no_filter_rules = 1 ).


lt_rows will have the value you are looking for....

Thanks...

AS....

arvind_aj
Associate
Associate
0 Kudos

   DATA: lo_value_res               TYPE REF TO cl_salv_wd_config_table,

   CALL METHOD lo_value_res->if_salv_wd_std_functions~set_count_records_allowed
    EXPORTING
      value = abap_true.

  CALL METHOD lo_value_res->if_salv_wd_field_settings~set_count_records_enabled
    EXPORTING
      value = abap_true.

That's it.. Above two method call will solves your problem. Count functionality comes automatically in calculation tab in settings. ALV will do rest of the operations automatically.