Documente Academic
Documente Profesional
Documente Cultură
http://help.sap.com/saphelp_erp60_sp/helpdata/en/43/c2283b2320332ce1000000 0a11466f/content.htm
method onactionpopup4_1 . 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 `Data where changed` into table l_text. "#EC * insert `Do you want to save?` into table l_text. "#EC * 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( ). endmethod.
2)
http://www.sapdev.co.uk/sap-webapps/sap-webdynpro/wdp_displaypopup.htm
Step 1 - Within your created web dynpro application create a new view Create a new web dynpro view which contains the text and UI elements you want to
display Step 2 - Create a new WINDOW (WND_POPUP) to embed the view into Create a new window and embed the view you have just created into it. see hello world basic web dynpro example to see how to embed a view into a window. Step 3 - Add ABAP code Insert the following ABAP code into the appropriate place. i.e. in the wdp action method of your desired button Data: context_node type ref to if_wd_context_node. data: lr_popup type ref to if_wd_window, lr_view_controller type ref to if_wd_view_controller. data: lr_api_comp_controller type ref to if_wd_component, lr_window_manager type ref to if_wd_window_manager. lr_api_comp_controller = wd_comp_controller->wd_get_api( ). lr_window_manager = lr_api_comp_controller->get_window_manager( ). lr_popup = lr_window_manager->create_window( MODAL = ABAP_TRUE window_name = 'WND_POPUP' "Name of the window created in step 2 TITLE = 'Please enter all information' CLOSE_BUTTON = ABAP_TRUE BUTTON_KIND = if_wd_window=>CO_BUTTONS_YESNO MESSAGE_TYPE = if_wd_window=>co_msg_type_error CLOSE_IN_ANY_CASE = ABAP_TRUE *MESSAGE_DISPLAY_MODE = MESSAGE_DISPLAY_MODE ). * Adds an action to the popup screen buttons * lr_view_controller = wd_this->wd_get_api( ). * * * * * lr_popup->subscribe_to_button_event( button = if_wd_window=>co_button_ok button_text = 'Yes' action_name = 'SUBMIT' action_view = lr_view_controller ). lr_popup->open( ).
Step 4 - Popup screen options The code in step 3 will display your popup screen as an error message with two buttons saying 'YES' and 'NO', these buttons will not perform an action and will simply return the user back to the main window. If this is not what you require below is a list of options which will allow you to change this display to suit your needs (adding different buttons, change message type, add action to buttons): Options for the BUTTON_KIND parameter (which can be found by double clicking on 'co_buttons_ok' within the above ABAP code):
CO_BUTTONS_NONE CO_BUTTONS_ABORTRETRYIGNORE CO_BUTTONS_OK CO_BUTTONS_CLOSE CO_BUTTONS_OKCANCEL No Buttons Buttons for Buttons for Buttons for Buttons for 'Cancel', 'Repeat', 'Ignore' 'O.K.' 'Close' 'O.k.', 'Cancel'
CO_BUTTONS_YESNO CO_BUTTONS_YESNOCANCEL CO_BUTTON_ABORT CO_BUTTON_RETRY CO_BUTTON_IGNORE CO_BUTTON_OK CO_BUTTON_CLOSE CO_BUTTON_CANCEL CO_BUTTON_YES CO_BUTTON_NO
- Buttons for 'Yes', 'No' - Buttons for 'Yes', 'No', 'Close' Button Button Button Button Button Button Button Button for for for for for for for for 'Cancel' 'Repeat' 'Ignore' 'Ok.' 'Close' 'Cancel' 'Yes' 'No'
Options for the MESSAGE_TYPE parameter (which can be found by double clicking on 'co_msg_type_error' within the above ABAP code):
CO_MSG_TYPE_NONE CO_MSG_TYPE_WARNING CO_MSG_TYPE_INFORMATION CO_MSG_TYPE_QUESTION CO_MSG_TYPE_ERROR CO_MSG_TYPE_STOPP No message type Warning Information Question Error Cancel
Adding actions to popup screen buttons (Yes, OK etc) Add the following code to that found in step 3, after the method 'create_window' has been called (or simple uncomment it!!)
lr_view_controller = wd_this->wd_get_api( ). lr_popup->subscribe_to_button_event( button = if_wd_window=>co_button_ok button_text = 'Yes' action_name = 'SUBMIT' action_view = lr_view_controller ).
3)
http://help.sap.com/saphelp_nw04s/helpdata/en/43/bccdcfe326332ee10000000a 11466f/content.htm
The window used as the dialog box (in this case, POPUP1_1) must already exist in the component.
method onactionpopup1_1 .
l_cmp_api
= wd_comp_controller->wd_get_api( ). = l_cmp_api->get_window_manager( ).
l_window_manager
if wd_this->m_popup1_1 is initial. wd_this->m_popup1_1 = l_window_manager->create_window( window_name = 'POPUP1_1' button_kind = if_wd_window=>co_buttons_yesnocancel message_type = if_wd_window=>co_msg_type_question ). endif. wd_this->m_popup1_1->open( ).
endmethod.
Note that the CREATE_WINDOW method only creates the new dialog box; it does not open it. To open the dialog box you also need the OPEN method.
The Buttons of the Dialog Box You use the BUTTON_KIND parameter to specify which buttons should appear in the dialog box. In the example above, the CO_BUTTONS_YESNOCANCEL constant is set. This constant is of the ABAP Dictionary type WDR_POPUP_BUTTON_KIND, the domain of which has a set of fixed values. The fixed values represent all the meaningful combination possibilities for dialog box buttons, such as OK, OK/Cancel, or Yes/No/Cancel. The default of the constant, an attribute of the IF_WD_WINDOW interface, is the value 5. That means that the combination
contains the constants CO_BUTTON_YES, CO_BUTTON_NO, and CO_BUTTON_CANCEL, and that three buttons will be created in the dialog box, one each for Yes, No, and Cancel.
method wddoinit .
l_api
= wd_this->wd_get_api( ).
if l_popup is bound. l_popup->subscribe_to_button_event( button button_text action_name action_view = if_wd_window=>co_button_yes = 'Yes' = 'YES' = l_api "#EC *
is_default_button = abap_true ). l_popup->subscribe_to_button_event( button button_text action_name action_view = if_wd_window=>co_button_no = 'No' = 'NO' = l_api "#EC *
action_name action_view
= 'CANCEL' = l_api
The phase model instance of the dialog box is attached to the same component as the instance of the calling window. For this reason, when the dialog box is opened not only are all the Hook Methods of the view called that are displayed in the dialog box, all the hook methods of the view that are imbedded in the calling window are called as well. The WDDOONOPEN and WDDOONCLOSE Methods Every window controller has the WDDOONOPEN and WDDOONCLOSE hook methods. These two methods are only processed when a window is opened or closed as a dialog box. Since the opening of a dialog box does not involve any navigation, no inbound plug is called and therefore no event handler method is processed. The WDDOONOPEN method can therefore be used to implement initializations.
4) 5) 6)