SAP REPLACE_PARAMETERS_IN_SQL Function Module for Replace ? Placeholders with values









REPLACE_PARAMETERS_IN_SQL is a standard replace parameters in sql SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Replace ? Placeholders with values 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 replace parameters in sql FM, simply by entering the name REPLACE_PARAMETERS_IN_SQL into the relevant SAP transaction such as SE37 or SE38.

Function Group: SHDB
Program Name: SAPLSHDB
Main Program: SAPLSHDB
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:



Function REPLACE_PARAMETERS_IN_SQL 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 'REPLACE_PARAMETERS_IN_SQL'"Replace ? Placeholders with values
EXPORTING
* SQL_INPUT_STRING = "
* SQL_INPUT_TABLE = "DB6: Table of DB6_EDITOR_LINE
* CON_NAME = "Logical name for a database connection
* IT_PARAM = "SYS.M_SQL_PLAN_CACHE_PARAMETERS

IMPORTING
SQL_OUTPUT_STRING = "
SQL_OUTPUT_TABLE = "DB6: Table of DB6_EDITOR_LINE
RC_C_CALL = "Return Code
USER_ACTION = "Function Code
SQL_MSG = "
SQL_CODE = "
META_DATA_TAB = "Type of Output Table of DB_GET_PARAM_META_DATA
PARAMETER_LIST = "Output table for REPLACE_PARAMETERS_IN_SQL
PARAMETER_FOR_PLANVIZ = "
.



IMPORTING Parameters details for REPLACE_PARAMETERS_IN_SQL

SQL_INPUT_STRING -

Data type: STRING
Optional: Yes
Call by Reference: No ( called with pass by value option)

SQL_INPUT_TABLE - DB6: Table of DB6_EDITOR_LINE

Data type: DB6_EDITOR_LIST
Optional: Yes
Call by Reference: No ( called with pass by value option)

CON_NAME - Logical name for a database connection

Data type: DBCON_NAME
Optional: Yes
Call by Reference: Yes

IT_PARAM - SYS.M_SQL_PLAN_CACHE_PARAMETERS

Data type: HDB_M_SQL_PLAN_CACHE_PARAM_TAB
Optional: Yes
Call by Reference: Yes

EXPORTING Parameters details for REPLACE_PARAMETERS_IN_SQL

SQL_OUTPUT_STRING -

Data type: STRING
Optional: No
Call by Reference: Yes

SQL_OUTPUT_TABLE - DB6: Table of DB6_EDITOR_LINE

Data type: DB6_EDITOR_LIST
Optional: No
Call by Reference: Yes

RC_C_CALL - Return Code

Data type: SYSUBRC
Optional: No
Call by Reference: Yes

USER_ACTION - Function Code

Data type: OKCODE
Optional: No
Call by Reference: Yes

SQL_MSG -

Data type: STRING
Optional: No
Call by Reference: Yes

SQL_CODE -

Data type: I
Optional: No
Call by Reference: Yes

META_DATA_TAB - Type of Output Table of DB_GET_PARAM_META_DATA

Data type: META_DATA_DESCR_T
Optional: No
Call by Reference: Yes

PARAMETER_LIST - Output table for REPLACE_PARAMETERS_IN_SQL

Data type: HDB_META_DATA_DESCR_T
Optional: No
Call by Reference: Yes

PARAMETER_FOR_PLANVIZ -

Data type: EXPL_VALUE_LIST
Optional: No
Call by Reference: Yes

Copy and paste ABAP code example for REPLACE_PARAMETERS_IN_SQL 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_sql_input_string  TYPE STRING, "   
lv_sql_output_string  TYPE STRING, "   
lv_sql_input_table  TYPE DB6_EDITOR_LIST, "   
lv_sql_output_table  TYPE DB6_EDITOR_LIST, "   
lv_con_name  TYPE DBCON_NAME, "   
lv_rc_c_call  TYPE SYSUBRC, "   
lv_it_param  TYPE HDB_M_SQL_PLAN_CACHE_PARAM_TAB, "   
lv_user_action  TYPE OKCODE, "   
lv_sql_msg  TYPE STRING, "   
lv_sql_code  TYPE I, "   
lv_meta_data_tab  TYPE META_DATA_DESCR_T, "   
lv_parameter_list  TYPE HDB_META_DATA_DESCR_T, "   
lv_parameter_for_planviz  TYPE EXPL_VALUE_LIST. "   

  CALL FUNCTION 'REPLACE_PARAMETERS_IN_SQL'  "Replace ? Placeholders with values
    EXPORTING
         SQL_INPUT_STRING = lv_sql_input_string
         SQL_INPUT_TABLE = lv_sql_input_table
         CON_NAME = lv_con_name
         IT_PARAM = lv_it_param
    IMPORTING
         SQL_OUTPUT_STRING = lv_sql_output_string
         SQL_OUTPUT_TABLE = lv_sql_output_table
         RC_C_CALL = lv_rc_c_call
         USER_ACTION = lv_user_action
         SQL_MSG = lv_sql_msg
         SQL_CODE = lv_sql_code
         META_DATA_TAB = lv_meta_data_tab
         PARAMETER_LIST = lv_parameter_list
         PARAMETER_FOR_PLANVIZ = lv_parameter_for_planviz
. " REPLACE_PARAMETERS_IN_SQL




ABAP code using 7.40 inline data declarations to call FM REPLACE_PARAMETERS_IN_SQL

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.

 
 
 
 
 
 
 
 
 
 
 
 
 


Search for further information about these or an SAP related objects



Comments on this SAP object

What made you want to lookup this SAP object? Please tell us what you were looking for and anything you would like to be included on this page!