cancel
Showing results for 
Search instead for 
Did you mean: 

call a view's method from another view

Former Member
0 Kudos

Hello,

I have a webdynpro application which is the typical table maintenance. The application has two views: one called searchview with a set of search fields, and the other one called resultview with an alv which shows the table registers, according to the search terms in the searchview.

In addition to this, resultview has also buttons for edit/visualization mode and a save button, and also processing logic to show a modal windows so when the user changes from edit to visualization a popup window appears asking to save the changes.

Now I want to modify the search button (in the view searchview) so when the user push this button if the alv has information on the screen and changes made, the system shows a popup asking to save the changes. My idea is to call the savechanges method in the resultview since I don't want to write the same code twice.

But my proble is that the search button is in the searchview, and the processing logic is in the resultview, so how can I call a method of a view from a different view? (how can I call resultview's method from searchview?)

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Maintain your context in the global component controller and map it to your local views. Maintain a method in the component controller of the webdynrpo component and you can access your method with the following syntax from across views:

call method wd_this->your_method().

Shruthi

Former Member
0 Kudos

Hi,

thanks for your answer but now think in the opposite way. If I'm in the component controller and I want to access data in the view, how can I do that?

Imagine for example I want to access to the view's context from one of the methods in the component controller, is this possible?

Regards

Edited by: Javier Arboleya Gomez on Nov 25, 2008 5:49 PM

Former Member
0 Kudos

Yes, define the context in component controller and then mapp it to view context. In the view controller you can set your context. Once the context is set and its' defined at component level. Then it can be accessed by any other view inside that component and also insdie the component(as in ur requirement)

Former Member
0 Kudos

Hi,

but what if I want to access the context of one of the views from the component controller, I´ve seen in the documentation about the possibility of creating in the component controller's context nodes as a copy of the nodes in the views. Is this the right way to access the context of a view from the component controller?

Regards,

Former Member
0 Kudos

Hi,

The point here is that once you map the context controllers node to the view,

you can access the node anywhere, either from the component controller or from the view. The data content would be the same once the mapping is done

whereever you access it from.

Shruthi

uday_gubbala2
Active Contributor
0 Kudos

Hi Javier,

Create the coding for the search method at component controller level instead of view level. This way the coding would be available for you across your views.

Regards,

Uday