SAP G_SELECT_FIELD Function Module for Selection of a Field from a Table
G_SELECT_FIELD is a standard g select field 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 Field from a Table 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 field FM, simply by entering the name G_SELECT_FIELD into the relevant SAP transaction such as SE37 or SE38.
Function Group: GSBD
Program Name: SAPLGSBD
Main Program: SAPLGSBD
Appliation area: G
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function G_SELECT_FIELD 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_FIELD'"Selection of a Field from a Table.
EXPORTING
* CALL_IT_FIELD = ' ' "Flag: 'Field name' Instead of 'Dimension'
* FIELD_MASK = '*' "Mask of the Desired Field Name
* START_COLUMN = 0 "Column of the 'Upper Left' Corner
* START_ROW = 0 "Line of the 'Upper Left' Corner
TABLE = "Name of table
* TEXT_MASK = '*' "Mask for Field Text
IMPORTING
FIELD_NAME = "Name of the Selected Field
EXCEPTIONS
NO_FIELD_PICKED = 1 NO_FIELDS = 2 TABLE_NOT_FOUND = 3
IMPORTING Parameters details for G_SELECT_FIELD
CALL_IT_FIELD - Flag: 'Field name' Instead of 'Dimension'
Data type: CDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
FIELD_MASK - Mask of the Desired Field Name
Data type: SETHIER-FIELDNAMEDefault: '*'
Optional: Yes
Call by Reference: No ( called with pass by value option)
START_COLUMN - Column of the 'Upper Left' Corner
Data type:Optional: Yes
Call by Reference: No ( called with pass by value option)
START_ROW - Line of the 'Upper Left' Corner
Data type:Optional: Yes
Call by Reference: No ( called with pass by value option)
TABLE - Name of table
Data type: T883S-UTABOptional: No
Call by Reference: No ( called with pass by value option)
TEXT_MASK - Mask for Field Text
Data type: DFIES-FIELDTEXTDefault: '*'
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for G_SELECT_FIELD
FIELD_NAME - Name of the Selected Field
Data type: SETHIER-FIELDNAMEOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
NO_FIELD_PICKED - Selection was Cancelled by the User
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NO_FIELDS - No Fields of the Table Match the Mask
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
TABLE_NOT_FOUND - Table does not exist
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for G_SELECT_FIELD 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_field_name | TYPE SETHIER-FIELDNAME, " | |||
| lv_call_it_field | TYPE C, " SPACE | |||
| lv_no_field_picked | TYPE C, " | |||
| lv_no_fields | TYPE C, " | |||
| lv_field_mask | TYPE SETHIER-FIELDNAME, " '*' | |||
| lv_start_column | TYPE SETHIER, " 0 | |||
| lv_table_not_found | TYPE SETHIER, " | |||
| lv_start_row | TYPE SETHIER, " 0 | |||
| lv_table | TYPE T883S-UTAB, " | |||
| lv_text_mask | TYPE DFIES-FIELDTEXT. " '*' |
|   CALL FUNCTION 'G_SELECT_FIELD' "Selection of a Field from a Table |
| EXPORTING | ||
| CALL_IT_FIELD | = lv_call_it_field | |
| FIELD_MASK | = lv_field_mask | |
| START_COLUMN | = lv_start_column | |
| START_ROW | = lv_start_row | |
| TABLE | = lv_table | |
| TEXT_MASK | = lv_text_mask | |
| IMPORTING | ||
| FIELD_NAME | = lv_field_name | |
| EXCEPTIONS | ||
| NO_FIELD_PICKED = 1 | ||
| NO_FIELDS = 2 | ||
| TABLE_NOT_FOUND = 3 | ||
| . " G_SELECT_FIELD | ||
ABAP code using 7.40 inline data declarations to call FM G_SELECT_FIELD
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 FIELDNAME FROM SETHIER INTO @DATA(ld_field_name). | ||||
| DATA(ld_call_it_field) | = ' '. | |||
| "SELECT single FIELDNAME FROM SETHIER INTO @DATA(ld_field_mask). | ||||
| DATA(ld_field_mask) | = '*'. | |||
| "SELECT single UTAB FROM T883S INTO @DATA(ld_table). | ||||
| "SELECT single FIELDTEXT FROM DFIES INTO @DATA(ld_text_mask). | ||||
| DATA(ld_text_mask) | = '*'. | |||
Search for further information about these or an SAP related objects