3 August 2009
This tutorial is written for experienced Adobe Flex developers without previous SAP Netweaver ABAP experience.
To complete this tutorial, you first need to install the SAP NetWeaver 7.01 ABAP trial version by following the steps in the "Download the SAP installer and login" section of the tutorial, Embedding an Adobe Rich Island into an SAP Web Dynpro application.
All
In Parts 1 through 6, SAP developers used Flex Builder to create the wagon assembly line shown in Figure 1. This is an interactive application that counts down the time until the assembly line shuts down due to lack of inventory. The inventory is reflected in three places: the quantity field of the Flex framework DataGrid control at the top of the screen, the numeric display in the colored bins, and the color of the bins which turn green, yellow, or red depending on the defined thresholds. If you change the quantity in either the DataGrid control or the colored bins, the application will respond accordingly by updating the clock shutdown time and determining bin color.
In this part, Flex developers will install SAP NetWeaver 7.01 ABAP, create the Web Dynpro component, create an SAP UI table element to replace the DataGrid control, populate it with data, build a layout view and create attributes that will be used in the Rich Island. Overall, this is an opportunity for Flex developers to have a quick overview of the SAP technology.
Figure 2 shows the finished Web Dynpro application that you create in this tutorial series. It includes the Flex wagon assembly line with the clock and colored bins that SAP developers learned to create in Parts 1 through 6. It also includes the SAP table UI control that Flex developers learn to create in this tutorial. In Parts 8 and 9, you will integrate the SAP Web Dynpro application with the Flex application using Adobe Rich Islands technology.
You can watch the video to see the final application in action:
Note: To complete this tutorial, you first need to install the SAP NetWeaver 7.01 ABAP trial version by following the steps in the "Download the SAP installer and login"section of the tutorial, Embedding an Adobe Rich Island into an SAP Web Dynpro application.
In this section, you will create the skeleton of the Web Dynpro component, naming the views and modeling the data that will be displayed both in the Web Dynpro Table UI element and the Rich Island component.
Ensure that you are viewing the Local Objects directory shown in Figure 3.
You must start a Web DynPro component with Z or Y.
v_main is the master view of the Web Dynpro component.
In this section, you will create a context node with attributes and create a method that populates the context node with data. The context nodes and attributes visually create the UI table element that holds the data. The method will populate the UI table element with data.
The context stores data used in the component or view. The data is managed in a hierarchical structure where each context has a root node and the data fields or attributes are stored in a tree structure. You create the tree structure according to the structure of your application starting with the context then adding attributes or nodes with attributes.
The Component Controller is the master controller for a Web Dynpro component and is automatically created when you made the Z_SHOP_FLOOR_BINS component. It is superior to all other controllers and controls the behavior of Z_SHOP_FLOOR_BINS.
If the Node is not selectable, use the Display<->Change button from the top menu. (The button with the pencil on it.)
The cardinality defines how many elements of this node areavailable at runtime. You are allowing a varying number of elements to beinstantiated since there is a possibility that the table could be empty—thatis, if all the bins are empty of inventory.
An attribute is a characteristic of a node in the same way a component has properties.
The attributes you are creating—BINTITLE, BINQUANTITY, and BINPARTS—will be populated with the inventory data for each of the wagon pieces. As shown earlier, these values are currently stored in the Flex DataGrid control. You are creating the data here to bind to the SAP UI table element, and eventually, the Rich Island.
The letter I represents Integer.
You are now adding code to the WDDOINIT method to populate the table UI element with data because this method is automatically called at runtime.
WDDOINIT method of the Component Controller:method WDDOINIT .
DATA lo_nd_shop_floor_data TYPE REF
TO if_wd_context_node.
DATA lt_shop_floor_data TYPE
wd_this->elements_shop_floor_data.
lo_nd_shop_floor_data =
wd_context->get_child_node( name = wd_this->wdctx_shop_floor_data ).
FIELD-SYMBOLS <wa_data> LIKE
LINE OF lt_shop_floor_data.
APPEND INITIAL LINE TO
lt_shop_floor_data ASSIGNING <wa_data>.
<wa_data>-bintitle = 'TUBS'.
<wa_data>-binquantity = 120.
<wa_data>-binparts = 1.
APPEND INITIAL LINE TO
lt_shop_floor_data ASSIGNING <wa_data>.
<wa_data>-bintitle = 'AXELS'.
<wa_data>-binquantity = 190.
<wa_data>-binparts = 2.
APPEND INITIAL LINE TO
lt_shop_floor_data ASSIGNING <wa_data>.
<wa_data>-bintitle = 'WHEELS'.
<wa_data>-binquantity = 320.
<wa_data>-binparts = 4.
APPEND INITIAL LINE TO
lt_shop_floor_data ASSIGNING <wa_data>.
<wa_data>-bintitle = 'HANDLES'.
<wa_data>-binquantity = 61.
<wa_data>-binparts = 1.
APPEND INITIAL LINE TO
lt_shop_floor_data ASSIGNING <wa_data>.
<wa_data>-bintitle = 'BOXES'.
<wa_data>-binquantity = 400.
<wa_data>-binparts = 1.
*
lo_nd_shop_floor_data->bind_table(
new_items = lt_shop_floor_data set_initial_elements = abap_true ).
endmethod.
Note: This is ABAP code that will populate the SAP table UI element and be used by the eventual Rich Island. ABAP is one of the programming languages used for Web Dynpro application development. Teaching you how to program in ABAP is beyond the scope of this project. Check out the SAP Developer's Network for more information.
In this section, you build a Web Dynpro view which is the layout of the application and includes the SAP table UI element that will display the data you created in the previous section.
You will copy the data in the Component Controller to the view because the Component Controller has no visual interface and is not able to present any data directly to the user. You present the data through the view. This is similar to having an ArrayCollection and assigning it to the dataProvider property of a DataGrid control.
Each view starts with an empty ROOTUIELEMENTCONTAINER where all UI elements are placed. This is similar to a container component in Flex.
A binding in the SAP programming language is the same as in Flex where any data changes are monitored and updated where the element is used.
You are associating SHOP_FLOOR_DATA with the table UI element. Similar to providing the data for a DataGrid control in Flex.
This will allow the field in the table UI element to accept data. This is the same as a TextInput control in Flex or using the editable property in a DataGrid control. Otherwise the value is a TextView which only displays the data.
This provides a header name for column in the table UI element.
In this section, you will create the view that will displaythe Adobe Rich Island component for the wagon assembly line.
Note: Remember all UI elements are placed in the ROOTUIELEMENTCONTAINER.The Flash Island UI element cannot be placed directly in the UI elementhierarchy. It must always be a node UI element of a View. Therefore, in V_MAIN,you can only reserve a place holder for the Flash Island view using aVIEWCONTAINERUIELEMENT. This is similar to placing controls in a containercomponent in Flex.
If prompted to save V_Main, select Yes.
If you don't see the new view, use the Save button at the top menu to save the changes.
The FlashIsland UI element must be the ROOT UI Element.Therefore, Web Dynpro has a feature that lets you swap the UI Element of theROOTUIELEMENTCONTAINER.
In this section, you will add three more attributes of data in the Web Dynpro component. You will use these attributes in later tutorials to define the threshholds for the bin color changes and to determine the speed of wagon creation.
You will be adding more data to the context. This is the same context you created for SHOP_FLOOR_DATA. Remember the context stores data for the component or the view.
You have set the REDWARNING attribute value to zero. With this setting you are declaring that you would like the colored inventory bin to turn red when there are 0 wagons left to build.
You have set the YELLOWWARNING attribute to a default value of 50. With this setting, you are declaring that you would like inventory bins to turn yellow when there are 50 wagons left to build.
You have set the PRODUCTION attribute to 6. This value declares that one wagon is assembled every 6 seconds.
You are creating runtime objects that include the changes you made so your program has access to it. This is similar to recompiling an application in Flex to see the changes made.
In this tutorial you created the Web Dynpro component, defined data, created a view layout with a UI table element, and created a view that will eventually hold the Rich Island that was explained in Parts 1 through 6 using Flex Builder.
In Part 8, you will modify the Flex application to become a Rich Island for the Web Dynpro application.
For your reference, here are all the parts in this series: