SAP SELECT-OPTIONS FOR ABAP Statements



Get Example source ABAP code based on a different SAP table
  


• FOR SELECT-OPTIONS

SELECT-OPTIONS, FOR
Short Reference

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

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

What does it do?
This addition determines the data type of the columns low and high in the selection table. The data type can be defined using 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 the 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, except enumerated types, are possible.



Latest notes:

When referencing data types from the ABAP Dictionary, the selection criterion inherits all the screen-relevant properties 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 inherited as a selection text. It should be noted, however, that the input fields on the selection screen are linked with a global data object of the program and are not given a real reference to the dictionary, in contrast to dynpro 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 dynpros, input help functionality is limited here in such a way that dependencies between fields and previously entered data are not respected. No automatic value checking is performed.
ABAP_HINT_END

ABAP Alternative 1 ... FOR dobj

What does it do?
If this addition is specified, the columns low and high of the selection table inherit all the properties of a data object dobj that has already been declared, in particular any reference to the ABAP Dictionary. dobj expects a data object that is elementary and flat and not of the type f (unless NO-DISPLAY is used) and is not an enumerated type.



Latest notes:

The data objects that can be referred to using FOR include the public attributes of global classes as well as those of their own program.
ABAP_HINT_END



Example ABAP Coding

Typical declaration and application of a selection criterion.
ABEXA 00569
ABAP_EXAMPLE_END

ABAP Alternative 2 ... FOR (name)

What does it do?
This addition is used 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 .
name expects a flat character-like data object that contains the name of a component in a flat structure from the ABAP Dictionary in uppercase letters when the selection screen is called. The following can be specified for name:
Constant If the data object name is specified as a constant, it can be evaluated statically, and the specified component is identified as the used object.
Variable
BEGIN_SECTION ID SELECT-OPTIONS-FOR-DYNAMIC If the data object name is specified as a variable, it is specified only dynamically, and the content is not evaluated statically.
END_SECTION ID SELECT-OPTIONS-FOR-DYNAMIC
A text field literal can be specified for name, but its content is not evaluated. If the text pool currently loaded does not contain a selection text for the selection criterion, 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 the columns low and high. This also applies if a literal is specified for name. If a selection text for the criterion 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 ABAP Coding

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

Return to menu