cancel
Showing results for 
Search instead for 
Did you mean: 

Error in TableFilter - Illegal Argument Exception

Former Member
0 Kudos

Hi,

I'm trying to use TableFilter function, and I have the following error when I put any text on any column filter and click on filter button:

+com.sap.tc.webdynpro.services.exceptions.WDRuntimeException+
+	at com.sap.tc.webdynpro.clientimpl.html.client.HtmlClient.handleUIElementEvent(HtmlClient.java:970)+
+	at com.sap.tc.webdynpro.clientimpl.html.client.HtmlClient.updateEventQueue(HtmlClient.java:380)+
+	at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.prepareTasks(AbstractClient.java:93)+
+	at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:294)+
+	at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingStandalone(ClientSession.java:700)+
+	at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:653)+
+	at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:243)+
+	at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:154)+
+	at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:62)+
+	at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:53)+
+	at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)+
+	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)+
+	at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)+
+	at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)+
+	at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)+
+	at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)+
+	at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)+
+	at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)+
+	at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)+
+	at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)+
+	at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)+
+	at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)+
+	at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)+
+	at java.security.AccessController.doPrivileged(AccessController.java:207)+
+	at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)+
+	at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)+
+Caused by: java.lang.reflect.InvocationTargetException+
+Caused by: java.lang.IllegalArgumentException:+
 
+	at com.sap.tc.webdynpro.clientserver.data.DataContainer.createLocalPath(DataContainer.java:1350)+
+	at com.sap.tc.webdynpro.clientserver.data.DataContainer.updateAttribute(DataContainer.java:454)+
+	at com.sap.tc.webdynpro.clientserver.uielements.adaptbase.AbstractAdapter.updateAttribute(AbstractAdapter.java:653)+
+	at com.sap.tc.webdynpro.clientserver.uielib.standard.uradapter.TableAdapter$FilterField.onINPUTFIELDCHANGE(TableAdapter.java:3836)+
+	at com.sap.tc.webdynpro.clientserver.uielib.standard.uradapter.TableAdapter$FilterField.onINPUTFIELDKEYPRESS(TableAdapter.java:4074)+
+	at com.sap.tc.webdynpro.clientserver.uielib.standard.uradapter.TableAdapter.onINPUTFIELDKEYPRESS(TableAdapter.java:10119)+
+	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)+
+	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)+
+	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)+
+	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)+
+	at java.lang.reflect.Method.invoke(Method.java:391)+
+	at com.sap.tc.webdynpro.clientimpl.html.client.HtmlClient.handleUIElementEvent(HtmlClient.java:962)+
+	at com.sap.tc.webdynpro.clientimpl.html.client.HtmlClient.updateEventQueue(HtmlClient.java:380)+
+	at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.prepareTasks(AbstractClient.java:93)+
+	at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:294)+
+	at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingStandalone(ClientSession.java:700)+
+	at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:653)+
+	at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:243)+
+	at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:154)+
+	at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:62)+
+	at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:53)+
+	at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)+
+	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)+
+	at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)+
+	at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)+
+	at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)+
+	at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)+
+	at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)+
+	at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)+
+	at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)+
+	at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)+
+	at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)+
+	at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)+
+	at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)+
+	at java.security.AccessController.doPrivileged(AccessController.java:207)+
+	at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)+
+	at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)+

Anybody knows this error?

I've put this code on TableFilter.java:

+import java.util.Comparator;+
+import java.util.HashMap;+
+import java.util.Iterator;+
+import java.util.Map;+
+import java.util.StringTokenizer;+
 
+import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDAbstractDropDownByIndex;+
+import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDAbstractDropDownByKey;+
+import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDAbstractInputField;+
+import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDCaption;+
+import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDImage;+
+import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDLink;+
+import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDProgressIndicator;+
+import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDRadioButton;+
+import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTable;+
+import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTableCellEditor;+
+import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTableColumn;+
+import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTextEdit;+
+import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTextView;+
+import com.sap.tc.webdynpro.progmodel.api.IWDAction;+
+import com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent;+
+import com.sap.tc.webdynpro.progmodel.api.IWDNode;+
+import com.sap.tc.webdynpro.progmodel.api.IWDNodeElement;+
+import com.sap.tc.webdynpro.progmodel.api.IWDViewElement;+
+import com.sap.tc.webdynpro.progmodel.api.WDCopyService;+
+/*+
 +* Created on Feb 28, 2008+
 +*+
 +* To change the template for this generated file go to+
 +* Window>Preferences>Java>Code Generation>Code and Comments+
 +*/+
 
+/**+
 +* @author 281151+
 +*+
 +* To change the template for this generated type comment go to+
 +* Window>Preferences>Java>Code Generation>Code and Comments+
 +*/+
+public final class TableFilter+
+{+
  +/**+
   +* Creates a table filter for the given table using the given filter action.+
   +* This constructor must be called from <code>wdDoModifyView()</code>, but+
   +* usually only when that hook is called for the first time. Store the newly+
   +* created instance in a context attribute with Java native type+
   +* <code>com.sap.tc.webdynpro.tests.utils.TableFilter</code>.+
   +* The given filter action's event handler will be bound to the <code>onAction</code>+
   +* event of filter columns and must at least call this table filter's+
   +* <code>filter(wdEvent)</code> method.+
   +*+
 
   +* When a table is made filterable its <code>onAction</code> event (incl.+
   +* parameter mapping) is changed. Furthermore if a header is present for that+
   +* column then the header's <code>imageSource</code> property is also changed+
   +* to indicate the currently filtered column.+
   +*+
 
   +* @see filter()+
   +* @see com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTable+
   +*/+
  +public TableFilter(IWDTable table, IWDAction filterAction)+
  +{+
+	this.table = table;+
+	+
+	// sanity checks+
+	if (filterAction == null)+
+	  throw new IllegalArgumentException("Filter action must be given");+
+	if (table == null)+
+	  throw new IllegalArgumentException("Table must be given");+
+	if (table.bindingOfDataSource() == null)+
+	  throw new IllegalArgumentException("Data source of table with id '" + table.getId() + "' must be bound");+
 
+	String dataSourcePrefix = table.bindingOfDataSource() + ".";+
+	int index = 0;+
    
+	for (Iterator it = table.iterateColumns(); it.hasNext(); ++index)+
+	{+
 
+		// for every column: try to make it bindable+
+	  IWDTableColumn column = (IWDTableColumn) it.next();+
 
+	   // attribute must be determined+
+	  String bindingOfPrimaryProperty = bindingOfPrimaryProperty(column.getTableCellEditor());+
      
+	  if ( bindingOfPrimaryProperty == null+
+		  || !bindingOfPrimaryProperty.startsWith(dataSourcePrefix) )+
+		  continue; // no attribute found or outside of data source+
      
+	  String attributeName = bindingOfPrimaryProperty.substring(dataSourcePrefix.length());+
+	  if (attributeName.indexOf('.') >= 0)+
+	  continue; // attribute not immediately below data source+
        
+	+
  
+	  table.setOnFilter(filterAction);+
+	}+
  +}+
  
  +/**+
   +* This method must be called from the event handler of this table filter's+
   +* filter action. It performs the actual filter operation.+
   +*/+
  +public void filter(IWDCustomEvent wdEvent,IWDNode dataSource, IWDNode originalSource, IWDNode filterNode)+
  +{+
+	// find the things we need+
+	String refinedFilter = null;+
+	String field = null;+
+	String attributeName = null;+
+	String bindingOfPrimaryProperty = null;+
+	String dataSourcePrefix = table.bindingOfDataSource() + ".";+
+	IWDTableColumn[] columns = table.getColumns();+
+	String path = null;+
+	String attribute = null;+
+	StringTokenizer tokenizer = null;+
+	+
+	dataSource.invalidate();+
+	WDCopyService.copyElements(originalSource,dataSource);+
+	int totalElements = originalSource.size();+
+	for(int i = totalElements - 1; i >= 0 ; i--)+
+	{+
+		IWDNodeElement element = dataSource.getElementAt(i);+
+		for(int j =0; j < columns.length; j++ )+
+		{+
+			IWDTableColumn colmn = columns[j];+
+			+
+			bindingOfPrimaryProperty = bindingOfPrimaryProperty(colmn.getTableCellEditor());+
+			+
+			if(bindingOfPrimaryProperty != null+
 
+			   && bindingOfPrimaryProperty.startsWith(dataSourcePrefix))+
+			attributeName = bindingOfPrimaryProperty.substring(dataSourcePrefix.length());+
+			+
+			if(attributeName.indexOf('.') < 0)+
+			field = element.getAttributeAsText(attributeName);+
 
+			if(colmn.bindingOfFilterValue() != null)+
+			{+
+				path = colmn.bindingOfFilterValue();+
+				+
+				tokenizer = new StringTokenizer(path, ".");+
+				+
+				while(tokenizer.hasMoreTokens())+
+				{+
+					attribute = tokenizer.nextToken();	+
+				}+
+				+
+				refinedFilter = refineFilterString(filterNode.getCurrentElement().getAttributeAsText(attribute));  //attribute+
+				+
+				if(!(field.toUpperCase().matches(refinedFilter.toUpperCase())))+
+				{+
+					dataSource.removeElement(element);+
+				}+
+				else+
+				{+
+		//			remove icon of previously filtered column+
+					if ( currentlyFilteredColumn != null+
+					 && currentlyFilteredColumn.getHeader() != null )+
+					  currentlyFilteredColumn.getHeader().setImageSource(null);+
 
+					currentlyFilteredColumn = columns[j];+
+					+
+					if ((currentlyFilteredColumn.getHeader() != null) && (dataSource.size() != originalSource.size()))+
 
+					currentlyFilteredColumn.getHeader().setImageSource("~sapicons/s_b_filt.GIF");+
+				}+
+			}+
+		}+
    +	+
+	}+
    
+}+
 
 
  +/**+
   +* Returns the binding of the given table cell editor's property that is+
   +* considered "primary" or <code>null</code> if no such binding exists or no+
   +* such property can be determined.+
   +*/+
  +private static final String bindingOfPrimaryProperty(IWDTableCellEditor editor)+
  +{+
+	return editor instanceof IWDViewElement+
+	  ? bindingOfPrimaryProperty((IWDViewElement) editor)+
+	  : null;+
  +}+
 
  +/**+
   +* Returns the binding of the given view element's property that is+
   +* considered "primary" or <code>null</code> if no such binding exists or no+
   +* such property can be determined.+
   +*/+
  +private static final String bindingOfPrimaryProperty(IWDViewElement element)+
  +{+
+	if (element instanceof IWDAbstractDropDownByIndex)+
+	  return ((IWDAbstractDropDownByIndex) element).bindingOfTexts();+
+	if (element instanceof IWDAbstractDropDownByKey)+
+	  return ((IWDAbstractDropDownByKey) element).bindingOfSelectedKey();+
+	if (element instanceof IWDAbstractInputField)+
+	  return ((IWDAbstractInputField) element).bindingOfValue();+
+	if (element instanceof IWDCaption)+
+	  return ((IWDCaption) element).bindingOfText();+
+//	  if (element instanceof IWDCheckBox)+
+//		return ((IWDCheckBox) element).bindingOfChecked();+
+	if (element instanceof IWDLink)+
+	  return ((IWDLink) element).bindingOfText();+
+	if (element instanceof IWDProgressIndicator)+
+	  return ((IWDProgressIndicator) element).bindingOfPercentValue();+
+	if (element instanceof IWDRadioButton)+
+	  return ((IWDRadioButton) element).bindingOfSelectedKey();+
+	if (element instanceof IWDTextEdit)+
+	  return ((IWDTextEdit) element).bindingOfValue();+
+	if (element instanceof IWDTextView)+
+	  return ((IWDTextView) element).bindingOfText();+
+	if (element instanceof IWDImage)+
+	  return ((IWDImage)element).bindingOfAlt();+
  
 
+	return null;+
  +}+
 
  +/**+
   +* Instance of a comparator according to the ordering imposed by the+
   +* implementation of <code>Comparable</code>.+
   +*/+
  +private static final Comparator DEFAULT = new Comparator()+
  +{+
+	/**+
+	 * Compares the given objects according to the ordering imposed by the first+
+	 * ones <code>compareTo(Object)</code> function. Furthermore, <code>null</code>+
+	 * is treated to be less than any object.+
+	 *+
 
+	 * @see java.lang.Comparable#compareTo(java.lang.Object)+
+	 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)+
+	 */+
+	public int compare(Object o1, Object o2)+
+	{+
+	  if (o1 == null && o2 == null)+
+		return 0;+
+	  if (o1 == null)+
+		return -1;+
+	  if (o2 == null)+
+		return +1;+
  
+	  return ((Comparable) o1).compareTo((Comparable) o2);+
+	}+
  +};+
    
  +/**+
   +* Map of table column to comparator (<code>ReversableComparator</code>)+
   +* used for sorting that column (sortable columns only).+
   +*/+
  +private final Map comparatorForColumn = new HashMap();+
 
  +/**+
   +* Column that is currently sorted.+
   +*/+
  +private IWDTableColumn currentlyFilteredColumn;+
 
  +/**+
   +* The table to be sorted.+
   +*/+
  +private final IWDTable table;+
 
  +/**+
   +* Generic comparator that compares node elements by a given attribute with+
   +* the help of a given comparator.+
   +*/+
  +public final class NodeElementByAttributeComparator implements Comparator+
  +{+
+	/**+
+	 * Creates a new comparator for the given attribute name that compares values+
+	 * of that attribute according to the natural ordering of that attribute's+
+	 * type (which must implement <code>java.lang.Comparable</code>).+
+	 */+
+	public NodeElementByAttributeComparator(String attributeName)+
+	{+
+	  this(attributeName, null, false);+
+	}+
  
+	/**+
+	 * Creates a new comparator for the given attribute name that compares values+
+	 * of that attribute with the help of the given comparator. If no comparator+
+	 * is given, the natural ordering of that attribute's type is used.+
+	 */+
+	public NodeElementByAttributeComparator(String attributeName, Comparator comparator)+
+	{+
+	  this(attributeName, comparator, false);+
+	}+
  
+	/**+
+	 * Creates a new comparator for the given attribute name that compares values+
+	 * of that attribute either as objects (i.e. "in internal format") or as text+
+	 * (i.e. "in external format") as indicated. The ordering is the natural+
+	 * ordering of that attribute's type (which must implement+
+	 * <code>java.lang.Comparable</code>) in case objects are compared or the+
+	 * natural ordering of <code>java.lang.String</code> in case texts are compared.+
+	 */+
+	public NodeElementByAttributeComparator(String attributeName, boolean compareAsText)+
+	{+
+	  this(attributeName, null, compareAsText);+
+	}+
  
+	/**+
+	 * Internal constructor.+
+	 */+
+	private NodeElementByAttributeComparator(String attributeName,+
+	  Comparator comparator, boolean compareAsText)+
+	{+
+	  if (attributeName == null)+
+		throw new IllegalArgumentException("Attribute name must not be null");+
+	  if (comparator == null)+
+		comparator = DEFAULT;+
  
+	  this.attributeName = attributeName;+
+	  this.comparator = comparator;+
+	  this.compareAsText = compareAsText;+
+	}+
  
+	/**+
+	 * Compares the given objects which must be instances of <code>IWDNodeElement</code>+
+	 * according to the values of the attribute given at construction time+
+	 * with the help of the comparator given at construction time.+
+	 *+
 
+	 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)+
+	 * @see com.sap.tc.webdynpro.progmodel.api.IWDNodeElement+
+	 */+
+	public int compare(Object o1, Object o2)+
+	{+
+	  IWDNodeElement element1 = (IWDNodeElement) o1;+
+	  IWDNodeElement element2 = (IWDNodeElement) o2;+
+	  Object attributeValue1 = compareAsText+
+		? element1.getAttributeAsText(attributeName)+
+		: element1.getAttributeValue(attributeName);+
+	  Object attributeValue2 = compareAsText+
+		? element2.getAttributeAsText(attributeName)+
+		: element2.getAttributeValue(attributeName);+
      
+	  return comparator.compare(attributeValue1, attributeValue2);+
+	}+
  
+	/**+
+	 * Name of the attribute used for comparisons.+
+	 */+
+	private final String attributeName;+
    
+	/**+
+	 * Comparator used for comparing the attribute's values.+
+	 */+
+	private final Comparator comparator;+
    
+	/**+
+	 * Indicates whether attribute values are compared as text (as opposed to+
+	 * "as objects").+
+	 */+
+	private final boolean compareAsText;+
  +}+
 
  +/**+
   +* Comparator that knows how to reverse another comparator's sort direction.+
   +*/+
  +private final class ReversableComparator implements Comparator+
  +{+
+	/**+
+	 * Creates a new reversable comparator for the given other comparator.+
+	 */+
+	public ReversableComparator(Comparator comparator)+
+	{+
+	  if (comparator == null)+
+		throw new IllegalArgumentException("Comparator must not be null");+
  
+	  this.comparator = comparator;+
+	}+
  
+	/**+
+	 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)+
+	 */+
+	public int compare(Object o1, Object o2)+
+	{+
+	  return reversed+
+		? -comparator.compare(o1, o2)+
+		:  comparator.compare(o1, o2);+
+	}+
  
+	/**+
+	 * Tells whether the other comparator's sort direction is reversed.+
+	 */+
+	public boolean isReversed()+
+	{+
+	  return reversed;+
+	}+
  
+	/**+
+	 * Determines whether the other comparator's sort direction is reversed.+
+	 */+
+	public void setReversed(boolean reversed)+
+	{+
+	  this.reversed = reversed;+
+	}+
    
+	/**+
+	 * Toggles the current "sort direction".+
+	 */+
+	public void toggleReversed()+
+	{+
+	  reversed = !reversed;+
+	}+
  
+	/**+
+	 * The other comparator.+
+	 */+
+	private final Comparator comparator;+
  
+	/**+
+	 * Whether the other comparator's sort direction is reversed.+
+	 */+
+	private boolean reversed;+
  +}+
  
  +public String refineFilterString (String filterString)+
  +{+
+	if ( ( null == filterString ) || ( 0 >= filterString.length() ) )+
 
+	{+
+		filterString = ".*";  //show All+
+	}+
 
+	if ( ! filterString.equalsIgnoreCase(".*") )+
 
+	{+
+		if(filterString.indexOf('*')>=0)+
 
+		{+
+			filterString = filterString.replaceAll("\\*","\\.\\*");+
+		}+
+		else+
+		{+
+			filterString = ".*" + filterString + ".*";+
+		}+
+		if(!filterString.endsWith("*") && !filterString.startsWith(".*") && (filterString.indexOf('*')> 0))+
+		{+
+			filterString = ".*" + filterString + ".*";+
+		}+
+	}+
+	return filterString;+
  +}+
  
+}+

I've put this code on "onFilter" action:

+public void onActionFiltrarTabla1(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )+
  +{+
    +//@@begin onActionFiltrarTabla1(ServerEvent)+
+	IWDMessageManager messageMgr = wdThis.wdGetAPI().getComponent().getMessageManager();+
+	wdContext.currentContextElement().getTableFilter().filter(wdEvent, wdContext.nodeRT_Tabla_RPs_Source(), wdContext.nodeRT_Tabla_RPs(), wdContext.nodeRT_Tabla_RPs_Filter());+
 
+	+
    +//@@end+
  +}+

I've put this code on wdDoModifyView:

+public static void wdDoModifyView(IPrivateP_RT_a2 wdThis, IPrivateP_RT_a2.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)+
  +{+
    +//@@begin wdDoModifyView+
+	IWDMessageManager messageMgr = wdThis.wdGetAPI().getComponent().getMessageManager();+
+	if (firstTime)+
+	{+
+		try{+
+			IWDTable table = (IWDTable) view.getElement("Table");+
+			wdContext.currentContextElement().setSorterRPs(new TableSorter(table, wdThis.wdGetOrdenarRPsAction(), null, new String[] { "Dis", "CM" ,  "nombreCM", "grupoCompras", "mes", "Distribuidora"}));+
+			wdContext.currentContextElement().setTableFilter(new TableFilter(table, wdThis.wdGetFiltrarTabla1Action()));+
+			IWDTable table1 = (IWDTable) view.getElement("Table1");+
+			wdContext.currentContextElement().setSorterScon(new TableSorter(table1, wdThis.wdGetOrdenarSconAction(), null, new String[] { "Nombre", "Tipo" , "Estado"}));+
+		}+
+		catch(Exception e){+
+			messageMgr.reportException(e.toString(),false);			+
+		}+
+	}+
    +//@@end+
  +}+

Any ideas? Please, I need help!!!!

Thanks in advance,

Arnau Rovira

SAP NetWeaver Consultant

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

hi,

this filter is only works for string type of attribute.

it means u should have all String type attributes in filter node.

hope it will work.

Regards

Trilochan

former_member201361
Active Contributor
0 Kudos

hi,

u have change the code in the domodify and the onActionFilter

in the wdDomodify method :"

if (firstTime ) {

IWDTable table = (IWDTable) view.getElement("Table");//id of the table given in the view layout.

wdContext.currentContextElement().setTableFilter(

new TableFilter(table, wdThis.wdGetOnFilterAction(),

wdContext.nodeSource(),new Hashtable()));

}

here source node is the exact copy of the Table node .

in the onActionFilter use this code:

wdContext.currentContextElement().getTableFilter().filter(wdContext.nodeSource(), wdContext.nodeListNode());

here the listNode is the Table Node .

hope ur problem get resolved

thanks and regards

fistae