Show TOC

Basic Form of Selection CriteriaLocate this document in the navigation structure

Use

You use the SELECT-OPTIONS statement to declare selection tables and create corresponding input fields on the associated selection screen. You can modify the associated text as a selection text . When the selection screen is processed, the values entered by the user into the input fields are assigned to the header line of the selection table and appended to the table. The position of the statement in the declaration part of the program determines the selection screen to which the input fields belong.

The basic form of the SELECT-OPTIONS statement is as follows:

SELECT-OPTIONS seltab FOR f .

It declares a selection criterion seltab that is linked to a local program field f . The names of selection criteria are currently restricted to eight characters. Valid data types of f include all elementary ABAP types except data type f . You cannot use data type f , references, or aggregate types. If you want to use the selection criterion to restrict database selections, it is a good idea to type the field f with reference to a column of the corresponding database table. It then inherits all of the attributes of the data type already defined in the ABAP Dictionary. In particular, the field help (F1) and the possible entries help (F4) defined for these fields in the Dictionary are available to the user on the selection screen.

The selection table seltab , which has the same name, is usually filled by the user on the selection screen or by calling programs. You can also process the selection table like any other internal table in the program.

        
REPORT demo_sel_screen_select_options.
        
DATA wa_carrid TYPE spfli-carrid.
        
SELECT-OPTIONS airline FOR wa_carrid.
        
LOOP AT airline.
        
WRITE: / 'SIGN:', airline-sign,
        
'OPTION:', airline-option,
        
'LOW:', airline-low,
        
'HIGH:', airline-high.
        
ENDLOOP.
         

After the executable program demo has been started, the following standard selection screen appears:

Two input fields and a pushbutton to enter additional values for the selection criterion are displayed. The value that the user enters into the first input field is written into the airline-low component of the selection table. The value that the user enters into the second field is written into the airline-high component of the selection table.

If the user enters values as shown below:

the output list will appear as follows:

SIGN: I OPTION: EQ LOW: AA HIGH:

If the user leaves the second field blank (single field comparison), the default settings for sign and option are I and EQ .

If the user enters values as shown below:

the output list will appear as follows:

SIGN: I OPTION: BT LOW: AA HIGH: LH

If the user enters a value in the second field (ranges selection), the default settings for sign and option are I and BT .

To set up a more complex selection pattern, the user can choose the pushbutton on the right side of the selection screen to display the Multiple Selection window and enter the following values:

and:

If the user adopts the multiple selection, the arrow on the selection screen turns green to indicate that multiple selections have been entered.

The list output is:

SIGN: I OPTION: EQ LOW: AA HIGH:

SIGN: I OPTION: EQ LOW: AF HIGH:

SIGN: I OPTION: BT LOW: DL HIGH: LH

SIGN: I OPTION: BT LOW: SA HIGH: UA

Using a multiple selection means appending several rows to a selection table.

The user can also specify exclusive criteria as multiple selections:

and:

The list output is:

SIGN: E OPTION: EQ LOW: FC HIGH:

SIGN: E OPTION: BT LOW: SQ HIGH: SR

If exclusive criteria are used, the sign component of the selection table contains the value E.

To explicitly set the sign and option values, the user must select the input fields on the selection screen or the Multiple Selection screen either by double-clicking them or by choosing F2.

On the Maintain Selection Options screen that, for single field comparisons, looks like this, the user can select an operator for the option field and switch between I and E for the sign field in the lowest line. On the selection screen, symbols on the left side of the input field are used to indicate the selection.

These symbols are green to show that the sign field has the value I. If the sign field has the value E, the symbols are red.

In this case, the list will appear as follows:

SIGN: E OPTION: GE LOW: AA HIGH: