Skip to Content
avatar image
Former Member

Table Filter

hi

I am new in webdynpro and I developed a project that is connected to R/3 using RFC’s and I bind these output tables of RFC’s to the view, now I need to add table filter to these tables. I use TableFilter.java which I found it in How to get ready-made filter for your Web Dynpro Table with minimal coding ? blog for Kapil Kamble.

When I try to run my project I got NullPointer Exception in this line

wdContext.currentContextElement().getFilter().filter(wdEvent,wdContext.nodePostock_Dist(),wdContext.nodePostock_Dist(),wdContext.nodeTableFilter(),null);

please help me in this problem

best regards

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Apr 28, 2007 at 03:33 PM

    Said, try to check whether <i>wdContext.currentContextElement().getFilter();</i> is not null. Are you performing this piece of code in wdDoModifyView method:

    if ( firstTime )
    {
    if ( null != view ) 
    { 
    IWDTable table = (IWDTable) view.getElement("Table");
    wdContext.currentContextElement().setTableFilter(new TableFilter(table,wdThis.wdGetFilterAction()));
    }
    }
    
    

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 29, 2007 at 06:53 AM

    Hi

    Yes I write this code in the wdDoModifyView method. Also I tried wdContext.currentContextElement().getFilter() and it always give me null.

    I have one question: to have a table filter we need to create to nodes one is the original node that is mapped to the RFC and the other node is the source node which is used to display information in the view. How I map the data from original node to source node?

    Best regards

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Said,

      In order to map data from the source to the table view I call the 'filter' method in my wdDoModifyView method. so my method look like this:

      if (firstTime) {
      IWDTable table = (IWDTable) view.getElement("Table");
      wdContext.currentContextElement.setTableFilter(table,wdThis.wdGetFilterAction(),wdContext.nodeSource(), new HashTable()));
      wdContext.currentContextElement.getTableFilter().filter(wdContext.nodeSource(),wdContext.nodeTable());
      }

      BTW, I'm using Peter Vignet's table filter:

      /people/peter.vignet/blog/2007/01/03/generic-web-dynpro-java-table-filter

      Regards,

      Omri

  • Apr 30, 2007 at 09:47 AM

    Hi Said Mohammad

    R u binded the dataSource to the table.While creating TableFilter object pass the table reference exactly in wdModify method i mean pass the corrct id ,you are passing the two nodes references to the filter method is same,so you are losing the data of source node while invalide in that method,better you create the One Extra node which is just copy of the node you binded to the table as data source,whose attr and cardinality is same.Copy all elements in to the newly created node by using WDCopyService.copyElements(sourcenode,targetnode)And pass

    DataSource node(binded to table)

    ExtraNode (replica of the above)

    FilterNode to your filter method

    Dont forgrt to copy all elements before applying filtering(important)

    null

    as parameters

    Hope this solves your problem.let me know the status

    regards

    venkatakalyan.k

    Add comment
    10|10000 characters needed characters exceeded