on 05-13-2009 1:15 PM
Hi!
In a Web Dynpro i have created a Popup window : (method associated to a button action in a view's layout)
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.
DATA lt_string TYPE TABLE OF string.
DATA lt_text TYPE STRING.
lt_text = 'Popup di prova'.
INSERT lt_text INTO TABLE lt_string.
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_string
button_kind = 3 ).
lo_window->open( ).
*1 = ok
*2 = close
*3 = ok/cancel
Now, i'd like to know if the user has clicked on OK or Cancel button.
Could you help me, please ?
Thanks.
Data declaration
DATA: L_CMP_API TYPE REF TO IF_WD_COMPONENT,
L_WINDOW_MANAGER TYPE REF TO IF_WD_WINDOW_MANAGER,
L_POPUP TYPE REF TO IF_WD_WINDOW,
L_TEXT TYPE STRING_TABLE,
L_API TYPE REF TO IF_WD_VIEW_CONTROLLER.
L_CMP_API = WD_COMP_CONTROLLER->WD_GET_API( ).
L_WINDOW_MANAGER = L_CMP_API->GET_WINDOW_MANAGER( ).
INSERT `Estimation Variant already exist` INTO TABLE L_TEXT.
INSERT `Do you want to modify?` INTO TABLE L_TEXT.
L_POPUP = L_WINDOW_MANAGER->CREATE_POPUP_TO_CONFIRM(
TEXT = L_TEXT
BUTTON_KIND = IF_WD_WINDOW=>CO_BUTTONS_YESNOCANCEL
MESSAGE_TYPE = IF_WD_WINDOW=>CO_MSG_TYPE_QUESTION
WINDOW_TITLE = 'Test: Popup to confirm'
WINDOW_POSITION = IF_WD_WINDOW=>CO_CENTER ). "#EC *
L_API = WD_THIS->WD_GET_API( ).
L_POPUP->SUBSCRIBE_TO_BUTTON_EVENT(
BUTTON = IF_WD_WINDOW=>CO_BUTTON_YES
ACTION_NAME = 'YES'
ACTION_VIEW = L_API
IS_DEFAULT_BUTTON = ABAP_TRUE ).
L_POPUP->SUBSCRIBE_TO_BUTTON_EVENT(
BUTTON = IF_WD_WINDOW=>CO_BUTTON_NO
ACTION_NAME = 'NO'
ACTION_VIEW = L_API
IS_DEFAULT_BUTTON = ABAP_FALSE ).
L_POPUP->SUBSCRIBE_TO_BUTTON_EVENT(
BUTTON = IF_WD_WINDOW=>CO_BUTTON_CANCEL
ACTION_NAME = 'CANCEL'
ACTION_VIEW = L_API
IS_DEFAULT_BUTTON = ABAP_FALSE ).
L_POPUP->OPEN( ).
Create Action with the name 'yes', 'no', 'cancel' and write coding as per the requirement.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Opps that message was for Fabio Cavallo , wrongly addressed to Lekha.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Lekha,
Following is the code that I have developed for a requiement to accept terms and conditions.
METHOD onactionGet_terms_cond_pop_up .
DATA: lv_cmp_api TYPE REF TO if_wd_component,
lv_window_manager TYPE REF TO if_wd_window_manager,
lv_popup TYPE REF TO if_wd_window,
lv_api TYPE REF TO if_wd_view_controller.
lv_cmp_api = wd_comp_controller->wd_get_api( ).
lv_window_manager = lv_cmp_api->get_window_manager( ).
DATA: wa_text TYPE string,
wa_lines TYPE tline,
it_text TYPE string_table,
it_lines TYPE STANDARD TABLE OF tline.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'ST'
language = sy-langu
name = 'Z_TERMS_AND_CONDITIONS'
object = 'TEXT'
TABLES
lines = it_lines
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
IF sy-subrc = 0.
LOOP AT it_lines INTO wa_lines.
wa_text = wa_lines-tdline.
INSERT wa_text INTO TABLE it_text.
ENDLOOP.
lv_popup = lv_window_manager->create_popup_to_confirm(
text = it_text
button_kind = if_wd_window=>co_buttons_yesno
window_title = 'Terms and Conditions'
window_position = if_wd_window=>co_center ). "#EC *
lv_api = wd_this->wd_get_api( ).
lv_popup->subscribe_to_button_event(
button = if_wd_window=>co_button_yes
action_name = 'AGREE'
action_view = lv_api
is_default_button = abap_true ).
lv_popup->open( ).
ENDIF.
ENDIF.
ENDIF.
ENDMETHOD.
Created an Action "AGREE"
and write the required logic in the method ONACTIONAGREE
This works for me fine, when clicked on yes the terms and conditions are accepted and PO changes are done.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Fabio,
You just need to subscribe to the buttons event using the method subscribe_to_button_event( ). Just go through this [link |sapdev.co.uk/sap-webapps/sap-webdynpro/wdp_displaypopup.htm] to see a complete code of generating a popup & subscribing to its buttons.
Regards,
Uday
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Also create an action POPUP_YES in Actions tab as per Runal's code.
Regards,
Lekha.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Fabio,
Use the method subscribe_to_button_event to handle the button click on pop up.
data: l_api type ref to if_wd_view_controller.
l_api = wd_this->wd_get_api( ).
lo_window->subscribe_to_button_event(
button = 7
* button_text = ''
tooltip = 'Click yes to Exit'
action_name = 'POPUP_YES'
action_view = l_api
* is_default_button = ABAP_FALSE
).
Regards,
Runal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
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.