on 08-06-2009 10:24 AM
Hi experts,
I have created a popup window with YesNo buttons.
Now i want to perform some actions when clicking the buttons.
say for example, when i click the 'Yes' button, i want to call another view.
when i click the 'No' button, an error message should be displayed in the window.
How to acieve this?
Could anyone provide me the step for triggereing actions for the buttons in the popup window?
Regards,
Shanthi
Hi Shanthi,
To achieve this, you need to subscribe events for popup buttons as follows:
lo_api = wd_this->wd_get_api( ).
lo_window->subscribe_to_button_event(
button = if_wd_window=>co_button_yes
action_name = 'ON_YES'
action_view = lo_api
is_default_button = abap_true ).
'ON_YES' should be the action created for the view. You can code here whatever steps you want for the button to perform.
Hope this resolves your issue!!
Thanks,
Tejaswini
Edited by: Tejaswini Chafekar on Aug 6, 2009 11:53 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
In your appropriate method , where u r calling the pop up write the following 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(
-> 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( ).
regards,
amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Create actions for YES and NO in the actions tab of the view. Provide the same names to the popup message method as ACTION name parameter.
***Get the component usage for the popup
wd_comp_controller->GREF_CMP_API = wd_comp_controller->wd_get_api( ).
***Get the window manager for the component
if wd_comp_controller->gref_cmp_api is not initial.
wd_comp_controller->GREF_W_MANAGER = wd_comp_controller->GREF_CMP_API->get_window_manager( ).
endif. "IF wd_comp_controller->gref_cmp_api is not initial.
***Clear the text table contents
refresh wd_comp_controller->lit_text.
***Message on the popup to be displayed
insert 'Confirm' into table wd_comp_controller->LIT_TEXT. "#EC *
if wd_comp_controller->GREF_W_MANAGER is not initial.
****Create the popup window for confirmation
wd_comp_controller->GREF_W_POPUP = wd_comp_controller->GREF_W_MANAGER->create_popup_to_confirm(
text = wd_comp_controller->LIT_TEXT
button_kind = if_wd_window=>co_buttons_yesno
message_type = if_wd_window=>co_msg_type_Warning
CLOSE_BUTTON = ABAP_FALSE "Hide the close button
window_title = wd_assist->gc_Confirm
window_position = if_wd_window=>co_center ). "#EC *
endif. "IF wd_comp_controller->GREF_W_MANAGER is not initial.
***Get the view controller reference
wd_comp_controller->GREF_V_CONTROLLER = wd_this->wd_get_api( ).
***Subscribe to the events for the popup
if wd_comp_controller->GREF_V_CONTROLLER is not initial.
if wd_comp_controller->GREF_W_POPUP is not initial.
if button_id eq wd_assist->GC_BTN_DELETE_EFF.
***'YES' button
wd_comp_controller->GREF_W_POPUP->subscribe_to_button_event(
button = if_wd_window=>co_button_yes
BUTTON_TEXT = 'YES'
action_name = 'YES'
action_view = wd_comp_controller->GREF_V_CONTROLLER
is_default_button = abap_true ).
***'NO' button
wd_comp_controller->GREF_W_POPUP->subscribe_to_button_event(
button = if_wd_window=>co_button_no
BUTTON_TEXT = 'NO'
action_name = 'NO'
action_view = wd_comp_controller->GREF_V_CONTROLLER
is_default_button = abap_false ).
Now on YES action, fire the plug to other view and on NO, throw the error message.
Regards,
Lekha.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.