on 04-05-2011 10:08 PM
Hi:
I have a POP-UP and I am changing the "Yes" and "No" button using "subscribe_to_button_event". After the user selects the "Yes" button, the system will initiate an Update routine, then I want the POP-UP to automatically close. How would I go about doing this? I have tried "lo_window->close", but i am getting an " Access via 'NULL' object reference not possible." error.
Can someone point me in the right direction or help with an example?
Thanks,
MG
HI,
Pass the window reference to the update routine, and after the update is done, then use the statement lo_window->close() to close your window.
Regards,
Runal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi:
As I am new to ABAP Web Dynpro, I do not understand when you say to "Pass the window reference to the update routine", here is the code that I am using to call the Pop-up with a Yes/No button:
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 = 'ZW_POPUP'
title = 'Test Popup'
close_in_any_case = abap_false
button_kind = '4'
message_display_mode = if_wd_window=>co_msg_display_mode_selected ).
I am changing the Yes/No buttons to I Agree/I Do Not Agree
Adds an action to the popup screen buttons
lr_view_controller = wd_this->wd_get_api( ).
lo_window->subscribe_to_button_event(
button = if_wd_window=>co_button_yes
button_text = 'I Agree'
action_name = 'AGREE'
action_view = lr_view_controller ).
lo_window->subscribe_to_button_event(
button = if_wd_window=>co_button_no
button_text = 'I Do Not Agree'
action_name = 'DONT_AGREE'
action_view = lr_view_controller ).
lo_window->open( ).
When the user presses the I Agree button, an update routine is run and then I want the Pop-Up to close automatically. Here is the code that I have in the "Agree" Action after the update routine has finished to close the window:
close window
lo_view_controller = wd_this->wd_get_api( ).
lo_window_controller = lo_view_controller->get_embedding_window_ctlr( ).
IF lo_window_controller IS BOUND.
lo_window = lo_window_controller->get_window( ).
IF lo_window IS BOUND.
lo_window->close( ).
ENDIF.
ENDIF.
The lo_window is not bound so it does not close.
The Pop-up opens as expected and the update routine works correctly, it just that the Pop-up is not closing on its own.
Can someone please tell me what I am doing wrong?
Thanks for the help.
Edited by: MG on Apr 6, 2011 7:44 AM
Hi MG.,
use create_popup_to_confirm( ) method., no need to close window., refer the below snippet..
lo_api_component = wd_comp_controller->wd_get_api( ) .
lo_window_manager = lo_api_component->get_window_manager( ).
lo_window =
lo_window_manager->create_popup_to_confirm(
text = lt_text " this is of type string_table ., u can append text to this to show message do u want to continue.. like that
button_kind = if_wd_window=>co_buttons_yesno " or co_buttons_okcancel
message_type = if_wd_window=>co_msg_type_information
close_button = 'X'
window_title = 'Confirmation message box'
).
* lo_window->subscribe_to_button_event
* Adds an action to the popup screen buttons
lr_view_controller = wd_this->wd_get_api( ).
lo_window->subscribe_to_button_event(
button = if_wd_window=>co_button_yes
button_text = 'I Agree'
action_name = 'AGREE'
action_view = lr_view_controller ).
lo_window->subscribe_to_button_event(
button = if_wd_window=>co_button_no
button_text = 'I Do Not Agree'
action_name = 'DONT_AGREE'
action_view = lr_view_controller ).
lo_window->open( ).
hope this will help u.,
Reply if u need some more clarifications.,
Thanks & regards
Kiran
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.