Skip to Content
Author's profile photo Former Member

Using Flex DateField and DataGrid elements in WebDynpro Java with FlashIslands – Part 2

Continuing from where we left on {code:html}Using Flex DateField and DataGrid elements in WebDynpro Java with FlashIslands – Part 1{code} , in this part of the blog, I will explain the webdynpro project needed for our application to work.* *

 

I will explain the Webdynpro part considering that you are already familiar with basic webdynpro java concepts. If you are not, it would be a good idea to try out some of the webdynpro tutorials {code:html}Tutorials & Samples for Web Dynpro Java{code}. Even though these are for Netweaver 7.0, you should get a hang of things, and will easily be able to adapt to NWCE 7.1

This is what I am doing in my webdynpro project:

1. I have created a model for a custom BAPI. This BAPI takes fromDate, toDate and username as input, and returns the records corresponding to the selection. I added this model as a Used Model.

 

2. I created a Custom controller to call this model. I used Apply template -> service controller and added the necessary input and output parameters.

 

3. Mapped the context of Component controller to the custom controller, which in turn is mapped to the model.

 

4. Mapped the context of the view controller to the component controller.

 

5. In the component controller, I created a node “SearchParams” with Collection Cardinality 1..1, and within this I have added 3 attributes: fromDate (of Type date), toDate (of Type date) and userName (of Type string). This will hold the value we enter in the runtime.

 

6. Mapped this node to both the custom controller and view controller. This is what my component looks like:

 

This is what the Context for all the controllers looks like:

Custom Controller:

 

Component Controller:

 

View Controller:

 

7. I create a method “executeCUSTfuie” in the Component controller to call the execute method in Custom controller.

*public* *void* executeCUSTfuie( )  {     //@@begin executeCUSTfuie()             wdThis.wdGetCUSTfuieController().executeZ_Get_User_Reqs_Input();     //@@end   } 8. This is what the execute method in the Custom Controller looks like: *public* *void* executeZ_Get_User_Reqs_Input( )  {     //@@begin executeZ_Get_User_Reqs_Input()     //$$begin Service Controller(-1052249833)               Z_Get_User_Reqs_Input input = *new* Z_Get_User_Reqs_Input();               wdContext.nodeZ_Get_User_Reqs_Input().bind(input);               input.setUser(wdContext.nodeSearchParams().currentSearchParamsElement().getUserName().toUpperCase());               input.setDate_From(wdContext.nodeSearchParams().currentSearchParamsElement().getFromDate());               input.setDate_To(wdContext.nodeSearchParams().currentSearchParamsElement().getToDate()); *try*     {           input.execute();       wdContext.nodeOutput().invalidate();     } *catch*(Exception e)  *public* *void* wdDoModifyView(com.sap.tc.webdynpro.progmodel.api.IWDView view, *boolean* firstTime)   {     //@@begin wdDoModifyView *if* (firstTime)             {                      IWDGACDataSource ds = (IWDGACDataSource)view.getElement(“records”);                      java.util.Iterator i = wdContext.nodeRequisitions().getNodeInfo().iterateAttributes(); *while* (i.hasNext())                      {                                IWDGACProperty prop = view.createElement(IWDGACProperty.*class*);                                IWDAttributeInfo attrInfo = (IWDAttributeInfo) i.next();                                String s = attrInfo.getName();                                prop.bindValue(attrInfo);                                prop.setName(s);                                ds.addProperty(prop);                      }             }     //@@end   } Insert Event Id: getrecords Name: getrecords onAction: GetRecords   When you create an event, you need to assign it to an Action. In here I have created a new action “GetRecords”. This has the following code: *public* *void* onActionGetRecords(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )   {     //@@begin onActionGetRecords(ServerEvent)             wdThis.wdGetCOMPfuieController().executeCUSTfuie();     //@@end   } *Now before we forget:*                                                 dataProvider=”{records}”>*Deploy and Run:* Finally create a WebDynpro Application for your WebDynpro component, then Deploy and Run your WebDynpro application.   I enter the from date, to date and username, click on Get Records button. The data from the backend BAPI is correctly displayed in the Flex screen.

Assigned Tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Siarhei Pisarenka
      Siarhei Pisarenka
      I think that the blog is great from a technical point of view, but conceptually looks very strange.

      The main conceptual question is "Why do we need to implement the simple UI with Flex and embed it into WebDynpro?" Because we can easily implement the simple page with native WebDynpro UI controls without Flex. And this will be much more easier and simpler for implementation. And this will be more correct architecturally. And there is nothing here that is not supported by WebDynpro, just simplest search page with table.

      In the blog below the question is already appeared. Please, look at it:
      The specified item was not found.

      Thanks, Siarhei

      Author's profile photo Former Member
      Former Member
      Thanks for your comments Siarhei!

      I totally agree with the fact that the same thing can be done in WebDynpro in half an hour, whereas doing this in flex just adds up more time and effort.

      But I have had requests from customers who are more and more keen to improve their user experience (even in these tough times) and are exposed to the rich UIs provided by flex and silverlight. And I believe the choice is for the customer to make considering all the pros and cons - to do it quickly in webdynpro or go the RIA way (additional cost, maintenance, skills et..).

      That apart, I found very few flashIsland examples for WebDynpro Java.