on 10-22-2012 7:41 AM
hi guyz,
I am trying to work on the pop up window but not getting how to fix the bug, actually i want to put action on the default button of the pop up window, i am using the Subscribe_to_button_event for OK and CANCEL button of the popup. I am not getting where to put the code either on the pop up view where i am asking the user to continue further and where to place the code in wddoinit or customized methods.
help me.
Hello Ankit,
In Web Dynpro ABAP, you can call a pop-up in 3 ways -
If you are going for the first then you can place the code in an UI elements event property i.e., you can place the code in an button of a view, it would be called automatically.
See the sample code which I have used while trying to delete an entry in a table.
METHOD onactiondelete .
* Data declarations for creating a pop-up to confirm dialog box
DATA lo_window_manager TYPE REF TO if_wd_window_manager.
DATA lo_api_component TYPE REF TO if_wd_component.
DATA lo_popup TYPE REF TO if_wd_window.
DATA l_text TYPE string_table.
DATA l_api TYPE REF TO if_wd_view_controller.
lo_api_component = wd_comp_controller->wd_get_api( ).
lo_window_manager = lo_api_component->get_window_manager( ).
INSERT `Are you sure to delete the record?` INTO TABLE l_text.
lo_popup = lo_window_manager->create_popup_to_confirm(
text = l_text
button_kind = 4
message_type = 5
close_button = ABAP_TRUE
window_position = if_wd_window=>co_center ).
l_api = wd_this->wd_get_api( ).
* Assigining action to YES button
lo_popup->subscribe_to_button_event(
button = 7
action_name = 'YES'
action_view = l_api
is_default_button = ABAP_TRUE ).
* Assigining action to NO button
lo_popup->subscribe_to_button_event(
button = 8
action_name = 'NO'
action_view = l_api
is_default_button = ABAP_FALSE ).
* Opening a popup
lo_popup->open( ).
ENDMETHOD.
Do find the screen shots for necessary follow-ups. Hope it helps ! Do revert back if any.
Regards,
Varun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Varun,
thanks for your help.
I know to put the code on the view on which my popup in been called but where to place methods like
WDDOAFTERACTION,WDDOBEFOREACTION,WDDOEXIT,WDDOINIT,WDDOMODIFYVIEW and
WDDOONCONTEXTMENU.
I mean how to know where to place the code for proper execution otherwise its throwing error.
ankit
Hello Ankit,
Good to know that you have very well understood the facts. Well placing the code depends on your requirement, as to when and how you would like to call it. In my scenario whenever a user does not select a record and presses the DELETE button it throws an error.
You can put your code accordingly as to for example if you want the pop to appear while starting you can place it in WDOINIT, if while modifying a view you want a pop to confirm the changes you can put it it WDOMODIFYVIEW, like wise in all other hook methods.
Even you can create a method of your own and just call in it any one of the hook methods.
Hope this helps. Let me know accordingly if any doubt.
Regards,
Varun
thanks Khushboo and varun for your help.
I got the solution, the code for modify my table by entering the values from the user and it has to be placed on the WDDOINIT in the final view. and the code i have implemented is
data:
lo_api type ref to if_wd_view_controller,
lo_window_ctlr type ref to if_wd_window_controller,
lo_popup type ref to if_wd_window.
lo_api = wd_this->wd_get_api( ).
lo_window_ctlr = lo_api->get_embedding_window_ctlr( ).
if lo_window_ctlr is bound.
lo_popup = lo_window_ctlr->get_window( ).
if lo_popup is bound.
lo_popup->subscribe_to_button_event(
button = if_wd_window=>co_button_ok
action_name = 'SAVE_INP'
action_view = lo_api ).
lo_popup->subscribe_to_button_event(
button = if_wd_window=>co_button_cancel
action_name = 'CANCEL'
action_view = lo_api ).
endif.
endif.
You can put the code in the pop up view..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.