To assign default values to a selection criterion, you use the following syntax:
SELECT-OPTIONS seltab FOR f DEFAULT g [TO h ]....
Default values g and h can be literals or field names. You can only use fields that contain a value when the program is started. These fields include several predefined data objects .
For each SELECT-OPTIONS statement, you can specify only one DEFAULT addition. This means that you can fill only the first row of selection table seltab with default values. To fill more rows with default values, the selection table must be processed before the selection screen is called, for example, during the AT SELECTION SCREEN OUTPUT event.
You use the DEFAULT addition as follows to address the individual components of the first row:
To fill only the low field (single field comparison), use:
........ DEFAULT g .
To fill the low and high fields (range selection), use:
........ DEFAULT g TO h .
To fill the option field, use:
........ DEFAULT g [to h ] OPTION op .
For single field comparisons, op can be EQ, NE, GE, GT, LE, LT, CP, or NP. The default value is EQ. For range selections, op can be BT or NB. The default value is BT.
To fill the sign field, use:
........ DEFAULT g [to h ] [OPTION op ] SIGN s .
The value of s can be I or E. The default value is I.
The input fields of the selection criterion are filled with the default values. The user can accept or change these values.
REPORT demo_sel_screen_select_default. DATA wa_spfli TYPE spfli. SELECT-OPTIONS airline FOR wa_spfli-carrid DEFAULT 'AA' TO 'LH' OPTION nb SIGN i.
The following standard selection screen appears:
The symbol before the first field FROM shows that the airline - option field contains operator NB . This symbol is green to show that the airline - sign field contains value I. The arrow on the right pushbutton is not green since only one row of the selection table is filled.