Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

Hi, We often run into the requirements where we are using TABLE UI element (without using SALV_WD_TABLE) in the webdynpro view to display the output and we need filters to cut down the data which is being displayed on the output. Hence this requirement generally consists of 2 things-

- Achieving filters on the table UI element (Table columns which are being displayed in the output)

- Read the filtered(shortened) contents of the node.


For the above requirements we make use of below steps to achieve-


- Achieving filters on the table UI element (Table columns which are being displayed in the output)


1. Create one attribute TAB_HANDLER of type IF_WD_TABLE_METHOD_HNDL in the main view—

Refer - SC_1(Attachment)

2. Go to WDDOMODIFYVIEW to get this attribute instantiated

method WDDOMODIFYVIEW .
DATA: lr_table TYPE REF TO cl_wd_table.
IF first_time = abap_true.
lr_table ?= view
->get_element( 'OUTPUT_TABLE' ). "Here OUTPUT_TABLE is Table UI element name
wd_this
->tab_handler ?= lr_table->_method_handler.
ENDIF.
endmethod.

3. Create one more node at context with name TAB_FILTERS—

Refer - SC_2(Attachment)

Enter>>

Refer - SC_3(Attachment)

Add attributes (these attributes must be same as the fields on which the filter is needed). Let us put filter on Flight number>>

Refer - SC_4(Attachment)

4. Goto Layout tab>> expand TABLE UI element >>Select the column on which the filter is needed>>

Refer - SC_5(Attachment)

Click on binding of filtervalue attribute>>

Refer - SC_6(Attachment)

Also, check IsFiltered property of the table column tooà

Refer - SC_7(Attachment)

5. Click on the Table UI element and create on event handler on Filter event

Refer - SC_8(Attachment)

6. Write below code to get this working—

wd_this->tab_handler->apply_filter( ).

Activate and refresh/start browser to see—

Refer - SC_9(Attachment)

Important notes

To reset filter, we must initialize the filter node attributes to ‘*’ if it is a character field and then we must call method APPLY_FILTER –

wd_this->tab_handler->apply_filter( ).

- Read the filtered(shortened) contents of the node.


To get the filtered data (which might be same / less data after we apply a filter) we can get using GET_TABLE_DATA method of the IF_WD_TABLE_METHOD_HNDL interface. This interface returns element references and we can use them in a loop to get the values using GET_STATIC_ATTRIBUTES method of IF_WD_CONTEXT_ELEMENT ‘s method.

2 Comments
Labels in this area