Show TOC Start of Content Area

Procedure documentation Creating the Context  Locate the document in its SAP Library structure

In the procedure below, you first add the newly created model to the list of used models of your Web Dynpro application. Then you will create the context of the view by means of binding the view controller context to the corresponding model structure.

 

Recommendation

The following procedure does not reflect the recommended way of mapping between view and the model. It is technically possible for a view context to access the model, but this would not be good design style. To use the MVC paradigms in a consistent manner, you require the component controller (or a custom controller) as a binding link between the view and the model. This means, you should better implement most application code in the component controller. The view controller then just delegates to the component controller. Therefore, it is recommended to perform a binding from the component controller context to the EJB Model. In the second step, the view context is mapped to the component context.

The following procedure is aimed to keep the description short!

 

Procedure

Adding a Model to the Web Dynpro Component

..

       1.      Expand the project structure ComponentsStudsWDCompUsed Models.

       2.      In the context menu of the Used Models node, choose Add and select the Model you have created in the last step.

       3.      Confirm with OK.

Binding the View Context to the EJB Model

       4.      Select the view node in the project structure via ComponentsStudsWDCompViews<view node> and choose OpenView Editor in the context menu.

       5.      Select the Context tab.

       6.      Select the root node of the context and choose NewNodeModel Binding in the context menu. Choose Next.

       7.      Choose Request_StudsLocal_getStudent model class. Choose Next.

This graphic is explained in the accompanying text

       8.      Select all and choose Finish.

This graphic is explained in the accompanying text

The Requestmodel class should be mandatory for the context. This forces the Web Dynpro context to implicitly create its instance (with all of its mandatory relations in depth).

       9.      Navigate to Properties page of the Request_StudsLocal_getStudent context node and change the value of the property Collection Cardinality to 1..1.

This graphic is explained in the accompanying text This graphic is explained in the accompanying text

 

Result

You have created the necessary view context structure and also bound the context nodes to the corresponding model classes. You are now in a position to bind UI elements such as input fields to the corresponding view context elements.

 

Next Step

Designing the View Layout

 

 

 

 

End of Content Area