SAP G_SELECT_VARIABLE Function Module for Selection of a variable (for use in sets)
G_SELECT_VARIABLE is a standard g select variable SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Selection of a variable (for use in sets) 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 g select variable FM, simply by entering the name G_SELECT_VARIABLE into the relevant SAP transaction such as SE37 or SE38.
Function Group: GSBD
Program Name: SAPLGSBD
Main Program: SAPLGSBD
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function G_SELECT_VARIABLE 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 'G_SELECT_VARIABLE'"Selection of a variable (for use in sets).
EXPORTING
* CRE_USER = '*' "
* FLAG_NO_ROLLNAME = ' ' "
* VARIABLE_TYPE = ' ' "Variable category (can be entered
* DISPLAY_ONLY = ' ' "
* EXTENDED_DISPLAY = ' ' "
* EXT_TYPES = '*' "
* FIELD_MASK = '*' "Field name (can be entered generic
* START_COLUMN = 0 "Initial column
* START_ROW = 0 "Beginning line
* TABLE = '*' "Table name (can be entered generic
* UPD_USER = '*' "
* VARIABLE_MASK = '*' "Variable name (can be entered gene
IMPORTING
VARIABLE = "Selected variable name
EXCEPTIONS
NO_VARIABLES = 1 NO_VARIABLE_PICKED = 2
IMPORTING Parameters details for G_SELECT_VARIABLE
CRE_USER -
Data type: T802G-CRNAMEDefault: '*'
Optional: Yes
Call by Reference: No ( called with pass by value option)
FLAG_NO_ROLLNAME -
Data type: FLAGDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
VARIABLE_TYPE - Variable category (can be entered
Data type: T802G-GTYPEDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
DISPLAY_ONLY -
Data type: SY-DATARDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXTENDED_DISPLAY -
Data type: CDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXT_TYPES -
Data type: CDefault: '*'
Optional: Yes
Call by Reference: No ( called with pass by value option)
FIELD_MASK - Field name (can be entered generic
Data type: T802G-FELDDefault: '*'
Optional: Yes
Call by Reference: No ( called with pass by value option)
START_COLUMN - Initial column
Data type: IOptional: Yes
Call by Reference: No ( called with pass by value option)
START_ROW - Beginning line
Data type: IOptional: Yes
Call by Reference: No ( called with pass by value option)
TABLE - Table name (can be entered generic
Data type: T802G-TABDefault: '*'
Optional: Yes
Call by Reference: No ( called with pass by value option)
UPD_USER -
Data type: T802G-UPNAMEDefault: '*'
Optional: Yes
Call by Reference: No ( called with pass by value option)
VARIABLE_MASK - Variable name (can be entered gene
Data type: CDefault: '*'
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for G_SELECT_VARIABLE
VARIABLE - Selected variable name
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
NO_VARIABLES - No appropriate variables found
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NO_VARIABLE_PICKED - No variables selected
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for G_SELECT_VARIABLE 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_cre_user | TYPE T802G-CRNAME, " '*' | |||
| lv_variable | TYPE T802G, " | |||
| lv_no_variables | TYPE T802G, " | |||
| lv_flag_no_rollname | TYPE FLAG, " SPACE | |||
| lv_variable_type | TYPE T802G-GTYPE, " SPACE | |||
| lv_display_only | TYPE SY-DATAR, " SPACE | |||
| lv_extended_display | TYPE C, " SPACE | |||
| lv_no_variable_picked | TYPE C, " | |||
| lv_ext_types | TYPE C, " '*' | |||
| lv_field_mask | TYPE T802G-FELD, " '*' | |||
| lv_start_column | TYPE I, " 0 | |||
| lv_start_row | TYPE I, " 0 | |||
| lv_table | TYPE T802G-TAB, " '*' | |||
| lv_upd_user | TYPE T802G-UPNAME, " '*' | |||
| lv_variable_mask | TYPE C. " '*' |
|   CALL FUNCTION 'G_SELECT_VARIABLE' "Selection of a variable (for use in sets) |
| EXPORTING | ||
| CRE_USER | = lv_cre_user | |
| FLAG_NO_ROLLNAME | = lv_flag_no_rollname | |
| VARIABLE_TYPE | = lv_variable_type | |
| DISPLAY_ONLY | = lv_display_only | |
| EXTENDED_DISPLAY | = lv_extended_display | |
| EXT_TYPES | = lv_ext_types | |
| FIELD_MASK | = lv_field_mask | |
| START_COLUMN | = lv_start_column | |
| START_ROW | = lv_start_row | |
| TABLE | = lv_table | |
| UPD_USER | = lv_upd_user | |
| VARIABLE_MASK | = lv_variable_mask | |
| IMPORTING | ||
| VARIABLE | = lv_variable | |
| EXCEPTIONS | ||
| NO_VARIABLES = 1 | ||
| NO_VARIABLE_PICKED = 2 | ||
| . " G_SELECT_VARIABLE | ||
ABAP code using 7.40 inline data declarations to call FM G_SELECT_VARIABLE
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.| "SELECT single CRNAME FROM T802G INTO @DATA(ld_cre_user). | ||||
| DATA(ld_cre_user) | = '*'. | |||
| DATA(ld_flag_no_rollname) | = ' '. | |||
| "SELECT single GTYPE FROM T802G INTO @DATA(ld_variable_type). | ||||
| DATA(ld_variable_type) | = ' '. | |||
| "SELECT single DATAR FROM SY INTO @DATA(ld_display_only). | ||||
| DATA(ld_display_only) | = ' '. | |||
| DATA(ld_extended_display) | = ' '. | |||
| DATA(ld_ext_types) | = '*'. | |||
| "SELECT single FELD FROM T802G INTO @DATA(ld_field_mask). | ||||
| DATA(ld_field_mask) | = '*'. | |||
| "SELECT single TAB FROM T802G INTO @DATA(ld_table). | ||||
| DATA(ld_table) | = '*'. | |||
| "SELECT single UPNAME FROM T802G INTO @DATA(ld_upd_user). | ||||
| DATA(ld_upd_user) | = '*'. | |||
| DATA(ld_variable_mask) | = '*'. | |||
Search for further information about these or an SAP related objects