Show TOC Start of Content Area

Background documentation Context Elements  Locate the document in its SAP Library structure

All controller contexts are constructed from a hierarchical arrangement of entities known as nodes and attributes. A context always has a parent node known as the root node.

This graphic is explained in the accompanying text

The context should be thought of as a type-safe collection that may in turn contain other type-safe collections.

Context Nodes

A context node is the main abstraction class used for runtime data storage within the Web Dynpro framework. Context nodes are arranged hierarchically and may have attributes or other nodes as children. All the child entities of a node are aggregated into a unit known as an element. A node is a collection of such elements in the same way that a table is a collection of rows.

The maximum and minimum number of elements permitted in a node collection is controlled by a pair of value collectively known as the node’s cardinality. All nodes contain an element collection, even if the maximum number of elements within the collection is limited to one.  

Note

All node names must be unique within the scope of a controller’s context.

The first node in any context is the root node. It is a standard node just like any other node in the context; however, its properties have been hard coded. The context root’s element collection may contain one, and only one element, and its singleton property has been hard coded to true.

The context root node may not be deleted neither can its properties be modified in any way.

Context Attributes

An attribute is a hierarchical entity within the context that is not permitted to have children. A context attribute cannot exist without being the child of some parent node – be it the context root node itself, or some other node.

All context attributes must have a declared data type. The data type may be one of the built-in Web Dynpro data types, or it may be a simple type defined in the Dictionary, or any other valid object type. All attribute names must be unique within the scope of their parent node.

Independent and Dependent Elements

The nodes or attributes that have the context root as their immediate parent are referred to as being independent. This is because their existence at runtime is independent of any coding written by the Web Dynpro developer. That is, all independent nodes or attributes will be instantiated automatically at runtime.

Note

Although it is technically possible to do so, it is not considered good Web Dynpro coding practice to create context attributes directly under the context root. SAP recommends that an independent node be used instead to contain the attribute(s).

However, nodes or attributes that have some other node as their parent are referred to as being dependent. This is because their existence is dependent upon coding written by the Web Dynpro developer. At runtime, it cannot necessarily be assumed that a particular dependent node instance exists. The Web Dynpro developer will need to write the appropriate code to instantiate such nodes.

End of Content Area