Show TOC

Example of the Implementation of an Interface Method in SQLScriptLocate this document in the navigation structure

The following section provides an example of how method if_rsplfa_srvtype_trex_exec_r ~ trex_execute can be implemented.

You can find the example below in program RSPLS_SQL_SCRIPT_TOOL.

Caution

Note that you have to implement a public class, so that this class can be assigned to the planning function type.

Sample Code
  
METHOD if_rsplfa_srvtype_trex_exec_r~trex_execute.
    DATA: l_r_sql_script   TYPE REF TO if_rspls_sql_script,
          l_procedure_name TYPE string,
          l_srvtypenm      TYPE rsplf_srvtypenm,
          l_t_iobj_param   TYPE if_rsr_pe_adapter=>tn_t_iobj_param.

    l_r_sql_script = cl_rspls_session_store_manager=>get_sql_script_instance( i_r_store = i_r_store ).


*   The method if_rspls_sql_script~get_parameter_values returns a table of parameters
*   with the values given in the function definition
    l_r_sql_script->get_parameter_values(
      EXPORTING
        i_r_param_set             = i_r_param_set
        i_para_name_for_procedure = 'HANA_PROCEDURE_NAME'
      IMPORTING
        e_procedure_name          = l_procedure_name
        e_t_iobj_param            = l_t_iobj_param ).

*   The function parameter given mehtod paramenter i_para_name_for_procedure
*   will not be returned in the table e_t_iobj_param but the value of this
*   function parameter will be returned int the mehtod parameter e_procedure_name
*   This mechanisme can e.g. be used to define function specific HANA-procedure names.

*   Other examples to get the name of the HANA-procedure name which will be called can be
*     - you use the technical name of the planning function type:
    l_srvtypenm = p_r_srv->get_srvtypenm( ).
    l_procedure_name = l_srvtypenm.

*     - or you simply give the HANA procedure name in a string:
    l_procedure_name = 'MY_HANA_PROCEDURE'.

    r_s_view-view = l_r_sql_script->execute_sql_script(
        i_view         = i_view
        i_view_ref     = i_view_ref
        i_t_iobj_param = l_t_iobj_param
        i_proc_name    = l_procedure_name
        i_r_msg        = i_r_msg ).
  ENDMETHOD.                    "IF_RSPLFA_SRVTYPE_TREX_EXEC_R~TREX_EXECUTE