cancel
Showing results for 
Search instead for 
Did you mean: 

Fill a table with data coming from an RFC

Former Member
0 Kudos

Hello everyone:

I've followed the Weblog "How many lines of java code did i write for a simple Web Dynpro?"

/people/durairaj.athavanraja/blog/2004/10/17/how-many-lines-of-java-code-did-i-write-for-a-simple-web-dynpro

I've called an RFC and created a table with data coming from it (which is also a table). My question is, if in this table there's a field named "UserType" there are two possible values for this field:

"userA"

"userB"

How can I get the table only show me the "userA" registers? The RFC does return all of the users, but when filling the table, can I put an if-else somewhere on my code?

Thanks a lot

Alejandro

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Table UI Element provides Filter action which can be used on any column. In your case we need to have usertype as a column and then have Filter data to display the values based on the usertype.

refer: http://help.sap.com/saphelp_nw04/helpdata/en/0e/23b3c8b0a238439f664f73a04e6332/frameset.htm

Hope that helps.

Regards,

S.Divakar

Former Member
0 Kudos

Hello Divakar:

Thanks for your answer. As I see, I should use the onFilter Action on my Table right? Will this also help me in case that I need an slightly more complex filtering, for example, if a column has values and I only want to display the registers which those values start with a substring?

Thanks a lot

Alejandro

Former Member
0 Kudos

Hi,

The Filter value is of type String so you should have any issues.

refer:

http://help.sap.com/saphelp_nw04/helpdata/en/0e/23b3c8b0a238439f664f73a04e6332/frameset.htm

Hope that helps.

Regards,

S.Divakar

Former Member
0 Kudos

Hi Alejandro,

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

We would have to implement the action onFilter in the controller implementation. Ideally, we fill the data retrieved from backend into a List (java.util.List) (this could be done on init of view) and then subset the list after meeting the criteria in the action handler(say

onActionFilterData(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent).

Having done this, you may bind the output list back to the node (shown in table)

Regards,

Chaitanya

Former Member
0 Kudos

Hello:

When I apply the "Table" template as a result of the RFC, the table is filled. I suppose a for loop is somewhere hidden where I can override the normal fill and set an if-else clause, is that right?

I don't mean the user can choose which filter to apply, but that only the correct registers are shown, no choose for the user

Thanks!

Former Member
0 Kudos

Alejandro,

You are right, if you intend to see only the filtered results, you may have to add the code which iterates over the node and checks the substring condition for each element.

This could be written in the init method of view controller. If you are unsure about how to do this, please let me know your email address so that I could email you the project which does it.

Regards,

Chaitanya

Former Member
0 Kudos

Hi:

try:

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

regards