ABAP Keyword Documentation → ABAP - Reference → User Dialogs → Selection Screens
Dynamic Selections
A dynamic selection is a selection condition that can be entered on a selection screen generated dynamically. The associated selection screens are generated, displayed, and processed by means of the FREE_SELECTIONS_.... system function module of function group SSEL. These selection screens can be displayed independently or integrated in other screens and selection screens as subscreens. Dynamic selections can be integrated in logical databases and in any program.
Other versions: 7.31 | 7.40 | 7.54
Dynamic selections in logical databases
Logical databases
can offer dynamic selections on their selection screens. In this way, they can offer both the parameters
and selection criteria predefined statically as well as additional dynamic selection conditions for
individual nodes of the logical database that can be evaluated in the database program of the logical
database. It is sufficient to declare the dynamic selections of a logical database in this database
using the DYNAMIC SELECTIONS
addition of the SELECTION-SCREEN
statement.
The function modules for generating, displaying, and processing the dynamic selection are called in the ABAP runtime environment. Your selections are transferred directly to data objects of the database program and can be evaluated there. For more information, see Logical Databases.
Note
You can use a special addition (WITH
FREE SELECTIONS) of the SUBMIT
statement to pass parameters to the selection screens of logical databases that offer dynamic selections. When this addition is used, the function modules mentioned above are normally also used.
Dynamic selections in any programs
In ABAP programs that work with classic screens, dynamic selections can be offered by using the following two function modules directly:
- FREE_SELECTIONS_INIT
- FREE_SELECTIONS_DIALOG
Function module FREE_SELECTIONS_INIT determines the entities for which dynamic selections are to be made. This may be, for example, database tables of the ABAP Dictionary or fields that can specified freely. This function module results in a selection ID that must be transferred to function module FREE_SELECTIONS_DIALOG.
Function module FREE_SELECTIONS_DIALOG can display various configured selection screens in different
formats. You can enter dynamic selections on these selection screens for the fields offered and, if
necessary, search for fields for which you want to make dynamic selections. When you choose Save,
the function module returns the selections entered to the caller in three different formats; the caller can take these selections from the following EXPORTING
parameters:
- WHERE_CLAUSES
This parameter transfers an internal table withsql_cond
conditions generated in accordance with the dynamic selections; these conditions enable dynamic specification in theWHERE
clause ofSELECT
statements.
- FIELD_RANGES
This parameters transfers an internal table with ranges tables generated in accordance with the dynamic selections; these tables can be evaluated in relevantWHERE
conditions or logical expressions with the predicateIN
.
- EXPRESSIONS
This parameter transfers an internal table with conditions generated in accordance with the dynamic selections; these conditions are transferred in an internal format (Reverse Polish Notation). This format can be transferred to function module FREE_SELECTIONS_INIT to prepare a selection screen prepopulated with these selections. This format is required during transfer to called programs using theWITH FREE SELECTIONS
addition of theSUBMIT
statement.
For more information, see the documentation for function modules and their parameter interfaces.
Example