on 06-07-2011 4:36 PM
Hi all,
i have a webdynpro that call to another webdynpro as popup. in the "child" webdynpro i have a button for do some validations and close this webdynpro. then i pass some data with interface node to the "parent" webdynpro.
ok, what i want now is trigger some event from the child WD when I close the window. and catch this event in the parent in order to do something....
but, i don't know how can i do it... i don't know if i need an event handler method in parent WD for this...
any idea?
thanks in advance !
The method where you open the popup ,code it like this.
lo_window->set_on_close_action(
view = lo_view_controller
action_name = 'POPUP_CLOSE' ).
ps :You need to create the POPUP_CLOSE action in the view controller.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your answer, but this event is only triggered when I close the window with the X in the corner...
When I close the window "manually" with the code of my button is not triggered.
What i'm doing to close the window is the following:
I have a node in the context with an attribute type ref to IF_WD_WINDOW, I set this attribute with my obj lo_window after call the popup. this node is an interface node, so i can use it in my "child" wd.
Then, when i push my button i read this node and i use the method close().
do you know how can i subscribe to other event or how can i trigger this event?
thanks in advance.
Ok, I've done the following:
I've created an event in the "child" wd in the component controller and I've checked "Interface".
I've trigger this event before close the window in the "child" wd.
In my "parent" wd i'm trying to subscribe to this event, but i can't. now is dumping because i need to specify with wich button, but there isn't any button. In the method create_window_for_cmp_usage i haven't the parameter button_kind in order to specify some buttons...
This is my code:
DATA lo_window_manager TYPE REF TO if_wd_window_manager.
DATA lo_api_component TYPE REF TO if_wd_component.
DATA lo_window TYPE REF TO if_wd_window.
lo_api_component = wd_comp_controller->wd_get_api( ).
lo_window_manager = lo_api_component->get_window_manager( ).
lo_window = lo_window_manager->create_window_for_cmp_usage(
interface_view_name = 'ZZMYVIEW'
component_usage_name = 'ZZMYCOMP'
title = 'Description'
close_in_any_case = abap_true
message_display_mode = if_wd_window=>co_msg_display_mode_selected
).
lo_window->open( ).
DATA lo_api_main TYPE REF TO if_wd_view_controller.
lo_api_main = wd_this->wd_get_api( ).
* lo_window->set_on_close_action(
* view = lo_api_main
* action_name = 'POPUP_CLOSE' ).
CALL METHOD lo_window->subscribe_to_button_event
EXPORTING
button = if_wd_window=>CO_BUTTON_CLOSE "here is the problem
action_name = 'POPUP_CLOSE'
action_view = lo_api_main.
DATA lo_nd_mypopupwindow TYPE REF TO if_wd_context_node.
DATA lo_el_mypopupwindow TYPE REF TO if_wd_context_element.
DATA ls_mypopupwindow TYPE wd_this->element_mypopupwindow.
ls_mypopupwindow-window = lo_window.
lo_nd_mypopupwindow = wd_context->get_child_node( name = wd_this->wdctx_mypopupwindow ).
lo_el_mypopupwindow = lo_nd_mypopupwindow->get_element( ).
lo_el_mypopupwindow->set_static_attributes(
static_attributes = ls_mypopupwindow ).
CALL METHOD lo_window->subscribe_to_button_event
EXPORTING
button = if_wd_window=>CO_BUTTON_CLOSE "here is the problem
action_name = 'POPUP_CLOSE'
action_view = lo_api_main.
This is not what i meant to subscribe.
You have to do than in the view->methods->create event_handler method by selecting child component usage, and the interface event.
Second option is
"Add the event handlers for the interface events
lo_cmp_usage->add_event_handler(
listener = lo_view_controller
handler_name = 'ONACTION_POPUP_CLOSE' "There should be a action popup-close
controller_name = 'INTERFACECONTROLLER'
event_name = 'POPUP_CLOSE' ).
One question.
if i want to use the second option, where i need to put this code? in the method where i'm calling the popup?
how can i get the var "lo_cmp_usage" ?
EDIT: ok, i've found [this link|http://fuller.mit.edu/web_dynpro/wda_class/day_2/Day2_Advanced.pdf] where explain it...
thanks anyway.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.