Professional Documents
Culture Documents
ABAP On HANA Course Material Consuming Stored Procedure Module 8B
ABAP On HANA Course Material Consuming Stored Procedure Module 8B
ABAP
There are two methods of using HANA Stored Procedure in our ABAP
programming:
Both the process has its pros and cons, but it is better to use Database proxy over
the native SQL.
Faster development, lesser effort Once you have the stored procedure created in the
HANA DB, you can write native SQL to access that directly.
No extra ABAP artifact, less maintenance As no other ABAP artifact to be created (like
DB Proxy) maintenance cost will be lesser in this case
Native SQL Development can be done in SAP GUI as well as ADT, whereas for DB
proxy it required to be done in ADT only
Procedure proxy call is similar like Function Module, which is quite familiar for ABAP
developer and are easy to use
In case of change in DB Procedure the code changing process is totally manual, but for
proxy it is semi-manual and proxy can be synchronized while editing the same as
shown below:
In your ABAP report define a type having two member (one for parameter another for value) of
type string and declare an internal table of that type.
Pass the Call statement in a string.
lv_sql = CALL <FULL NAME OF PROCEDURE> (PARAM1 , PARAM2, ,PARAMn) WITH
OVERVIEW
Execute the above SQL query by using the method EXECUTE_QUERY of class
CL_SQL_STATEMENT and get that result in an object of type CL_SQL_RESULT_SET.
Get the queried data in the table defined in step 1.
Read the table above with <PARAMETER_NAME> = <VALUE of the Parameter>. This will
return a temporary table name in Value field where the actual result of the query corresponding
to the parameter value saved.
Execute another SQL query following step 2 and 3 and the result will be available in your
internal table.
In the ABAP program declare the related parameters for Proxy similar to type in generated
interface.
Call the Proxy in your ABAP program as below:
CALL DATABASE PROCEDURE <PROXY_NAME>
EXPORTING
E_PAR1 = V_PARAM1
E_PAR2 = V_PARAM2
IMPORTING
I_PAR1 = LT_DATA1
I_PAR2 = LT_DATA2.
Below picture will explain the high level architecture of using Database Procedure in
ABAP.