SAP FREE SELECTION ABEXA

Get Example source ABAP code based on a different SAP table
  


ARTICLE

Dynamic Selections
This example demonstrates how a free selection is used in a program.

ABAP_SOURCE_CODE
ABAP_EXEC

ABAP_DESCRIPTION
This example shows the simplest way to use a free selection in a program. When the value 'T' of the parameter KIND is passed, the function module FREE_SELECTIONS_INIT is configured so that free selections are prepared for database tables in 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 free selections for the database table. The user can select which database fields are used for free selections, and can then make these selections.
Once the user confirms the selected free 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 checks whether the database table specified exists and can be used.