SAP FREE_SELECTIONS_INIT Function Module for Initialize dynamic selection: Declare permitted tables ...
FREE_SELECTIONS_INIT is a standard free selections init SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Initialize dynamic selection: Declare permitted tables ... processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for free selections init FM, simply by entering the name FREE_SELECTIONS_INIT into the relevant SAP transaction such as SE37 or SE38.
Function Group: SSEL
Program Name: SAPLSSEL
Main Program: SAPLSSEL
Appliation area: S
Release date: 26-Feb-1998
Mode(Normal, Remote etc): Normal Function Module
Update:

Function FREE_SELECTIONS_INIT pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION 'FREE_SELECTIONS_INIT'"Initialize dynamic selection: Declare permitted tables ....
EXPORTING
* KIND = 'T' "Type of field list
* EXPRESSIONS = "Initial selections
* FIELD_RANGES_INT = "Initial Selections in Form of Ranges Tables
* FIELD_GROUPS_KEY = "Selection view key
* RESTRICTION = "Option restrictions of individual selections
* ALV = "Internal Use
* CURR_QUAN_PROG = SY-CPROG "Program for fetching currency reference
* CURR_QUAN_RELATION = "Assignment quantity field -> currency key field.
IMPORTING
SELECTION_ID = "Identification for FREE_SELECTIONS_DIALOG
WHERE_CLAUSES = "Selections in form of WHERE clauses
EXPRESSIONS = "Initial selections
FIELD_RANGES = "Selections in form of RANGES tables
NUMBER_OF_ACTIVE_FIELDS = "Number of fields with selections
TABLES
* TABLES_TAB = "Desired tables
* ALV_QINFO = "Internal Field
* TABFIELDS_NOT_DISPLAY = "Child T: Hide Fields
* FIELDS_TAB = "Preselect fields
* FIELD_DESC = "Description of non-Dictionary fields
* FIELD_TEXTS = "Own selection texts
* EVENTS = "Events for which control is required
* EVENT_FIELDS = "Fields for field-specific events
* FIELDS_NOT_SELECTED = "Kind F: Fields not initially selected
* NO_INT_CHECK = "Fields for which the interval check is to be deactivated
EXCEPTIONS
FIELDS_INCOMPLETE = 1 INCONSISTENT_AREA = 10 KIND_F_NO_FIELDS_LEFT = 11 KIND_F_NO_FIELDS = 12 TOO_MANY_FIELDS = 13 DUP_FIELD = 14 FIELD_NO_TYPE = 15 FIELD_ILL_TYPE = 16 DUP_EVENT_FIELD = 17 NODE_NOT_IN_LDB = 18 AREA_NO_FIELD = 19 FIELDS_NO_JOIN = 2 FIELD_NOT_FOUND = 3 NO_TABLES = 4 TABLE_NOT_FOUND = 5 EXPRESSION_NOT_SUPPORTED = 6 INCORRECT_EXPRESSION = 7 ILLEGAL_KIND = 8 AREA_NOT_FOUND = 9
IMPORTING Parameters details for FREE_SELECTIONS_INIT
KIND - Type of field list
Data type:Default: 'T'
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPRESSIONS - Initial selections
Data type: RSDS_TEXPROptional: Yes
Call by Reference: No ( called with pass by value option)
FIELD_RANGES_INT - Initial Selections in Form of Ranges Tables
Data type: RSDS_TRANGEOptional: Yes
Call by Reference: No ( called with pass by value option)
FIELD_GROUPS_KEY - Selection view key
Data type: RSDSQCATOptional: Yes
Call by Reference: No ( called with pass by value option)
RESTRICTION - Option restrictions of individual selections
Data type: SSCR_RESTRICT_DSOptional: Yes
Call by Reference: No ( called with pass by value option)
ALV - Internal Use
Data type:Optional: Yes
Call by Reference: No ( called with pass by value option)
CURR_QUAN_PROG - Program for fetching currency reference
Data type: SY-REPIDDefault: SY-CPROG
Optional: Yes
Call by Reference: No ( called with pass by value option)
CURR_QUAN_RELATION - Assignment quantity field -> currency key field.
Data type: SSCR_CURR_QUAN_TOptional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for FREE_SELECTIONS_INIT
SELECTION_ID - Identification for FREE_SELECTIONS_DIALOG
Data type: RSDYNSEL-SELIDOptional: No
Call by Reference: No ( called with pass by value option)
WHERE_CLAUSES - Selections in form of WHERE clauses
Data type: RSDS_TWHEREOptional: No
Call by Reference: No ( called with pass by value option)
EXPRESSIONS - Initial selections
Data type: RSDS_TEXPROptional: No
Call by Reference: No ( called with pass by value option)
FIELD_RANGES - Selections in form of RANGES tables
Data type: RSDS_TRANGEOptional: No
Call by Reference: No ( called with pass by value option)
NUMBER_OF_ACTIVE_FIELDS - Number of fields with selections
Data type: SY-TFILLOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for FREE_SELECTIONS_INIT
TABLES_TAB - Desired tables
Data type: RSDSTABSOptional: Yes
Call by Reference: No ( called with pass by value option)
ALV_QINFO - Internal Field
Data type: LVC_S_QINFOptional: Yes
Call by Reference: Yes
TABFIELDS_NOT_DISPLAY - Child T: Hide Fields
Data type: RSDSFIELDSOptional: Yes
Call by Reference: Yes
FIELDS_TAB - Preselect fields
Data type: RSDSFIELDSOptional: Yes
Call by Reference: No ( called with pass by value option)
FIELD_DESC - Description of non-Dictionary fields
Data type: FLDCONVERTOptional: Yes
Call by Reference: No ( called with pass by value option)
FIELD_TEXTS - Own selection texts
Data type: RSDSTEXTSOptional: Yes
Call by Reference: No ( called with pass by value option)
EVENTS - Events for which control is required
Data type: RSDSEVENTSOptional: Yes
Call by Reference: No ( called with pass by value option)
EVENT_FIELDS - Fields for field-specific events
Data type: RSDSEVFLDSOptional: Yes
Call by Reference: No ( called with pass by value option)
FIELDS_NOT_SELECTED - Kind F: Fields not initially selected
Data type: RSDSFIELDSOptional: Yes
Call by Reference: No ( called with pass by value option)
NO_INT_CHECK - Fields for which the interval check is to be deactivated
Data type: RSDSTABSOptional: Yes
Call by Reference: Yes
EXCEPTIONS details
FIELDS_INCOMPLETE - Only PRIM_FNAME filled
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
INCONSISTENT_AREA - Inconsistent selection view
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
KIND_F_NO_FIELDS_LEFT - KIND = F, but no field left after cleanup
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
KIND_F_NO_FIELDS - KIND = F, but no field passed
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
TOO_MANY_FIELDS - Too many entries in FIELDS_TAB
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
DUP_FIELD - Field doubles in FIELDS_TAB
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
FIELD_NO_TYPE - No field type in the field description
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
FIELD_ILL_TYPE - Non-allowed field type
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
DUP_EVENT_FIELD - Field doubled in EVENT_FIELDS
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NODE_NOT_IN_LDB - Node not part of logical database
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
AREA_NO_FIELD - Selection view has no fields
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
FIELDS_NO_JOIN - Field assignment without join
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
FIELD_NOT_FOUND - Dictionary field not found
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NO_TABLES - Table P_TABLES is empty
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
TABLE_NOT_FOUND - A table from P_TABLES was not found
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
EXPRESSION_NOT_SUPPORTED - Expression not (yet) supported
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
INCORRECT_EXPRESSION - Incorrect logical expression
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
ILLEGAL_KIND - KIND not equal to T,G,F or: G without P_RSDSQCAT
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
AREA_NOT_FOUND - Invalid key FIELD_GROUPS_KEY
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for FREE_SELECTIONS_INIT Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.| DATA: | ||||
| lv_kind | TYPE STRING, " 'T' | |||
| lt_tables_tab | TYPE STANDARD TABLE OF RSDSTABS, " | |||
| lv_selection_id | TYPE RSDYNSEL-SELID, " | |||
| lv_fields_incomplete | TYPE RSDYNSEL, " | |||
| lt_alv_qinfo | TYPE STANDARD TABLE OF LVC_S_QINF, " | |||
| lv_inconsistent_area | TYPE LVC_S_QINF, " | |||
| lv_kind_f_no_fields_left | TYPE LVC_S_QINF, " | |||
| lv_kind_f_no_fields | TYPE LVC_S_QINF, " | |||
| lv_too_many_fields | TYPE LVC_S_QINF, " | |||
| lv_dup_field | TYPE LVC_S_QINF, " | |||
| lv_field_no_type | TYPE LVC_S_QINF, " | |||
| lv_field_ill_type | TYPE LVC_S_QINF, " | |||
| lv_dup_event_field | TYPE LVC_S_QINF, " | |||
| lv_node_not_in_ldb | TYPE LVC_S_QINF, " | |||
| lv_area_no_field | TYPE LVC_S_QINF, " | |||
| lv_expressions | TYPE RSDS_TEXPR, " | |||
| lv_where_clauses | TYPE RSDS_TWHERE, " | |||
| lv_fields_no_join | TYPE RSDS_TWHERE, " | |||
| lt_tabfields_not_display | TYPE STANDARD TABLE OF RSDSFIELDS, " | |||
| lt_fields_tab | TYPE STANDARD TABLE OF RSDSFIELDS, " | |||
| lv_expressions | TYPE RSDS_TEXPR, " | |||
| lv_field_not_found | TYPE RSDS_TEXPR, " | |||
| lv_field_ranges_int | TYPE RSDS_TRANGE, " | |||
| lv_no_tables | TYPE RSDS_TRANGE, " | |||
| lt_field_desc | TYPE STANDARD TABLE OF FLDCONVERT, " | |||
| lv_field_ranges | TYPE RSDS_TRANGE, " | |||
| lv_field_groups_key | TYPE RSDSQCAT, " | |||
| lt_field_texts | TYPE STANDARD TABLE OF RSDSTEXTS, " | |||
| lv_restriction | TYPE SSCR_RESTRICT_DS, " | |||
| lv_table_not_found | TYPE SSCR_RESTRICT_DS, " | |||
| lv_number_of_active_fields | TYPE SY-TFILL, " | |||
| lv_alv | TYPE SY, " | |||
| lt_events | TYPE STANDARD TABLE OF RSDSEVENTS, " | |||
| lv_expression_not_supported | TYPE RSDSEVENTS, " | |||
| lt_event_fields | TYPE STANDARD TABLE OF RSDSEVFLDS, " | |||
| lv_curr_quan_prog | TYPE SY-REPID, " SY-CPROG | |||
| lv_incorrect_expression | TYPE SY, " | |||
| lv_illegal_kind | TYPE SY, " | |||
| lv_curr_quan_relation | TYPE SSCR_CURR_QUAN_T, " | |||
| lt_fields_not_selected | TYPE STANDARD TABLE OF RSDSFIELDS, " | |||
| lt_no_int_check | TYPE STANDARD TABLE OF RSDSTABS, " | |||
| lv_area_not_found | TYPE RSDSTABS. " |
|   CALL FUNCTION 'FREE_SELECTIONS_INIT' "Initialize dynamic selection: Declare permitted tables ... |
| EXPORTING | ||
| KIND | = lv_kind | |
| EXPRESSIONS | = lv_expressions | |
| FIELD_RANGES_INT | = lv_field_ranges_int | |
| FIELD_GROUPS_KEY | = lv_field_groups_key | |
| RESTRICTION | = lv_restriction | |
| ALV | = lv_alv | |
| CURR_QUAN_PROG | = lv_curr_quan_prog | |
| CURR_QUAN_RELATION | = lv_curr_quan_relation | |
| IMPORTING | ||
| SELECTION_ID | = lv_selection_id | |
| WHERE_CLAUSES | = lv_where_clauses | |
| EXPRESSIONS | = lv_expressions | |
| FIELD_RANGES | = lv_field_ranges | |
| NUMBER_OF_ACTIVE_FIELDS | = lv_number_of_active_fields | |
| TABLES | ||
| TABLES_TAB | = lt_tables_tab | |
| ALV_QINFO | = lt_alt_qinfo | |
| TABFIELDS_NOT_DISPLAY | = lt_tabfields_not_display | |
| FIELDS_TAB | = lt_fields_tab | |
| FIELD_DESC | = lt_field_desc | |
| FIELD_TEXTS | = lt_field_texts | |
| EVENTS | = lt_events | |
| EVENT_FIELDS | = lt_event_fields | |
| FIELDS_NOT_SELECTED | = lt_fields_not_selected | |
| NO_INT_CHECK | = lt_no_int_check | |
| EXCEPTIONS | ||
| FIELDS_INCOMPLETE = 1 | ||
| INCONSISTENT_AREA = 10 | ||
| KIND_F_NO_FIELDS_LEFT = 11 | ||
| KIND_F_NO_FIELDS = 12 | ||
| TOO_MANY_FIELDS = 13 | ||
| DUP_FIELD = 14 | ||
| FIELD_NO_TYPE = 15 | ||
| FIELD_ILL_TYPE = 16 | ||
| DUP_EVENT_FIELD = 17 | ||
| NODE_NOT_IN_LDB = 18 | ||
| AREA_NO_FIELD = 19 | ||
| FIELDS_NO_JOIN = 2 | ||
| FIELD_NOT_FOUND = 3 | ||
| NO_TABLES = 4 | ||
| TABLE_NOT_FOUND = 5 | ||
| EXPRESSION_NOT_SUPPORTED = 6 | ||
| INCORRECT_EXPRESSION = 7 | ||
| ILLEGAL_KIND = 8 | ||
| AREA_NOT_FOUND = 9 | ||
| . " FREE_SELECTIONS_INIT | ||
ABAP code using 7.40 inline data declarations to call FM FREE_SELECTIONS_INIT
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.| DATA(ld_kind) | = 'T'. | |||
| "SELECT single SELID FROM RSDYNSEL INTO @DATA(ld_selection_id). | ||||
| "SELECT single TFILL FROM SY INTO @DATA(ld_number_of_active_fields). | ||||
| "SELECT single REPID FROM SY INTO @DATA(ld_curr_quan_prog). | ||||
| DATA(ld_curr_quan_prog) | = SY-CPROG. | |||
Search for further information about these or an SAP related objects