SAP STU3_ADMIN_SELECT_SQL_REMOTE Function Module for Execute a select statement for a remote connection
STU3_ADMIN_SELECT_SQL_REMOTE is a standard stu3 admin select sql remote SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Execute a select statement for a remote connection 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 stu3 admin select sql remote FM, simply by entering the name STU3_ADMIN_SELECT_SQL_REMOTE into the relevant SAP transaction such as SE37 or SE38.
Function Group: STU3_ADMIN
Program Name: SAPLSTU3_ADMIN
Main Program: SAPLSTU3_ADMIN
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function STU3_ADMIN_SELECT_SQL_REMOTE 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 'STU3_ADMIN_SELECT_SQL_REMOTE'"Execute a select statement for a remote connection.
EXPORTING
* CON_NAME = "Logical name for a database connection
* SCHEMA = "Schema
TABNAME = "Table Name for Select
TABSTRUC = "DDIC Definition of select table
* WHERE_CLAUSE = "Lines for WHERE Clause
* DO_NOT_CLOSE_CON = "General Flag
* UPTO_ROWS = "Number of rows to fetch
* DISTINCT = "Specify DISTINCT in SELECT clause
* REPORT_ERROR_TO_SYSLOG = ABAP_TRUE "
IMPORTING
RESULT = "Reference to Result itab
SQLERR_REF = "Exception Class for SQL Error
CHANGING
* CON_REF = "Database Connection
TABLES
* SELECT_LIST = "Set of columns for SELECT clause with DISTINCT
EXCEPTIONS
ADBC_SQL_ERROR = 1 DB_CON_NOT_ESTABLISHED = 2 INTERNAL_ERROR = 3
IMPORTING Parameters details for STU3_ADMIN_SELECT_SQL_REMOTE
CON_NAME - Logical name for a database connection
Data type: DBCON-CON_NAMEOptional: Yes
Call by Reference: Yes
SCHEMA - Schema
Data type: DB2CREATOROptional: Yes
Call by Reference: No ( called with pass by value option)
TABNAME - Table Name for Select
Data type: TABNAMEOptional: No
Call by Reference: Yes
TABSTRUC - DDIC Definition of select table
Data type: DD02L-TABNAMEOptional: No
Call by Reference: Yes
WHERE_CLAUSE - Lines for WHERE Clause
Data type: DB2WHERE_TOptional: Yes
Call by Reference: Yes
DO_NOT_CLOSE_CON - General Flag
Data type: FLAGOptional: Yes
Call by Reference: Yes
UPTO_ROWS - Number of rows to fetch
Data type: IOptional: Yes
Call by Reference: Yes
DISTINCT - Specify DISTINCT in SELECT clause
Data type: ABAP_BOOLOptional: Yes
Call by Reference: No ( called with pass by value option)
REPORT_ERROR_TO_SYSLOG -
Data type: ABAP_BOOLDefault: ABAP_TRUE
Optional: Yes
Call by Reference: Yes
EXPORTING Parameters details for STU3_ADMIN_SELECT_SQL_REMOTE
RESULT - Reference to Result itab
Data type: DATAOptional: No
Call by Reference: Yes
SQLERR_REF - Exception Class for SQL Error
Data type: CX_SQL_EXCEPTIONOptional: No
Call by Reference: Yes
CHANGING Parameters details for STU3_ADMIN_SELECT_SQL_REMOTE
CON_REF - Database Connection
Data type: CL_SQL_CONNECTIONOptional: Yes
Call by Reference: Yes
TABLES Parameters details for STU3_ADMIN_SELECT_SQL_REMOTE
SELECT_LIST - Set of columns for SELECT clause with DISTINCT
Data type: ADBC_TABCOL_DESCR_TABOptional: Yes
Call by Reference: Yes
EXCEPTIONS details
ADBC_SQL_ERROR -
Data type:Optional: No
Call by Reference: Yes
DB_CON_NOT_ESTABLISHED - Could not establish a DB connection
Data type:Optional: No
Call by Reference: Yes
INTERNAL_ERROR -
Data type:Optional: No
Call by Reference: Yes
Copy and paste ABAP code example for STU3_ADMIN_SELECT_SQL_REMOTE 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_result | TYPE DATA, " | |||
| lv_con_ref | TYPE CL_SQL_CONNECTION, " | |||
| lv_con_name | TYPE DBCON-CON_NAME, " | |||
| lt_select_list | TYPE STANDARD TABLE OF ADBC_TABCOL_DESCR_TAB, " | |||
| lv_adbc_sql_error | TYPE ADBC_TABCOL_DESCR_TAB, " | |||
| lv_schema | TYPE DB2CREATOR, " | |||
| lv_sqlerr_ref | TYPE CX_SQL_EXCEPTION, " | |||
| lv_db_con_not_established | TYPE CX_SQL_EXCEPTION, " | |||
| lv_tabname | TYPE TABNAME, " | |||
| lv_internal_error | TYPE TABNAME, " | |||
| lv_tabstruc | TYPE DD02L-TABNAME, " | |||
| lv_where_clause | TYPE DB2WHERE_T, " | |||
| lv_do_not_close_con | TYPE FLAG, " | |||
| lv_upto_rows | TYPE I, " | |||
| lv_distinct | TYPE ABAP_BOOL, " | |||
| lv_report_error_to_syslog | TYPE ABAP_BOOL. " ABAP_TRUE |
|   CALL FUNCTION 'STU3_ADMIN_SELECT_SQL_REMOTE' "Execute a select statement for a remote connection |
| EXPORTING | ||
| CON_NAME | = lv_con_name | |
| SCHEMA | = lv_schema | |
| TABNAME | = lv_tabname | |
| TABSTRUC | = lv_tabstruc | |
| WHERE_CLAUSE | = lv_where_clause | |
| DO_NOT_CLOSE_CON | = lv_do_not_close_con | |
| UPTO_ROWS | = lv_upto_rows | |
| DISTINCT | = lv_distinct | |
| REPORT_ERROR_TO_SYSLOG | = lv_report_error_to_syslog | |
| IMPORTING | ||
| RESULT | = lv_result | |
| SQLERR_REF | = lv_sqlerr_ref | |
| CHANGING | ||
| CON_REF | = lv_con_ref | |
| TABLES | ||
| SELECT_LIST | = lt_select_list | |
| EXCEPTIONS | ||
| ADBC_SQL_ERROR = 1 | ||
| DB_CON_NOT_ESTABLISHED = 2 | ||
| INTERNAL_ERROR = 3 | ||
| . " STU3_ADMIN_SELECT_SQL_REMOTE | ||
ABAP code using 7.40 inline data declarations to call FM STU3_ADMIN_SELECT_SQL_REMOTE
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 CON_NAME FROM DBCON INTO @DATA(ld_con_name). | ||||
| "SELECT single TABNAME FROM DD02L INTO @DATA(ld_tabstruc). | ||||
| DATA(ld_report_error_to_syslog) | = ABAP_TRUE. | |||
Search for further information about these or an SAP related objects