SELECT-OPTIONS - FOR

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 the 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 the ABAP Dictionary, the selection criterion transfers 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 the ABAP Dictionary can be copied 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 transfer all the attributes of a data object dobj that has already been declared, most importantly a reference to the 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

In addition to data objects in your own program, you can use FOR to reference public attributes of local classes.

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

If you specify this addition, columns low and high in the selection table are created with the data type c with a length of 45. The input fields are displayed on the selection screen but in a length and with a field and input help that matches 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 the ABAP Dictionary in block capitals when the selection screen is accessed. If the text pool currently loaded does not contain a selection text for the parameter, the output field displays the corresponding field label from the 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 the ABAP Dictionary, the input fields are displayed according to the actual type of columns low and high. 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.

CONCATENATE dbtab '-' column INTO name.

CALL SELECTION-SCREEN 500 STARTING AT 10 10.