SAP Function Modules

RSDU_EXEC_SQL_HDB SAP Function module - Execute Native-SQL Statement (no CURSORs, host-variables etc.)







RSDU_EXEC_SQL_HDB is a standard SAP function module available within R/3 SAP systems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import and export parameters, exceptions etc as well as any documentation contributions (Comments) specific to the object.

See here to view full function module documentation and code listing, simply by entering the name RSDU_EXEC_SQL_HDB into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: RSDU_CORE_SQL_HDB
Released Date: Not Released
Processing type: Normal fucntion module
Normal function module settings


Pattern for FM RSDU_EXEC_SQL_HDB - RSDU EXEC SQL HDB





CALL FUNCTION 'RSDU_EXEC_SQL_HDB' "Execute Native-SQL Statement (no CURSORs, host-variables etc.)
* EXPORTING
*   i_t_stmt =                  " rsdu_t_abapsource  SQL Statement in an Internal Table
*   i_stmt =                    " c             SQL Statement in a String
*   i_lower_trans = RS_C_FALSE  " rs_bool       SQL Keywords in Lowercase Yes/No
*   i_error_download = RS_C_TRUE  " rs_bool     Download of a Erroneous SQL Statement Yes/No
*   i_connection = 'DEFAULT'    " dbcon_name
  IMPORTING
    e_sqlerr =                  " i             DB-Specific SQL-Error Code (OK = 0)
    e_sqlerrtxt =               " rsdu_string72  SQL Error Text
    e_stmtsize =                " i             Size of the SQL Statement in Bytes
    e_num_rows =                " i
  CHANGING
    c_processed = RS_C_FALSE    " rs_bool       Boolean
  EXCEPTIONS
    SQL_ERROR = 1               "               SQL Error (Error Code in E_SQLERR)
    STATEMENT_TOO_COMPLEX = 2   "               SQL Statement Too Complex (Long)
    NO_STATEMENT = 3            "               No Internal Table or String
    INHERITED_ERROR = 4         "               Internal Error
    DUPREC = 5                  "
    OBJ_EXISTS = 6              "
    OBJ_NOT_FOUND = 7           "
    .  "  RSDU_EXEC_SQL_HDB

ABAP code example for Function Module RSDU_EXEC_SQL_HDB





The ABAP code below is a full code listing to execute function module RSDU_EXEC_SQL_HDB including all data declarations. The code uses 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 original method of declaring data variables up front. 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).

DATA:
ld_e_sqlerr  TYPE I ,
ld_e_sqlerrtxt  TYPE RSDU_STRING72 ,
ld_e_stmtsize  TYPE I ,
ld_e_num_rows  TYPE I .

DATA(ld_c_processed) = 'Check type of data required'.
DATA(ld_i_t_stmt) = 'Check type of data required'.
DATA(ld_i_stmt) = 'Check type of data required'.
DATA(ld_i_lower_trans) = 'Check type of data required'.
DATA(ld_i_error_download) = 'Check type of data required'.
DATA(ld_i_connection) = 'Check type of data required'. . CALL FUNCTION 'RSDU_EXEC_SQL_HDB' * EXPORTING * i_t_stmt = ld_i_t_stmt * i_stmt = ld_i_stmt * i_lower_trans = ld_i_lower_trans * i_error_download = ld_i_error_download * i_connection = ld_i_connection IMPORTING e_sqlerr = ld_e_sqlerr e_sqlerrtxt = ld_e_sqlerrtxt e_stmtsize = ld_e_stmtsize e_num_rows = ld_e_num_rows CHANGING c_processed = ld_c_processed EXCEPTIONS SQL_ERROR = 1 STATEMENT_TOO_COMPLEX = 2 NO_STATEMENT = 3 INHERITED_ERROR = 4 DUPREC = 5 OBJ_EXISTS = 6 OBJ_NOT_FOUND = 7 . " RSDU_EXEC_SQL_HDB
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 2. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 3. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 4. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 5. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 6. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 7. "Exception "Add code for exception here ENDIF.







ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.

DATA:
ld_c_processed  TYPE RS_BOOL ,
ld_e_sqlerr  TYPE I ,
ld_i_t_stmt  TYPE RSDU_T_ABAPSOURCE ,
ld_e_sqlerrtxt  TYPE RSDU_STRING72 ,
ld_i_stmt  TYPE C ,
ld_e_stmtsize  TYPE I ,
ld_i_lower_trans  TYPE RS_BOOL ,
ld_e_num_rows  TYPE I ,
ld_i_error_download  TYPE RS_BOOL ,
ld_i_connection  TYPE DBCON_NAME .

ld_c_processed = 'Check type of data required'.
ld_i_t_stmt = 'Check type of data required'.
ld_i_stmt = 'Check type of data required'.
ld_i_lower_trans = 'Check type of data required'.
ld_i_error_download = 'Check type of data required'.
ld_i_connection = 'Check type of data required'.

Contribute (Add Comments)

Please help keep this info upto date and use the comments section below to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name RSDU_EXEC_SQL_HDB or its description.