ABAP - Keyword Documentation →  ABAP - Programming Language →  SAP GUI User Dialogs →  Selection Screens → 
Mail Feedback

Selection Screens - Dynamic Selections

A dynamic selection (also called free selection) is a ranges condition that can be entered on a dynamically created selection screen. The associated selection screens are created, displayed, and processed by the system function modules FREE_SELECTIONS_... of the function pool SSEL. The selection screens can be displayed as standalone selection screens, or integrated into the screen layouts of other dynpros or selection screens as a subscreen. Dynamic selections can be included in a logical database or used in any programs.

Security Hint

If used incorrectly, dynamic programming techniques can present a serious security risk. Any dynamic content that is passed to a program from the outside must be checked thoroughly or escaped before it is used in dynamic statements. This can be done using the system class CL_ABAP_DYN_PRG or the built-in function escape. See Security Risks Caused by Input from Outside.

Dynamic Selections in Logical Databases  

Logical databases can provide dynamic selections on their selection screen to specify further dynamic ranges conditions for individual nodes of the logical database, in addition to the selection parameters and selection criteria already defined statically in the database. These dynamic conditions can then be evaluated in the database program of the logical database. Dynamic selections of a logical database can be declared simply using the addition DYNAMIC SELECTIONS of the statement SELECTION-SCREEN in the database.

The ABAP runtime framework is responsible for calling function modules to create, display, and handle dynamic selections. The selections entered by the user are passed directly to data objects of the database program and can be evaluated there. For more information, see Logical Databases - Dynamic Selections.

Hint

The special addition WITH FREE SELECTIONS of the statement SUBMIT is used to pass parameters to selection screens of logical databases that provide dynamic selections. If this addition is used, the function modules mentioned above are generally also implemented.

Dynamic Selections in All Programs  

In ABAP programs that work with classic dynpros, dynamic selections can be provided by using the following two function modules directly:

The function module FREE_SELECTIONS_INIT is used to determine the entities for which dynamic selections are to be made. This could be, for example, database tables from the ABAP Dictionary or any fields specified freely. The result of the function module is a selection ID, which must be passed to the function module FREE_SELECTIONS_DIALOG.

The function module FREE_SELECTIONS_DIALOG can display differently configured selection screens in different formats. Users can enter dynamic selections on these selection screens for the fields provided there and, if required, can also select fields for which they want to perform dynamic selections. If Save is chosen, the function module returns the specified selections to the caller in three different formats, which the caller can take from the following EXPORTING parameters:

For more information, see the documentation about function modules and their parameter interface.

Executable Example

Dynamic selections



Continue
Example Selection Screens - Dynamic Selections