Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

I have been trying my luck at WebDynpro and moving from ABAP to Java is definitely not a piece of cake. Things which were in-built in ABAP are much difficult to display in Java. Many of the users who do a paradigm shift from SAP R/3 Client to Web Client; usually seek a similar User Interface. Like all aspects in life, anything less is simply unacceptable.

I do have a big list to explore, and I started out with simple stuff. I am sure there are many guys out there who find this weblog a little too trivial, but it took me quite a few days to figure out.

Regular Expressions



From these links and the examples quoted, in case you are unaware of Regular Expressions, you will come to know how much more powerful it is than the regular approach we carry out in ABAP world.

Aim

To have filter functionality in table in WebDynpro

Pre-requisites

Basic Java knowledge, WebDynpro Terminology, able to setup JCo connection successfully, able to fetch data from R/3 and have gone through the tutorials at SDN

Approach

The brief steps to have a filter are:

  • First, we should be in a position to successfully extract data from R/3
  • Don’t do a context mapping of view context to component/custom controller used to fetch data i.e. for task a) you have created a component/custom controller and you have bound it with the model. In this case don’t do a context mapping of this component/custom controller to view context. We will instead source data from component/custom controller and put it in the view context.
  • Create a view context having a value node of cardinality 1...n and with relevant value attributes. In this example, they are Username, Firstname, Fullname, Lastname
  • In the filter process, the value node is completely refreshed and then based on the filter criteria, data is sourced from component/custom controller and put in the view context

Note

Only the filter functionality is explained below, it is assumed that table is already created.

Solution

Step 1

First a method has to be created in the view. The method is FILTER and it is associated with the event onFilter of the UI Element MyFilterTable



Step 2

Create a context value attribute FILTER_USERNAME. This value attribute will be associated (bound) with the filter value that you enter in the screen.

Step 3

Bind the context value attribute FILTER_USERNAME to the relevant column of the table. In this case it is bound with Username.

Step 4



Result

Input

Display all results which start with 200


Output

Other Results

Display results where usernames contain only letters. In this case the filter criteria is [A-Z,a-z].*

12 Comments