SAP FREE SELECTION ABEXA



Get Example source ABAP code based on a different SAP table
  



ABAP_SELSCR - Dynamic Selections
This example demonstrates how a dynamic selection is used in a program.

ABAP_SOURCE_CODE
ABAP_EXEC

ABAP_DESCRIPTION
This example shows the simplest way to use a dynamic selection in a program. When the value T of the parameter KIND is passed, the function module FREE_SELECTIONS_INIT is set to prepare dynamic selections for database tables in the ABAP Dictionary. The names of the database tables (here only one freely selectable table) are passed to the table parameter TABLES_TAB.
The result of FREE_SELECTIONS_INIT is passed to the function module FREE_SELECTIONS_DIALOG, which displays a selection screen for entering dynamic selections for the database table. The user can select which database fields are used for dynamic selections and can then make these selections.
Once the user confirms the selected dynamic selections by choosing Save, the program inherits them as a dynamic WHERE clause and then uses this clause in a dynamic SELECT statement to read the data accordingly. The result is displayed in an ALV list.
The method CHECK_TABLE_NAME_STR of the class CL_ABAP_DYN_PRG is used to check whether the database table specified exists and can be used.