Tuesday, June 10, 2008

Web Dynpro ABAP Context Mapping

Data stored in the context of the component controller can be used within a view if you link the node of the view context to the corresponding context node of the component controller. This procedure is called “defining a mapping”. For further information, refer to the chapter Data Binding and Mapping in the architecture manual for Web Dynpro.

The following graphic illustrates the principle of the procedure:

This graphic is explained in the accompanying text

The context of View 1 of the example in the graphic contains two nodes below the root node:

The node Node 1 is mapped to the node of component controller context of the same name. This means that the structure within the node matches the structure within the node of the component controller or the structure is contained in it. At any time, the values of all attributes contained in Node 1 are identical to the corresponding attributes of the component controller. If the attribute value of the view context changes at runtime, - for example, due to a user input - , the change is directly passed to the component controller.

This graphic is explained in the accompanying text The data is not passed to only one location which is the context to which is mapped.

The node Local Node View 1, however, is exclusively known within the view controller, and only the methods of the View 1 have access to the values of the node attributes.

For a description of a simple example for the creation of a flight list structure in the table of the user interface using a database table, refer to chapter Action Event Handlers. This example is used again to illustrate the principle of mapping:

This graphic is explained in the accompanying text Extending the Flight List Application

The application described in the previous chapter uses the layout of your view for the graphical representation at the user interface and the corresponding view controller for retrieving and storing the involved data. The context and the methods of a view controller are only locally visible - that is, within the controller. Therefore, other views of the same component cannot use these contents. To allow them the use of the contents, the data and the methods to be retrieved are moved to the component controller. The following graphic shows the new context structure of the component:

This graphic is explained in the accompanying text

Once both nodes with their attributes are created in the context of the component controller, the corresponding nodes of the view context can be mapped to the two new nodes. For a detailed description of the procedure and information on restrictions, refer to the tools manual in chapter Defining Mapping. When the attribute value in one of the two contexts changes, the change automatically takes effect in both contexts. Now, you can also define mapping to the nodes of the component controller context for the corresponding context nodes of an optional second view. The second view context will also adopt all changes within the “mapping network”.

In the next step of this extended example, the data retrieval for the flight table is also moved to the component controller. For a description of the required basic steps, refer to the next chapter Cross-Controller Method Call.

For more information on mapping, refer to the architecture manual for Web Dynpro.

Defining Mapping

There are various ways in which you can define mapping for the context of a view controller. However, you always use the Context tab of the corresponding view. For more information, refer to the tools manual in chapter Defining Mapping.

No comments:

Archive