Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  User Dialogs →  Selection Screens →  Create Selection Screens →  SELECT-OPTIONS 

SELECT-OPTIONS - FOR

Short Reference

Other versions: 7.31 | 7.40 | 7.54

Syntax


... FOR {dobj|(name)} ... . 

Alternatives

1. ... FOR dobj
2. ... FOR (name)

Effect

This addition determines the data type of the columns low and high in the selection table. The data type can be defined by means of a static reference to an existing data object dobj or by a dynamic reference to a data type from ABAP Dictionary in name.

If the addition NO-DISPLAY is not specified, the data type of columns low and high in the selection table must be elementary and flat and the numeric type f is not allowed. If the addition NO-DISPLAY is specified, any flat data types are possible.


Note

When referencing data types from ABAP Dictionary, the selection criterion inherits all the screen-relevant attributes defined there. During data transport to and from the input fields, any conversion routines defined in the domain are executed. The text defined in ABAP Dictionary can be inherited as a selection text. Note, however, that the input fields on the selection screen are linked with a global data object belonging to the program and do not have any real reference to the dictionary, in contrast to screen fields, which are created in the Screen Painter with reference to the dictionary. This has a particular effect on automatic support for input help (F4) and value checking. In comparison to general screens, input help functionality is limited here in that dependencies between fields and previously entered data are not taken into account. No automatic value checking is performed.

Alternative 1

... FOR dobj

Effect

If you specify this addition, columns low and high in the selection table inherit all the attributes of a data object dobj that has already been declared, most importantly a reference to ABAP Dictionary, if applicable. For dobj, you must specify a data object that is elementary and flat and not of the type f (unless you are using NO-DISPLAY).


Note

As well as the data objects referred to using FOR from their own program, the public attributes of global classes are also relevant data objects.


Example

Typical declaration and application of a selection criterion.

DATA spfli_wa TYPE spfli. 

SELECT-OPTIONS s_carrid FOR spfli_wa-carrid. 

SELECT * 
       FROM spfli 
       INTO spfli_wa 
       WHERE carrid IN s_carrid. 
  ... 
ENDSELECT. 

Alternative 2

... FOR (name)

Effect

You use this addition to create the columns low and high in the selection table with data type c and length 45. The input fields are displayed on the selection screen, but with a length, field help, and input help appropriate for the data type specified in name.

For name, you must specify a flat character-like data object that contains the name of a component in a flat structure from ABAP Dictionary in block capitals when the selection screen is accessed. You can specify a flat character-like literal for name, but its content is ignored. If the text pool currently loaded does not contain a selection text for the parameter, the output field displays the corresponding field label from ABAP Dictionary. When data is transported from the input field to the selection table, the content is converted as if it were assigned by the corresponding ABAP data type (no formatting characters, period as a decimal separator, date format "yyyymmdd", and so on).

If the content of name is not a structure component in ABAP Dictionary, the input fields are displayed according to the actual type of columns low and high. This also applies if a literal is specified for name. If a selection text for the parameter is not created in the text pool currently loaded, the output field contains the text "Generic Selection Option".

A dynamic reference to a data type is not possible in a selection include for a logical database.


Example


Dynamic design of the selection criterion selcrit on selection screen 500 based on the entries in the standard selection screen for an executable program.

PARAMETERS: dbtab  TYPE c LENGTH 30, 
            column TYPE c LENGTH 30. 

DATA name(80) TYPE c. 

SELECTION-SCREEN BEGIN OF SCREEN 500 AS WINDOW. 
SELECT-OPTIONS selcrit FOR (name). 
SELECTION-SCREEN END OF SCREEN 500. 

name = dbtab && '-' && column. 

CALL SELECTION-SCREEN 500 STARTING AT 10 10. 

Continue

Selection Screens, Basic Form of Selection Criteria