Making a selection screen field obligatory, setting a default value, inserting a blank line... Available options listed...
- Default value Setting a default value for your parameter can be very explanatory for what is expected.
PARAMETERS: par(20) TYPE c DEFAULT 'BANANAS'.
SELECT-OPTIONS: selop FOR mara-matnr DEFAULT 'AA' TO 'MM'.
SELECT-OPTIONS: selop FOR mara-matnr DEFAULT 'AA' TO 'LH' OPTION NB SIGN I.
- Obligatory parameter fields A parameter field may well be obligatory. A questionmark in an (empty) field indicates (the standard SAP manner) that a value has to be filled in.
PARAMETERS: mustknow(10) TYPE C OBLIGATORY.
- Search help When entering parameters Search helps (Matchcode objects) can be used as well. Examples:
PARAMETERS matnr LIKE mara-matnr MATCHCODE OBJECT mat1.
orSELECT-OPTIONS aufnr FOR viaufks-aufnr MATCHCODE OBJECT orde.
- Upper case lower case When reading for example a Unix file name, characters may not be converted to UPPER CASE as this makes Unix files untraceable. An addition to the
PARAMETERS
statement:PARAMETERS: unixfile(40) TYPE C LOWER CASE.
- Empty lines, comment texts, seperator lines, build up with positioning is shown in:
Example: Some common options for a selection screenPARAMETERS: DS_NAME(40). SELECTION-SCREEN SKIP 3. "3 empty lines SELECTION-SCREEN COMMENT 1(55) TEXT-001. SELECTION-SCREEN ULINE. "Underline SELECTION-SCREEN SKIP 1. SELECTION-SCREEN BEGIN OF LINE. "Start of a line-block SELECTION-SCREEN COMMENT 1(30) TEXT-002. PARAMETERS: BDC_FLAG(1) TYPE C. "Input field in the middle of a line SELECTION-SCREEN COMMENT 35(25) TEXT-003. SELECTION-SCREEN POSITION 78. PARAMETERS: FLAGFLAG(1). SELECTION-SCREEN END OF LINE.
- Visible length the visible length of a variabele can be restricted, which will make the field a scrollable field
PARAMETERS: par(10) TYPE c VISIBLE LENGTH 3.
- Comments on comments Comments can be represented in several ways on the selection screen. A concise explanation can be put on the screen with
SELECTION-SCREEN COMMENT TEXT-001.
. ABAP text elements have to be used for this (TEXT-001
).SELECTION-SCREEN /10(6) COMMENT commentvar
is also possible. InINITIALIZATION
the variablecommentvar
has to be set. - User parameters Parameter fields can of course refer to user parameters. These can be set in via the menu > System > User settings > User parameters. The value linked to a user parameter will appear as the default one in the program parameter field. An example:
PARAMETERS arbpl LIKE rihafvc-arbpl MEMORY ID agr.
- No-display Then there is an option that can be used with
SELECT-OPTIONS
andPARAMETERS
: the optionNO-DISPLAY
. Selection fields that haveNO-DISPLAY
as an option can only be filled when the report is being called by another ABAP withSUBMIT .. WITH
. This way the system ensures that reports that are build on top of other reports (or transactions) can be used viaSUBMIT
or directly by the end user. Only thePARAMETERS
andSELECT-OPTIONS
that could mean something to the end user are displayed. An example:PARAMETERS BLIND LIKE SY-SUBRC VALUE 2 NO-DISPLAY.
- Check box and radio-button A checkbox in the selection screen is represented with option
AS CHECKBOX
. A checkbox parameter is a variable of thetype C(1)
in ABAP; the parameter may contain a space or an 'X'. The additionRADIOBUTTON GROUP abc
changes the type C(1) parameter into a radio button. AGROUP
is used to indicate which radio buttons belong together. A radio button cannot be cleared by the end user, this can only be done by selecting another radio button. Make sure that only one of the radio buttons variables contains an 'X'. - Blocks A block can be placed on the screen with the statements
SELECTION-SCREEN BEGIN OF BLOCK blockname
with the optionsWITH FRAME
(with a visible line) andTITLE text-001
. A title variable can be filled in as well, and would have to be set inINITIALIZATION
. When defining a block within a block, the maximum is five blocks. To draw a simple line within a block or in between blocks can be done withSELECTION-SCREEN ULINE pos
.
Blocks can also be seen as a logical unit. The PAI of a selection screen is dealt with perBLOCK
, whenAT SELECTION-SCREEN ON BLOCK blockname
is programmed (often used for logical database programming). - Modification ID Every
SELECT-OPTIONS
orPARAMETERS
field can be assigned a modification ID via the optionMODIF ID
which is much like setting (one of the)GROUP
fields. Changing the field's appearance on the screen can be influenced:
Example: Change the appearance of fields using the modification ID:PARAMETERS: TEST1(10) MODIF ID SC1, TEST2(10) MODIF ID SC2, TEST3(10) MODIF ID SC1, TEST4(10) MODIF ID SC2. AT SELECTION-SCREEN OUTPUT. LOOP AT SCREEN. IF SCREEN-GROUP1 = 'SC1'. SCREEN-INTENSIFIED = '1'. MODIFY SCREEN. CONTINUE. ENDIF. IF SCREEN-GROUP1 = 'SC2'. SCREEN-INTENSIFIED = '0'. MODIFY SCREEN. ENDIF. ENDLOOP
Some of the most common SELECT-OPTIONS
options:
- Restrict lines restrict the end user to enter (process) only the first line of a select option:
SELECT-OPTIONS selop FOR mara-matnr NO-EXTENSION.
- Restrict interval restrict the end user to enter a set of values, but no ranges:
SELECT-OPTIONS selop FOR mara-matnr NO INTERVALS.
You can easily check whether intervals are set up in the selection using function moduleRS_SELOPT_NO_INTERVAL_CHECK