General Information
Dialog boxes with a confirmation prompt should only be displayed if data entered may be lost. You can use the system flag SY-DATAR to check whether this is the case. When the screen is loaded, the system resets the flag to "SPACE" (not in the case of dialog boxes displaying messages). If the user enters or changes data in a field without previously pressing ENTER, it is set to "X". It can be tested at PAI. Depending on this flag, it is possible, for example, to decide within a module "x" defined with MODULE x AT EXIT COMMAND whether a confirmation prompt is to be displayed or not. If ENTER was pressed at some point, the task has to record whether data has already been changed in a local flag.
Function Modules
The developer can use
function modules for the various prompt categories (see documentation under transaction "UNIT", function group "SPO1"). The following sections explain the parameters, the return values, and the functionality of the various function modules.All function modules position the corresponding texts and pushbuttons at the locations provided in the dialog box, pre-select certain response options, guarantee the selection logic and center the dialog box in a predefined size within the task window, unless the developer specifies otherwise.
Parameters
Prompt
The prompt is transferred to the function module in two separate lines! This may cause problems during translation if the text is stored under two different numbers in the text pool. For this reason, the number for one test should at least be consecutive.
Title Bar
A
title bar must be transferred to all function modules listed below. The title bar should contain the affected <object> and the chosen <action>, if possible (see Title Bar).POPUP_TO_CONFIRM_STEP
Transfer Values
Functionality
The module positions the variable question and the response alternatives in the dialog box. The option transferred as a parameter is pre-selected.
Return Value
"Y" for "Yes", "N" for "No", and "C" for "Cancelled"
POPUP_TO_CONFIRM_ WITH_VALUE
This function module is identical to the function module POPUP_TO_CONFIRM_STEP except for the following features:
The explicitly named object can also be transferred as a parameter. Instead of "Do you want to post the entered document first?", the question is then: "Do you want to post document 4711 first?".
POPUP_TO_CONFIRM_ LOSS_OF_DATA
Transfer Values
The
question has the syntax: "Do you want to <previously selected action> <object>?". For example: "Do you want to cancel the transfer of primary costs?" or "Do you want to return from the list screen?"The question is transferred in no more than two lines of <= 35 characters, starting with "Do you want to" and ending with a"?".
Functionality
Besides the variable text, the module displays the predefined diagnosis text and the response options ("No" is pre-selected) in the dialog box.
Return Value
"Y" for "Yes", "N" for "No", and "C" for "Cancelled"
POPUP_TO_CONFIRM_ WITH_MESSAGE
The following values are transferred
Functionality
The module displays the variable message, the variable question and the response options ("No" can be pre-selected) in the dialog box.
Return Value
"Y" for "Yes", "N" for "No", and "C" for "Cancelled"
POPUP_TO_DECIDE and POPUP_TO_DECIDE_WITH_ MESSAGE
The following values are transferred
Functionality
The modules display the variable message, the variable question and the variable alternative responses in the dialog box and pre-select the specified alternative. The location of the dialog box within the window is predefined.
Return Value
"1" for the first alternative, "2" for the second, and "C" for "Cancel".
Icons
Message and confirmation prompts are defined as one line, however, they occupy three lines and are four characters wide.