Start of Content Area

Background documentation Recursive Context Nodes Locate the document in its SAP Library structure

Web Dynpro provides what are called recursive context nodes to represent recursive data structures in a controller context.

The following example shows a file system consisting of directories and documents in the context.

 

This graphic is explained in the accompanying text

A file system consists of folders and documents. Folders can be additional folders or can contain several documents. If you think of a file system as a tree, then folders represent nodes and documents in it.

This graphic is explained in the accompanying text

If you transfer the file system’s schema to a controller context, then the top level begins with a context node called Folders with cardinality 0..n. This folders node can contain a node collection of as many node elements of type Folder as you like.

In addition to a context attribute for the folder name, the Folders node also contains a dependent node called Documents for the documents contained in the folder. This node also has cardinality 0..n and also has the property Non-Singleton=true, that is, each node element of type Folders receives its own instance of the Document node at runtime.

Folders can contain additional folders. This recursive relation can be defined in the context by adding what is called a recursive context node in the Folders node. This node only has two properties. On the one hand, its name (here Child) and on the other, property repeatedNode. This property defines the context node to be repeated, the Folders node in the following example.

This graphic is explained in the accompanying text

At runtime, each node element of type Folders can contain separate instances of the Folders and Documents nodes. Recursive context nodes always exist as non-singleton nodes at runtime, that is, each node element of type Folders has its own object instances of the recursive child node. Only in this way can the contents of several nodes on the same level can be displayed in the tree interface element.

  1. At the top level there is a node element of type Folders. This contains the recursive child node Folders as well as the second node Documents. Both nodes contain two node elements of the respective type.
  2. This folder (represented by the Folders node) contains only one node element (a folder). The Documents node is empty.
  3. In this case, although the node element of type Folders contains two elements (documents) in the Documents node, the Folders child node of type Non-singleton remains empty.
  4. This Folders node element contains two empty child nodes Folders and Documents. In the directory tree, this corresponds to a completely empty directory without subdirectories and without documents.

     

A recursive context node is not defined by setting a relation in the node to itself. Instead of such a property, a special child node is added, which only has two properties:

1.       name: Name of the recursive context node. As is the case with usual context nodes, the names of recursive nodes have to be unique within a controller context.

2.       repeatedNode: Address of the context node to be repeated. The address of this node is automatically entered by the Web Dynpro tools in the property field of the context perspective view.

Recursive context nodes are implicitly of type non-singleton.

  

  

 

End of Content Area