Skip to Content

Step 1 :

Create a Webdynpro component.

/wp-content/uploads/2013/02/step1_183625.png

Step 2   :

Create   a context node as shown below.

/wp-content/uploads/2013/02/step2_183710.png

Since we are going to use connid as filter value, we have
added it in the node filter_vale.

   

Step 3 :

 

Create a table and create binding for that.

/wp-content/uploads/2013/02/step3_183711.png

Step 4 :

Now go to the connid column of the table and in the property
filter value , bind the attribute which we have created earlier.

/wp-content/uploads/2013/02/step4_183712.png

Step  5 :

After binding, Go to attributes Tab and create a attribute
as shown below.

Table_hndl         type ref to         if_Wd_table_method_hndl.

/wp-content/uploads/2013/02/step5_183713.png

Step 6 :

Create a action on table on filter as shown below

/wp-content/uploads/2013/02/step6_183714.png

Paste the code inside the method  filter.

wd_this->table_hndl->apply_filter(
).

Step 7 :

Now go to init method and write code to fill data for the
table.

    

  DATA lo_nd_sflight TYPE REF TO if_wd_context_node.

  

  DATA lt_sflight TYPE wd_this->Elements_sflight.

  

* navigate from <CONTEXT> to <SFLIGHT> via lead selection

 

  lo_nd_sflight = wd_context->get_child_node( name = wd_this->wdctx_sflight ).

Select * from sflight into corresponding fields of  table lt_Sflight up to 10 rows.

 

  lo_nd_sflight->bind_table( new_items = lt_sflight set_initial_elements = abap_true ).

Step 8:

Now go to modifyview and write the following code to enable the filter Option for the table.

DATA: l_table TYPE REF TO cl_wd_table.

   * Get reference of the table view element

 

l_table ?= view->get_element( ‘TABLE’ ).    ” HERE WE HAVE TO GIVE THE TABLE NAME.

  

* Get reference to the Filter & Sorting API

 

wd_this->TABLE_HNDL ?= l_table->_method_handler.

  

* Set  the table’s filter action

  

l_table->set_on_filter( ‘FILTER’ ).

 

Step 9:

Create a Webdynpro application and test the application.

/wp-content/uploads/2013/02/step7_183715.png

Step 10:

Now put some value in the filter area and click on filter button.

Say for example lets put 0017 to search and the result is

/wp-content/uploads/2013/02/step8_183722.png

Regards
Aravindan

To report this post you need to login first.

9 Comments

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

  1. Former Member

    Hi Aravindan,

    I have a question once the table is filtered ,i tried removing the filter value and bring back all the entries back to the table but the table now is empty.

    (0) 
      1. Former Member

        Hi Chandra,

        Can we achieve search criteria  similar to this in table, for Eg if we enter Ind*, can we retrieve all the names starting with Ind.

        (0) 
  2. Mohit Kumar

    Hey, Thanks for this, I tried, but it did not work.

    Later I found that “isFiltered” property of the table column must also be checked, I did that and it worked. Did I miss anything?

    (0) 
  3. Former Member

    Hi Aravindan,

     

    I have followed all the steps mentioned above.  But I am getting Filter option in a different way. When I apply filter its working. Here I am not getting the Filter Icon with new Row. Please suggest me if i am doing something wrong. 

    Thanks in advance.

    Regards,

    Srinivas.

     

    (0) 
    1. Uladzislau Pralat

       

      Hi Srinivas,

      SAP made some changes to filtering service see OSS # 2215867

      There is not longer filter line in 7.40 onwards. Filtering is accessible view column header context menu. If filter is set then it is indicated by filter icon in column header

      Regards, Uladzislau

      (0) 
  4. Former Member

    Hi, my filtering works only for one columns. When I added context binding “filter value” for one more columns filtering works still for one column, for other returns empty table. My filter node has 1:N cardinality. Can you help me?

    (0) 
  5. N Cuky

    Hello,

    This post is very helpful. Thank you! I managed to add the filter using wd_this->table_hndl->apply_filter( ) and it works.

    Unfortunately, my organization uses the old version of ABAP WD, so we don’t yet have the new Filter functionality in the popup screen. I have a problem: if I want to find values that contain my entered string, I have to put asterisks (*) around it, exactly like when I search in SAP GUI. The problem is, our users don’t know this trick, as most of them don’t use SAP GUI at all. When one wants to display only the records with “Specific Value” in them, most of the lazy users will just type an abbreviation like “spec” or “val” and expect it to work. They won’t understand they need to put the exact string “specific value”, and it definitely isn’t intuitive to them to wrap their search string with asterisks like ” *val* “.

    So, I would like to intervene before the call to apply_filter( ) method, and add some code that puts (*) before and after the entered string, and then calls the apply_filter( ) using the edited string.

    Is it possible? Do you know how to do it?

     

    Thanks in advanced!

    (0) 

Leave a Reply