The context for a controller entity is created by the Web Dynpro Generator by default. This applies to all controller types of a Web Dynpro application – that is, component controllers, view controllers, and custom controllers. The Web Dynpro tool Controller/Context Editor provides support for the creation of a context structure through the definition of nodes and attributes. You carry out the structure definition separately for every controller; the procedure for creating the structure tree is the same for all controller types.
To create the context structure, the edit mode for the component, the controller, or the view and thus the Controller/Context Editor must be started. Beforehand, you must also reference the Web Dynpro entities to the Web Dynpro component whose data you want to transfer to the context nodes and context attributes. To do so, proceed as described under Referencing a Custom Controller, Referencing a Model, or Referencing a Component. An overview of all Web Dynpro entities known to the current component is then displayed in the right screen area.
To define a node for the root node Context, choose the relevant context menu entry, which is different for each node type. You define the corresponding attributes by choosing the appropriate context menu entry for an existing node.
1. Place the cursor on the root node Context and choose the context menu entry New.
2. Then choose one of the context menu entries to create the node or attribute, depending on the required node or attribute type. Enter a name and choose Finish.
You should keep the name for the context node as short as possible. The path name of the URL generated for the application cannot exceed 255 characters.
3. To create the individual attributes for a node, place the cursor on the node and choose the appropriate context menu entry to create the attributes.
4. Repeat steps 1 and 4 until you have completed the context tree.
5. Save the structure by choosing Save all Metadata.
The context tree can consist of several elements; there is no limit to the number of nodes and attributes. The following conditions apply to the creation of context structures:
· A context structure can contain any number of nodes.
· A context node can contain any number of attributes.
· A context structure can contain both model nodes and value nodes with their respective attributes.
· You can define a value attribute for a model node.
· You cannot define a model attribute for a value node.
· A node can contain subnodes.
· It is possible to create an attribute on the first level, parallel to the nodes and directly below the root node Context.
· You can define recursion nodes for each node by choosing the relevant context menu entry for the node.
The defined context tree is displayed in the Controller Context Editor with its substructure. You can display all elements of a structure by choosing Expand Subtree from the context menu for the main node Context or a subnode.
To delete a node or attribute, choose the context menu entry Delete for the relevant node or attribute in the context tree.