Show TOC

Implementing Business Logic for Planning Function Types on the SAP HANA DatabaseLocate this document in the navigation structure

If you implement an SQLScript procedure, you can run a customer-specific planning function type optimized on the SAP HANA database.

Prerequisites

  • You have created a planning function type.
  • You are using the Planning Applications Kit on the SAP HANA database.

Context

You want to create an ABAP class for the new planning function type in the BW system. You want to implement and define the relevant inerface and to create the required objects on the SAP HANA database from within the BW system. You can then implement the SQLScript procedure in the SAP HANA Studio.

Procedure

  1. Create an ABAP class in Class Builder (transaction SE24) and implement one of the following interfaces:
    • IF_RSPLFA_SRVTYPE_TREX_EXEC must be implemented if no reference data is used,

    • IF_RSPLFA_SRVTYPE_TREX_EXEC_R must be implemented if no reference data is required during execution.

    As with ABAP, the class can also implement specific test methods that are executed at runtime. Interface IF_RSPLFA_SRVTYPE_IMP_CHECK serves this purpose. You can set the flag for reference data: If this flag is set, reference data is needed when you execute the planning function.

    Implementing methods of the specified interfaces is optional, with the exception of method TREX_EXECUTE.

    Caution

    Unlike with ABAP implementation, you have to implement block creation of transaction data in the SQLScript procedure yourself, meaning that all characteristic attributes in the transaction data can be changed without the need for further implementation.

  2. From your implementation, call interface method if_rspls_sql_script -> execute_sql_script, which calls the SQLScript procedure.
  3. Create the required objects on the SAP HANA database.
    We recommend doing this by running program RSPLS_SQL_SCRIPT_TOOL in the ABAP Editor (transaction SE38). You can use this program to create the following objects on the SAP HANA database:
    • A table whose structure matches the structure of the aggregation level. This table can be used to set the type of the table parameters in your SQLScript procedure.
    • The body of the SQLScript procedure. This procedure body contains the table parameters for the data that this procedure should change, and the return table with the result of the procedure. All elementary parameters of the function are added to the parameter list too, together with the relevant types.
  4. In the SAP HANA Studio, implement the SQLScript procedure that should be called by interface method if_rspls_sql_script -> execute_sql_script.
    The SQLScript procedure requires an IN table and an OUT table. Both of these must have the structure of the aggregation level. If you have implemented interface IF_RSPLFA_SRVTYPE_TREX_EXEC_R, the SQLScript procedure requires another table with the same structure für the reference data. The SQLScript procedure can also contain elementary IN parameters.
    Caution

    Unlike the ABAP implementation, the result table contains delta records. The values from the result table are aggregated to the starting values.