on 08-08-2007 10:46 AM
Hi,All,
I want to get an view's controller in the method of a component controller,how to do that?
Thanks a lot
Hi Ray,
As far as I know, that is not possible as it violates MVC Architecture. However, why do you need to access view controller in component controller? I have never come across such a situtation. You can always do it the other way round (View Controller accessing Component Controller).
Regards,
Neha
<i><b>PS:Reward if helpful</b></i>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,Neha Agrawal,
Thanks your response.
I have a method in the component controller which is exposed to the outside.This method will pop up a window which contains the
specified view.
While I have to catch event happened on that window,so I have to get the view's controller for subscribing the event,so this is the problem.....
hi,
you should create an event in your component controller,
and fire it from your action in the view,
than you catch the event in the component controller with a specified event handler
you can fire the event by pressing the magic wand button
and than take method call in used component take the
component controller and in the method name fire_eventname
have a look at <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/e0/14faee8ee4534989063a2588bc5754/frameset.htm">events</a>
grtz,
Koen
Hi,Koen,
Thanks your reply.
I think your idea is very good,the fact is that I could not register the event to compent in the view(for this pop up window,the component which I want to fire the event are ok button and cancel button,but they are invisible by pop-up framework and I have to subscribe the event for them in program,so this is why I have to use view controller to register event for them dynamiclly)
Hi
Just open the window in the controller and subscription you can do in the view itself
You can do this from the following code
Put this code in the view of the popup.
DATA:
L_API TYPE REF TO IF_WD_VIEW_CONTROLLER,
L_WINDOW_CTLR TYPE REF TO IF_WD_WINDOW_CONTROLLER,
L_POPUP TYPE REF TO IF_WD_WINDOW,
L_POPUP1 TYPE REF TO IF_WD_WINDOW.
L_API = WD_THIS->WD_GET_API( ).
L_WINDOW_CTLR = L_API->GET_EMBEDDING_WINDOW_CTLR( ).
IF L_WINDOW_CTLR IS BOUND.
L_POPUP = L_WINDOW_CTLR->GET_WINDOW( ).
L_POPUP1 = L_WINDOW_CTLR->GET_WINDOW( ).
IF L_POPUP IS BOUND.
L_POPUP->SUBSCRIBE_TO_BUTTON_EVENT(
BUTTON = IF_WD_WINDOW=>CO_BUTTON_OK
BUTTON_TEXT = 'OK' "#EC *
ACTION_NAME = 'ON_OK'
ACTION_VIEW = L_API
IS_DEFAULT_BUTTON = ABAP_TRUE ).
ENDIF.
ENDIF.
Regards
Abhimanyu L
Message was edited by:
Abhimanyu Lagishetti
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.