cancel
Showing results for 
Search instead for 
Did you mean: 

Sharing the context between views.

Former Member
0 Kudos

Hi ,

I have two views in my web dynpro component.The main view and a second view.

An event gets fired in the second view which creates a dynamic context in the second view.

I use the dynamic context for generating an editable ALV in my second view.

The 'save' function for saving the values entered in the editable ALV is in my main view.

I need to access the context built in the second view to capture the entered values and store it in the database.

Can someone please suggest a way to access the context in the second view of my application.

I know that data sharing is not possible between views if the context is not shared in the component controller.

Regards,

Newton.

Accepted Solutions (1)

Accepted Solutions (1)

abhimanyu_lagishetti7
Active Contributor
0 Kudos

You could have created the context in COMPONENTCONTROLLER instead second view, however

you can create an event in component controller and fire it in first view onSave handler and subscribe it in second view.

TO use events follow this link

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/abap/working%20wit...

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks Guys... Your suggestions helped me solve the problem.

Former Member
0 Kudos

Moreover there are multiple ways of sharing data between two views for ex .

1) Via Assistance classes

2) By defining attributes at window and component controller level and access the static attributes from two views

Regards

Anurag Chopra

Former Member
0 Kudos

Hello Newton,

You could definately share the context between two views via component controller's context(Mapping)

Since you have the data in the second view and you need to capture the data in the same view, I would suggest you not to share the data with the main view, you only have to listen to the event fired in the main view when the save button is pressed.

So could rather fire a user defined event of the window in which you have included two views and you could access the window controller to fire and listen the event and you need to access window controller to fire(from main view) and listen (in the second view)

Regards

Anurag chopra