ABAP Selection Screen Keywords
A selection screen is a special type of screen that can be created in function groups, module pools, and executable programs. A selection screen in ABAP is where the user can “select” what they want to see — they can input the criteria of what data they want to view. In this blog post, I will be going over what the keywords are in a selection screen, how they work, and what their syntax is.
There are three different key words used that make up a selection screen: SELECT-OPTION, SELECTION-SCREEN, and PARAMETERS.
PARAMETERS is used to define a variable which allows users to enter in values for single field in the selection screen. When you declare a parameter, the GUI side of SAP creates an input field for you when you run the program. You can create a textbox field, a checkbox, or a radio button with PARAMETERS. The type of input created will depend on the syntax you use. The syntax for declaring a parameter is:
PARAMETERS <name>[length] [TYPE type|LIKE obj] [DECIMALS d]
To make it mandatory for the user to input a specific field, you add OBLIGATORY to the end of the PARAMETERS statement. To create a checkbox PARAMETERS statement, add AS CHECKBOX to the end of the PARAMETERS statement. To create a radio button, you add RADIOBUTTON GROUP followed by the name of the radio button group you are specifying.
SELECT-OPTION is used to create two input fields, allowing the user to enter in a range of data rather than just a static number or value. The syntax for SELECT-OPTION is as follows:
SELECT-OPTIONS <SO_NAME> FOR <TABLE-FIELD>
When SELECT-OPTION is declared, a special table is created called a selection table. You can have multiple logical conditions in the table to determine how the data will be dealt with. A selection table has four columns: SIGN, OPTION, LOW, and HIGH. SIGN analyzes the results of each row condition, and decides if it should be included in the final set of rows. Basically, it decides which rows should be chosen. LOW contains the lower value the user entered, and HIGH contains the higher value the user entered.
OPTION is what contains the operator — it is the condition for that particular row. This is a list of all the operators for OPTION:
BT (Between … and …)
CP (Contains Pattern)
GE (Greater than or Equal)
GT (Greater Than)
LE (Less than or Equal)
LT (Less Than)
NB (Not Between … and …)
NE (Not Equal to)
NP (Not contains Pattern)
The SELECTION-SCREEN keyword is used to further customize and format your selection screen. You can customize the selection criteria and how the parameters are laid out. You can also use SELECTION-SCREEN to display underlines, comments, and blank lines on the screen that the user sees. The syntax is as follows:
SELECTION-SCREEN ULINE [[/] position(length) ] [MODIF ID key ].
SELECTION-SCREEN COMMENT [/]position(length) comm [FOR FIELD f]
[MODIF ID key].
SELECTION-SCREEN SKIP [ n ].
Display multiple elements in the same line:
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF BLOCK block
[WITH FRAME [TITLE title]]
SELECTION-SCREEN END OF BLOCK block.
In a selection screen, you use the three keywords I have mentioned in order to customize how the screen is shown to the user, and how it behaves when searching for data. Selection screens are very important to be able to select and view only the data that you want, rather than searching through all the data you have available to you. In this blog post I have reviewed the keywords used in a selection screen. In my next blog post, I will be going through step by step how to create your first selection screen in ABAP.