Function module: Popup_to_confirm
Use the Popup_to_confirm function module to confirm a user selection with a response. The pop-up dialog box has three elements, a title bar, the "text question" and the response. There are 3 and always three responses, normally "yes", "no" and "cancel." You will always pass a text question, and can control the 'Yes' and 'No' answers, although 'Yes' and 'No' are the defaults. You can control the titlebar, but if the parameter is blank, the titlebar assumes the text description of the program.
*" VALUE(TITLEBAR) DEFAULT SPACE
*" VALUE(DIAGNOSE_OBJECT) LIKE DOKHL-OBJECT DEFAULT SPACE
*" VALUE(TEXT_BUTTON_1) DEFAULT 'Ja'(001)
*" VALUE(ICON_BUTTON_1) LIKE ICON-NAME DEFAULT SPACE
*" VALUE(TEXT_BUTTON_2) DEFAULT 'Nein'(002)
*" VALUE(ICON_BUTTON_2) LIKE ICON-NAME DEFAULT SPACE
*" VALUE(DEFAULT_BUTTON) DEFAULT '1'
*" VALUE(DISPLAY_CANCEL_BUTTON) DEFAULT 'X'
*" VALUE(USERDEFINED_F1_HELP) LIKE DOKHL-OBJECT DEFAULT SPACE
*" VALUE(START_COLUMN) LIKE SY-CUCOL DEFAULT 25
*" VALUE(START_ROW) LIKE SY-CUROW DEFAULT 6
*" VALUE(POPUP_TYPE) LIKE ICON-NAME OPTIONAL
sscrfields. " Fields on selection screens
* display a popup window to confirm that they want to update.
if sscrfields-ucomm = 'ONLI' or "User pressed "Execute"
sscrfields-ucomm = 'PRIN'. "User pressed "Execute and Print"
if p_update = 'X'. "If update requested
call function 'POPUP_TO_CONFIRM'
text_question = text-005 " Are you certain...?
answer = w_answer
text_not_found = 1
others = 2.
if sy-subrc <> 0. " Function call failed.
message i000 with text-006. " Func call failed contact IS
if w_answer ne '1'.
message i000 with text-007. " Proc cancelled - no update
endif. " Update requested
endif. " User pressed 'execute' or 'execute and print
Popups can be annoying, especially for experienced users, so our recommendation is that they be used sparingly.