on 08-04-2009 10:27 AM
Hi ,
I have developed one webdynpro with interactive form. On Action submit , I'm able to trigger popup.
But my problem is in my submit method, after calling this popup method, I have some other code, which is getting executed before displaying the popup. After executing complete submit method then POPup is displaying.
How can I restrict for not executing rest of the code in submit method, until user clicks OK button in the pop-up?
Appreciate your response.
With Regards,
Ravi.D
Hi,
Comment all your code from Submit Method, except the code for calling the Popup.
Now implement the action for the Ok button of your popup and place all your other code over here;
You can subscribe to the Ok button using the following code.
Regards,
Radhika." In your submit method only write the following code to call the popup
* Popup
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(
window_name = 'W_POPUP'
message_display_mode = if_wd_window=>co_msg_display_mode_selected
button_kind = if_wd_window=>co_buttons_ok
message_type = if_wd_window=>co_msg_type_none
default_button = if_wd_window=>co_button_ok
).
DATA: l_api TYPE REF TO if_wd_view_controller.
l_api = wd_this->wd_get_api( ).
" subscribe action for Ok button
lo_window->subscribe_to_button_event(
button = if_wd_window=>co_button_ok
action_name = 'OK_POPUP'
action_view = l_api
is_default_button = abap_true ).
lo_window->open( ).
" Goto Actions tab and create an action with the name 'OK_POPUP' and place your remaining code in this method
" This action will be triggered whenever user clicks Ok button in the Popup.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Popups don't work like they did in classic dynpro. Your logic flow doesn't branch into the popup and wait for control to return from the popup. Popups in Web Dynpro are Asychronous, not Sychronous. The rest of the phase model of Web Dynpro fires before the popup is even show to the user.
You have to adjust your design of your logic to meet this flow. As already described, you must register event handlers for the press of the button in the popup and in these event handlers, continue the logic of your processing.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
When I try to add the code for action subscription in Component Controller I'm getting following error:
"The result type of the function method cannot be converted into the type of l_api. "
DATA: l_api TYPE REF TO if_wd_view_controller.
l_api = wd_this->wd_get_api( ).
" subscribe action for Ok button
lo_window->subscribe_to_button_event(
button = if_wd_window=>co_button_ok
action_name = 'OK_POPUP'
action_view = l_api
is_default_button = abap_true ).
Am I doing some thing wrong?
Appreciate your help.
With Regards,
Ravi
Hi Ravi,
You should place that code in the same view from where you are calling your popup window. In other
words this code is for subscribing to your popup windows buttons & this would come right after
your CREATE_WINDOW... Since you are trying to place the code at your COMPONENTCONTROLLER
level the reference in lv_api would go all wrong. (lv_api is TYPE REF TO if_wd_view_controller).
Regards,
Uday
Hi Ravi,
You would do something like shown below:
* Popup
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(
window_name = 'W_POPUP' " your window name
message_display_mode = if_wd_window=>co_msg_display_mode_selected
button_kind = if_wd_window=>co_buttons_ok
message_type = if_wd_window=>co_msg_type_none
default_button = if_wd_window=>co_button_ok
).
DATA: l_api TYPE REF TO if_wd_view_controller.
l_api = wd_this->wd_get_api( ).
lo_window->subscribe_to_button_event(
button = if_wd_window=>co_button_ok
action_name = 'ON_OK
action_view = l_api
is_default_button = abap_true ).
lo_window->open( ).
As you can see both the call to CREATE_WINDOW & the subscription to the popups buttons are present in the same view. In this snippet I am specifying that up on clicking my popups OK button I would like to trigger the action ON_ACTION. So you would also have to keep in mind to create this action in the "Actions" tab of your view.
Regards,
Uday
Hi Ravi,
You can't directly call View's API in Component Controller.
What i suggest is, You can create a global View Controller object and define it in View's WDDONIT.
wd_comp_controller->lo_api = wd_this->wd_get_api( ).
Now you can use this View's API in Component Controller and use it to subscribe view's action.
lo_window->subscribe_to_button_event(
button = if_wd_window=>co_button_ok
action_name = 'ON_OK'
action_view = wd_this->lo_api "Global lo_api for the view
is_default_button = abap_true ).
Hope this helps!!
Thanks,
Tejaswini
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.