Example of a SAP HANA Stored Procedure

Prerequisite

The remote function adapter requires input data which is then processed by the SAP HANA Stored Procedure.

In this example, simple input data is used in the form of a model table, to show the connection and logic of the remote function adapter SAP HANA stored procedure type.

  1. Create a model table.

  2. Name it “RFA Input”, for example.

  3. On the right-hand side of the screen, configure the model table by entering the following:

    • Model Table Source: Environment
    • Transport Data: Default (No)
  4. Add a field.

  5. Choose Maintain Data and add an entry.

  6. Now the input has been defined and ready to be used.

Remote Function Adapter

The Remote Function Adapter function provides automated communication capabilities to other applications and systems so that they can be included in calculations and processes.

One of these is HANA STORED PROCEDURE, where an external SAP HANA stored procedure can be called by the function to process the input function in step 6. .

How to set up the remote function adapter

  1. Create a remote function adapter.

  2. Name it “RFA Function”, for example.

  3. On the right-hand side of the screen, configure the header of the remote function adapter by making the following entries:

    • Function Type: HANA STORED PROCEDURE
    • Supress Initial Result: Default
    • Result Model Table: Empty (by default)
    • Authoring Schema: <Where your procedure is located>
    • Stored Procedure: <The stored procedure created that can process the input data>
    • Include Original Input Data: Default
    • Result Handling: Default
  4. On the right-hand side of the screen, configure the tabs of the remote function adapter.

    • Input Function: <Enter the input function that the SAP HANA stored procedure needs to process>

      For the purposes of this example, it is the prerequisite model table “RFA Input” that was created earlier .

    • The Rule tab has two sections:

      1. Template Section (Read Only)

        This is a generated procedure based on the input function that can be used as a template for the called SAP HANA stored procedure.

        The configurer must be aware of the fact that this template is a mandatory format, and that it must be closely checked against the called SAP HANA stored procedure

      2. Statement Section (Read Only)

        This reflects the SQL statement(s) of the called SAP HANA stored procedure.

        The parameter section of the SAP HANA stored procedure must be completely filled using the respective template format based on the input function.

        In this example, it looks something like this:

      3. Check: Making entries on this tab is not mandatory, but if a check is required after processing, you can enter proper check conditions on this tab.
      4. Documentation: Making entries on this tab is not mandatory, but you can use it to document the scenario or provide documentation or instructions about the function being modeled.
  5. Once you have completed the set-up, choose Activate.

  6. Then choose Run.