Quantcast
Channel: Web Dynpro ABAP
Viewing all articles
Browse latest Browse all 141

Reading ALV Filter values in Webdynpro ABAP

$
0
0

Hi,

 

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_info-t_displayed_elements.

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

 

      TRY.
      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.
  ENDTRY.

 

   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_value-s_service_info-is_filtered = abap_true. "( To check if filter is applied)

 

          lt_salv_bs_t_int = l_value-t_displayed_elements.

              CLEAR lt_visible_indices[].

               LOOP AT   l_value-t_displayed_elements  INTO l_displayed_element.
        l_index-index = 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)
      ENDLOOP.

 

         SORT lt_visible_indices BY index.

          

         

       ENDIF.

 

   ENDIF.

 

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

Comments/Suggestions are welcome.

 

Thanks

Katrice Hawkins


Viewing all articles
Browse latest Browse all 141

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>