cancel
Showing results for 
Search instead for 
Did you mean: 

Help with Contexts and Mappings

Former Member
0 Kudos

Hi,

I am a little confused about the flow of data in a Web Dynpro application and have come across some seemingly conflicting statements:

This text is taken from SAP Help:

http://help.sap.com/saphelp_nw04/helpdata/en/15/2bc83edf72e16be10000000a114084/content.htm

"All global controller contexts (visible component-wide) can be linked to each other. <b>A mapping can also be defined from a view context element to an element of a global context</b>. Conversely, however, it is not possible to define a mapping to an element of a view context: <b>An element of a view context cannot be mapped to an element of a global context</b>. This is because the lifespan of the view context is generally shorter than that of the global controller context. "

Can anyone clear this up? Do the two statements in <b>bold</b> not directly contradict each other?

Thanks in advance,

Simon

Accepted Solutions (1)

Accepted Solutions (1)

arun_srinivasan
Contributor
0 Kudos

hi simon,

A ui element can be bound to context only if it belongs to the same view.The lifetime of a view context is too short and its visibility too restricted for it to be suitable for saving data used across several views.so we go far context belong to the controller of the web dynpro component.its life time is determined by life time of whole component.so we go for context mapping ie whenever an element of a view context is mapped to the corresponding element of the component context,the data is stored in the (global)component context,not in the (local)view context.

<b>we cannot map the component context of component controller context to a view context.

only view context is mapped to the corresponding element of the component context.</b>

hope this helps,

Regards,

Arun

Former Member
0 Kudos

Great.

So any data that is modified in the View is automatically transported to the Component Controllers Context so long as a mapping from the View to the Component Controller has been done?

In addition if you update values in the Component Controller Context that have been mapped to a view controller context, those updated values are automatically transported to the view context?

So data is transported in both directions from View to Controller and Controller to View Contexts? It is only the lifetime of the Component Controller and it's accessibility by other Views etc... that makes it the right place to store data?

Am I right?

Thanks,

Simon

Former Member
0 Kudos

hi

what you say is right.

Regards,

saravana

arun_srinivasan
Contributor
0 Kudos

hi

Exactly what u say is correct. Dont forgot to add component controller usage in the property tab of the view.

But any way mapping can be done only from view context to the component context.

Regards,

Arun

Answers (2)

Answers (2)

Former Member
0 Kudos

Simon,

Let me paraphrase this:

1. Context node of view controller may be mapped to context node of any custom controller / component controller. Here view controller context is a "consumer" of data originating from "global" controller.

2. It is impossible to map context nodes to context node of view controller. I.e. view controller context may not be used as a "provider" or "origin" of data for other controllers.

Hope now this is a bit clearer.

Valery Silaev

EPAM Systems

http://www.NetWeaverTeam.com

Former Member
0 Kudos

Hi Simon,

The second statement should be on the other way

<b>A mapping cannot be defined from a global controller context element to a view context element.</b>

Regards,

Praveen