cancel
Showing results for 
Search instead for 
Did you mean: 

Answer

Former Member
0 Kudos

Hi,

.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Will these types of posts ever stop? Why don't you go out and learn it for yourself instead of trying to lie your way into a job. Don't you think you'll be found out eventually?

Former Member
0 Kudos

Hi Joe,

<b>Context :</b>

Context is the simply data container, context in which the used data are stored hierarchically. This context is empty when a new component is created.

The data used in the component or in the view are stored in the context. Read-write access to this data is available using the controllers as a starting point.

<b>Attribute :</b>

Context contains the attribute.

<b>Lead Selection</b>

The lead selection is extremely important within the nested context structure. The lead selection defines which element of the context is ultimately accessed at runtime. This behavior is easiest to explain using an example:

The UI of the example application contains a TextView element that should display the name of the customer at runtime. Without a clear regulation of the selection path for the context structure, all values of the Name attribute would be equal and it would not be possibly to correctly display the name in the TextView element. For this reason, one element of the set of possible elements for the Customer node must be clearly designated. This is achieved by initializing lead selection. The automatic initialization of the lead selection always designates the first element of a node. For the above example, this means the following:

The lead selection is always automatically on the first element of the Vehicle node (on the node with the data for the red car). Analog to this, the lead selection is on the first element of the Customer subnode (on the element that contains the data for David Grecco).

This special way of designating elements can be depicted as follows in the runtime context.

Only if the lead selection falls on another element of the Vehicle node (as a result of user action or a program step in a method) is the corresponding element of this Customer subnode displayed in the UI element. If the lead selection is set on the second element of the Vehicle node, the customer Pierre Dubois is displayed. The lead selection of the Customer node can be varied at runtime in this way. This enables the names of all available customers to be displayed one after the other in the UI.

Automatic/Manual Initialization

Lead selection is initialized automatically for each newly created context node.

&#9679; Using the preset automatic initialization of lead selection:

In this case, the first element of a node is always assigned the lead selection property.

&#9679; Manual initialization of lead selection:

If automatic initialization was deactivated, the lead selection can be programmed manually. In this case it is possible to assign this property to an element other than the first element of a node (for example, using an index).

<b>The 'Singleton' Property</b>

The singleton property of the Customer context node specifies that the elements of this node are only instantiated for one of the three vehicles at runtime – that is, the element that bears the lead selection. If lead selection was initialized automatically, this is the first element of the Vehicle node. In this case, this is element 1, which contains the data on the red car.

If each customer has multiple addresses, it may be necessary to include a child node for the addresses below the Customer child node. In this manner, the data content of a root node can rapidly become very large if, at runtime, all customers are displayed with all their addresses for each vehicle of the car rental company. To limit the content of a context node at runtime, the context node can be assigned the 'singleton' property. As a result, the elements of the relevant node are instantiated for only one element of the parent node. In other words:

Unlike the cardinality of a node, which describes the number of possible elements within the node, the 'singleton' property determines whether or not these elements are set for all elements of the parent node (non-singleton) or for exactly one element of the parent node (singleton).

If the Customer node in our example is set as a 'singleton', the context will be as follows at runtime:

The elements of the Customer child node are only available to one element of the Vehicle parent node and not to all other elements. However, if you want to instantiate the elements of the Customer node for all vehicles, you must set the singleton property for the Customer node to 'false'.

Since the root node of a context is only ever instantiated once, every node directly below the root node (in our example, Vehicle) is always automatically a singleton node.

Regards,

Vijay

Former Member
0 Kudos

VIJAY,

these types of questions are not welcome in SDN forums, so answering these questions just let other people post more and more of these questions.

Please do not feed the 'stupid' trolls

Cheers,

Sascha

SergioFerrari
Active Contributor
0 Kudos

...and why not also a cup of coffee and a fresh newspaper.

We are tired of this kind of messages...

Former Member
0 Kudos

Hi,

read the <a href="http://help.sap.com/saphelp_nw70/helpdata/en/77/3545415ea6f523e10000000a155106/frameset.htm">documentation</a> and take a look at the <a href="https://wiki.sdn.sap.com/wiki/display/WDABAP/Main">SDN WDA Wiki</a>, then you can answer the questions on your own.

Regards, Heidi