When you design an SAP Program Some dialog boxes are often needed and you can write them by yourself. However, using the dialog box functions provided in the SAP system will reduce a lot of development work.
1. function group list and usage of SAP
Applicability |
Function Group |
Prompt that the user may lose data |
Spo1 |
Prompt the user to select YES or NO for a problem |
Spo1 |
Prompt that the user may lose data and ask whether the user can continue the operation |
Spo1 |
The user is prompted to select an operation from multiple operations |
SpO2 |
The user is prompted to continue the current operation or cancel the current operation. |
SpO2 |
Prompt the user to enter data (you can check the input value based on a table or not) |
Spo4 |
Display data to users |
Spo4 |
Show detailed data to users |
Spo6 |
Select data from the list |
Sp05 |
Use a rolling dialog box to display data to users. |
Stab |
Print data from a view or data table |
Stpr |
2. Function list and description
2.1 spo1 Functions
- popup_to_confirm_step
with this function, you can create a dialog box to ask whether you want to perform a certain step. You can select yes no or cancel. This function can input a title and two lines of text (prompting a problem ). The system displays a green question mark icon in the window.
you can set a button as the default button.
call function 'popup _ to_confirm_step '
exporting titel = 'Confirm the prompt test'
textline1 = 'Do you want to execute'
textline2 = 'test? '
cancel_display = space "the cancel button is not displayed.
importing answer = answer.
- Popup_to_confirm_with_message
Similar to popup_to_confirm_step, only three lines of text error diagnosis prompt are displayed. The system displays a green question mark icon in the window.
Call function 'popup _ to_confirm_with_message'
Exporting titel = 'Confirm the prompt Test'
Textline1 = 'Do You Want To execute ;;'
Textline2 = spop-textline2
Diagnosetext1 = spop-diagnose1
Diagnosetext2 = spop-diagnose2
Diagnosetext3 = spop-diagnose3
Importing answer = answer.
- popup_to_confirm_with_value
you can use this function to create a dialog box asking you whether to perform a certain step. This operation may cause data loss, you can select yes no or cancel. This function can input a title, two lines of text (prompting a problem), and an object value (the object value will be inserted between the two parts of the prompt text ). The system displays a green question mark icon in the window.
you can set a button as the default button.
call function 'popup _ to_confirm_with_value '
exporting titel = titel
text_before =' Do You Want To execute '
objectvalue = 'test'
text_after = '? '
importing answer = answer.
- Popup_to_confirm_loss_of_data
You can use this function to create a dialog box to ask if you want to perform a certain step. This operation may cause data loss. You can select yes no or cancel. This function can be used to input a title and two lines of text (prompting a problem ). The system displays a yellow color in the window! Icon and a line "data will be lost .".
You can set a button as the default button.
Call function 'popup _ to_confirm_loss_of_data'
Exporting titel = titel
Textline1 = SPOP-TEXTLINE1
Textline2 = SPOP-TEXTLINE2
Importing answer = answer.
-
- Popup_to_confirm
This function is an enhanced version of the popup function. You can customize button text and icons.
2.2. Function Group SpO2
- Popup_to_decide_with_message
SimilarPopup_to_decide,Programmers can pass in with this function module you create a dialog box in which you inform the user about a specific decision point via a diagnosis text, during an action. he or she can choose one of two alternative actions offered or cancel the action.
The action, the diagnosis text, the question and the alternative actions are passed as parameters.
The user action (alternative 1, alternative 2, or cancel) is returned in a parameter.
2.3. Function Group spo4
- popup_get_values
This function module sends a dialog box for data display and input.
the input fields are passed in a structure and must be defined in the dictionary. you can also specify individual field display attributes and a field text, if the key word from the dictionary is not to be displayed as field text in the dialog box, in the structure.
the standard help functionality (F1, F4) is supported.
- popup_get_values_db_checked
This function module sends a dialog box for data to be input und checked against the database.
the input fields are passed in a structure and must be defined in the dictionary. you can also specify individual field display attributes and a field text in the structure, if the key word from the dictionary is not to be displayed as field text in the dialog box.
A comparison operator for checking the input data in the database is passed. you can specify whether the check is for the existence or absence of an object. A foreign key relationship check is supported.
the standard help functionality (F1, F4) is supported.
the user action is returned in a parameter.
- Popup_get_values_user_checked
This function module sends a dialog box for data to be input and checked in an external sub-routine (User exit ). the input fields are passed in a structure and must be defined in the dictionary. you can also specify individual field display attributes and a field text in the structure, if the key word from the dictionary is not to be displayed as field text in the dialog box.
The data input by the user in the dialog box are passed to the sub-routine specified in the interface for checking. errors Found by the check are entered in an error structure and are evaluated on return from the sub-routine by the function module.
The standard help functionality (F1, F4) is supported.
The user action (ContinueOrCancel) Is returned in a parameter.
- Popup_get_values_user_help
This function module sends a dialog box for data to be input with the possibility of a check in an external sub-routine (User exit) and branching in a user F1 or F4 help.
The input fields are passed in a structure and must be defined in the dictionary. you can also specify individual field display attributes and a field text in the structure, if the key word from the dictionary is not to be displayed as field text in the dialog box.
You can pass the data which are entered by the user in a dialog box to a sub-routine which must be specified in the interface for checking. errors occurring in the check are stored in an error structure and are analyzed by the function module upon return from the sub-routine. the data, and an error message, if appropriate, are displayed again.
The standard help functionality (F1, F4) is supported.
User exits for a user F1 or F4 help can also be specified.
The user action ( Continue Or Cancel ) Is returned in a parameter.
- Popup_get_values_user_buttons
This function module is like the previous function module popup_get_values_user_help, with the additional possibility of passing one or two additional pushbuttons and a standard Pushbutton, which the user name.
2.4 function group spo6
2.5 function group spo5
Report rsspo500.
Data: selectlist like spopli occurs 5 with header line.
Data: Antwort type C.
While Antwort ne 2.
Clear selectlist.
Refresh selectlist.
Selectlist-varoption = the pop-up box containing the radio button is displayed '.
Append selectlist.
Selectlist-varoption = 'display the pop-up box containing the checkbox '.
Selectlist-selflag = 'x '.
Append selectlist.
Call function 'popup _ to_decide_list'
Exporting
* Cursorline = 1
* Mark_flag =''
Mark_max = 1
Start_col = 10
Start_row = 10
Textline1 = 'text1'
Textline2 = 'popup _ to_decide_list'
Textline3 = 'text3'
Titel = 'title'
Importing
Answer = Antwort
Tables
T_spopli = selectlist
Exceptions
Not_enough_answers = 1
Too_much_answers = 2
Too_much_marks = 3
Others = 4.
If Antwort EQ 'A '.
Exit.
Endif.
Endwhile.
If Antwort ne 'A '.
Clear selectlist.
Refresh selectlist.
Selectlist-varoption = 'up to 15 options '.
Selectlist-selflag = 'x '.
Append selectlist.
Selectlist-varoption = 'check box included '.
Selectlist-selflag = 'x '.
Append selectlist.
Selectlist-varoption = 'or radio button '.
Selectlist-selflag = 'x '.
Append selectlist.
Selectlist-varoption = 'typical list function :'.
Selectlist-selflag = 'x '.
Append selectlist.
Selectlist-varoption = '* select '.
Selectlist-selflag = 'x '.
Append selectlist.
Selectlist-varoption = '* select all '.
Selectlist-selflag = 'x '.
Append selectlist.
Selectlist-varoption = 'cancel all select '.
Selectlist-selflag = 'x '.
Append selectlist.
Selectlist-varoption = '3 70 characters/Options '.
Selectlist-selflag = 'x '.
Append selectlist.
Selectlist-varoption = '65 characters/Options '.
Selectlist-selflag = 'x '.
Append selectlist.
Selectlist-varoption = 'activate/inactivate the optional row '.
Selectlist-selflag = 'x '.
Selectlist-inactive = 'x '.
Append selectlist.
* 2. aufruf *************************************** *******************
Call function 'popup _ to_decide_list'
Exporting
* Cursorline = 1
Mark_flag = 'X'
Mark_max = 0
Start_col = 15
Start_row = 15
Textline1 = 'das popup bietet '(c01)
Textline2 = 'folgende funktionalit metadata: '(C02)
Titel = 'das beispiel 2' (B02)
Importing
Answer = Antwort
Tables
T_spopli = selectlist
Exceptions
Not_enough_answers = 1
Too_much_answers = 2
Too_much_marks = 3
Others = 4.
Endif.