Entering content frame

Procedure documentation Creating a Component Context and Binding It to the Model Locate the document in its SAP Library structure

Each Web Dynpro component is supplied with a corresponding Component Controller. This controller is responsible for the acquisition of the data required by the QuickCarRentalService Web service for the car reservation. Accordingly, it must be able to depict the corresponding input and output structures of the CarRental model. In order to create a connection between the Component Controller and the model created in the previous step, you will bind the context of the Component Controller to the created model structure using the Data Modeler.

The following figure explains how the structure of the context tree generally results from the model classes and their relations to one another – on the basis of the model binding. 

This graphic is explained in the accompanying text

 

Prerequisites

This graphic is explained in the accompanying text

The structure of your project TutWD_CarRental_Init is currently displayed in the Web Dynpro Explorer.

Procedure

Adding a Model to the Web Dynpro Component

...

       1.      Open the Data Modeler through the context menu entry This graphic is explained in the accompanying text Open Data Modeler of the node CarRentalComp.

       2.      In the toolbar on the left, choose the This graphic is explained in the accompanying text Add an existing model to the component icon.

The icon will turn gray.

       3.      Place the cursor on the This graphic is explained in the accompanying text Used Models area and left-click.

       4.      Select the CarRentalModel checkbox and confirm by pressing OK.

The structure of the Web Dynpro component CarRentalComp will look like this in the Data Modeler:

This graphic is explained in the accompanying text

Binding the Component Controller Context to the Web Service

In the Data Modeler, you can easily declare the connection between the context of the Component Controller and the CarRentalModel you have created.

 

       1.      In the Data Modeler toolbar, choose the  This graphic is explained in the accompanying text Create a data link icon.

       2.      Draw a line beginning at Component Controller and ending at CarRentalModel. The Model Binding Wizard starts automatically.

       3.      Using Drag & Drop, drag the node of the model class Request_QuickCarRentalServiceViDocument_saveBooking in the CarRentalModel to the root node of the component controller context, and drop it.

This graphic is explained in the accompanying text

       4.      In the following input dialog, select all the model nodes and model attributes.

This graphic is explained in the accompanying text

In general, it is appropriate to keep the similarity of names between the model classes and parameters and the corresponding context nodes or context attributes. However, the root node for the model is derived directly from the model main class Request_QuickCarRentalServiceViDocument_saveBooking with the same name: . In this case, it is better to take a shorter name, such as SaveBooking.

       5.      For this purpose, edit the new name SaveBooking in the first line under the table column Name, and then press Enter.

This graphic is explained in the accompanying text

If you now expand the context tree in the following dialog boxes, the declared model link between the Component Context node and the model classes, including their relations, will be displayed graphically through link lines. The relations are expanded in the model tree (right window) in the associated classes. 

This graphic is explained in the accompanying text

       6.      Close the Model Binding Wizard by choosing Finish.

Result

From the model definition, you have now defined a structure of context model elements (consisting of model nodes and model attributes) in the component controller CarRentalComponent, and you have also bound these to the corresponding model classes.

 

Now continue with the section…

Map Component Context onto View Contorller

 

 

Leaving content frame