Skip to Content

Reading ALV Filter values in Webdynpro ABAP


I got a requirement  where i need to read the filtered values from ALV table in webdynpro ABAP. Some workaround helped me to make my task easier.Below is the code which i used to read the filtered values.

   DATA: lr_interfacecontroller    TYPE REF TO iwci_salv_wd_table.

   DATA: l_value                       TYPE if_salv_wd_table=>s_type_param_get_ui_info.

   DATA: lt_salv_bs_t_int           TYPE salv_bs_t_int.

   DATA: ls_salv_bs_t_int          TYPE i.

   DATA: l_displayed_element    TYPE LINE OF if_salv_wd_table=>s_type_param_get_ui_infot_displayed_elements.

   DATA: lt_visible_indices         TYPE cl_wdha_assist=>indices.
  DATA: lw_visible_indices         LIKE LINE OF lt_visible_indices.


      lr_interfacecontroller =   wd_this->wd_cpifc_used_component( ).” ( In my case :   lr_interfacecontroller =   wd_this->wd_cpifc_source_roles_dirclty( ).

    CATCH cx_wdr_rt_exception.

   IF NOT lr_interfacecontroller IS INITIAL.

       l_value = lr_interfacecontroller->get_ui_info( ).  ” ( GET_UI_INFO( ) : The method returns information about the currently displayed ALV.)


        IF  l_values_service_infois_filtered = abap_true. “( To check if filter is applied)

          lt_salv_bs_t_int = l_valuet_displayed_elements.

              CLEAR lt_visible_indices[].

               LOOP AT   l_valuet_displayed_elements  INTO l_displayed_element.
        l_indexindex = l_displayed_element.
        APPEND l_index TO lt_visible_indices.       ” ( Returns the index(s) of the internal table records which we have selected from filtered values)

         SORT lt_visible_indices BY index.





Hope this helps for all who have similar requirement which makes their task easier.

Comments/Suggestions are welcome.


Katrice Hawkins

You must be Logged on to comment or reply to a post.