cancel
Showing results for 
Search instead for 
Did you mean: 

Filter functionality

Former Member
0 Kudos

Hi All,

To add filter functionality in the webdynpro abap table we have brought filter icon at the run time by binding node attributes to the filter value property.

But I want the implementation code for following methods:

onFilter

onSorter

onDoModifyView

onLeadSelect

Thanks in advance...

Regards,

Dinesh

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

solved

Former Member
0 Kudos

ON FILTER

The display of rows in a table can be restricted using the onFilter action. This can improve the overview of the information contained in a table.

The Table UI element and the TableColumn element provide the application developer with an interface to display a so-called filter row. The filter row is displayed right below the column header area and does not change position when the user browses.

The filtering of table entries requires:

○ ^The option to specify a criterion for each table column to restrict the result list

Each table column enables you to bind its filterValue property to a context attribute that defines the value to be filtered. Due to the binding of this property to a context attribute, an input element, which can be used to enter the value to be filtered, is displayed in the column below the column header area. If the value set is assigned to the attribute, a drop-down box is provide instead of an input field. To use the value set for the filter, this must contain an entry with an initial value to reset the filter. At runtime, the filter input of the user is located in the context attribute to which the property is bound.

○ The option to start the filter process

The Table UI element provides the onFilter property, which can be associated with an action.Due to the association with an action, the filter row is displayed in the table. The filter row contains the button as the first element on the left side. When the user chooses this button, the associated action is executed.

The logic of the filter process is not implemented in Web Dynpro. The application developer must implement the action to be executed.

DO Modify View:

To modify the functionality and to refresh we will write code this method.

WdDoModifyView method has this parameter and the value of this parameter is TRUE when you run the app for the firstTime.If there are any action triggered in the view ...I mean next time onwards the parameter will be FALSE.

The method will be callled for every serverround trip on your view.

former_member515618
Active Participant
0 Kudos

Hi Dinesh,

Do the following for achieving filtering on the table.

Firstly, in the table, identify the table columns on which you want to put filtering.

Create a seperate context node with all those fields .

Go to each of these columns, select the check box 'Is filtered' and bind the respective field of the context node created above to the property 'Filter value.

In the attributes tab of the view, create an attribute say M_TABLE_HANDLER type ref to IF_WD_TABLE_METHOD_HNDL.

In WDDOMODIFY,

Do the following.

IF ( first_time = abap_true ).

wd_table ?= view->get_element( 'Name of the table UI element' ).

wd_this->m_table_handler ?= wd_table->_method_handler.

wd_this->m_table_handler->set_key_attribute_name( 'Any key field name bound (not column name)' ).

ENDIF.

Instantiate the table event onFilter. Create an action say FILTER.

In the event handler do the following.

METHOD onactionfilter .

wd_this->m_table_handler->apply_filter( ).

ENDMETHOD.

This would set the filtering property.

When executed a filter icon is displayed above the first row of the table. and for the fields to which the filtering is enabled, an input field is made editable to enter the filtering criterion.

Enter the filtering value and click on enter of on the filter Icon. the table will then be filtered accordingly.

Hope this helps.

Do let me know in case you need any more details.

Regards,

Sravan Varagani