on 10-16-2012 11:54 AM
I want to control the closing of pop-up window based on the warning / error message. I have written the code in the DO-before action to close the pop-up window.
Warning message / erorr messages are thrown based on selecting the row in a table in the pop-up window.
On selecting a particular row , user can see the error / warning message of that row. Now i want to close the pop-up window when there is no error / warning messsage.
For that I want to get the button id of pop-up window. ?How to get ID of the button used in a pop-up window. Please suggest
Hello,
You can get the ID of the button as follows :
In the action handler of the button
DATA : lv_event type string.
lv_event = wdevent->get_string('ID').
Lv_event will have the ID of the button.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Given your requirement I would suggest doing this.
You don't need to code anything in the dobeforeaction.
Try this.
in the event handler your button in the popup :
method onactionclose .
data: lo_cmp type ref to if_wd_component,
lo_window_manager type ref to if_wd_window_manager,
lo_popup type ref to if_wd_window,
lo_view type ref to if_wd_view_controller,
lv_text type string,
lt_text type table of string.
lo_cmp = wd_comp_controller->wd_get_api( ).
lo_window_manager = lo_cmp->get_window_manager( ).
insert `Do you want to close this popup?` into table lt_text.
lo_popup = l_window_manager->create_popup_to_confirm(
text = lt_text
button_kind = if_wd_window=>co_buttons_yesno
message_type = if_wd_window=>co_msg_type_question
window_title = 'Test: Confirm action'
window_position = if_wd_window=>co_center )."#EC *
lo_view = wd_this->wd_get_api( ).
lo_popup->subscribe_to_button_event(
button = if_wd_window=>co_button_yes
action_name = 'YES'
action_view = lo_view "Your popup view
is_default_button = abap_true ).
lo_popup->open( ).
endmethod.
And then create an Action 'YES' in the view of your popup and do the coding for closing the popup there.
Or you can also use the subscribe_to_button_event( ) function in your popup view to handle an event on the button 'WD_OK'.
Check for warning/Error messages and then if needed call the window_close( ) function and you are done.
Kiron
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
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.