Monday, February 29, 2016

Consuming HANA procedures using ADBC (ABAP Database Connectivity) - E2E...!!!

Introduction
Our certain section of ABAP reports being executed in SAP NW 7.3 on Oracle DB and by running these reports for large selection takes lot of time in execution and it occupies lot of resources. Hence, on having HANA DB, push down the entire logic to HANA by replicating the source tables using SLT, developing the procedures on base tables and consuming the procedures in SAP using ADBC (ABAP Database Connectivity).
 
This end to end guide illustrates the replication method of SLT, building the procedures and how to consume in SAP.

HANA
 

 
1) Go to Programs -> SAP HANA -> SAP HANA Studio
Pic 1.jpg
 
2) Go to Window -> Open Perspective -> SAP HANA Modeler
Pic 2.jpg
 
3) Click Add System Icon
Pic 3.jpg
 
4) Provide host name, instance and description. Click Next.
 
Pic 4.jpg
 
5) Provide User name and Password.
 
Pic 5.jpg
 
6) Click Finish
 
Pic 6.jpg
 
7) Click Select System from the Quick Launch Modeler Screen
 
Pic 7.jpg
 
8) Select your corresponding environment
 
Pic 8.jpg
 
9) Click Data Provisioning
Pic 9.jpg
 
10) Select a schema (Source System) to replicate the table
 
Pic 10.jpg
 
11) Select Load (if it is Initial Load (one-time)) or Replicate (If you want both Initial + Delta records)
Pic 11.jpg
 
 
12) Enter the table name if you want to load/replicate
 
Pic 12.jpg
 
13) Choose the table and click Add button to transfer from source tables to selected tables.
 
Pic 12.jpg
 
14) Click Finish
 
Pic 14.jpg
 
15) Table will be initially in Load (Action) – Scheduled (Status) and when the load is in progress it shows the Action as Load and Status as In Process, when the load is completed, it shows the action as Load and Status as Executed. For the replication, it shows the action as Replicate and Status as In Process. You can monitor the status by clicking the refresh button in the top right corner of the below screen.
 
Pic 15.jpg
 
Pic 15.jpg
 
16) Go to Catalog -> Choose your schema
 
Pic 16.jpg
17) Go to Schema -> Tables
 
Pic 17.jpg
 
18) Replicated table will be shown here
 
Pic 18.jpg
 
19) To create the procedure, go to Content
 
Pic 19.jpg
 
 
20) To create Package, Go to Content -> New -> Package
 
Pic 20.jpg
 
21) Enter the package information details like Technical name, description and delivery unit.
 
Pic 21.jpg
 
22) Delivery unit can be assigned at later stage.
 
Pic 22.jpg
 
 
23) Select your package -> Right Click -> New -> Procedure
 
Pic 23.jpg
 
24) Provide procedure details and choose the default schema were the tables being replicated via SLT.
 
Pic 24.jpg
 
 
25) Click Finish
 
Pic 25.jpg
 
 
26) Procedure has different panes, Script View, Input Pane and Output Pane.
 
Pic 26.jpg
 
a) Create the output parameters from the Output pane, Select Output Parameters -> Right Click -> New (List out the fields for output)


Pic 27.jpg


b) Save and Activate the procedure
 
27) Once the procedure been activated, it will be stored under _SYS_BIC schema -> Procedure
 
Pic 28.jpg
 
28) Execute the procedure using CALL statement
 
Pic 29.jpg
 
29) Result will be shown as below
 
Pic 30.jpg
 
30) To insert the data into an table, use CALL procedure WITH OVERVIEW
 
Pic 31.jpg
 
ABAP
 
 
 
Follow below instructions for calling procedures in ABAP
 
 
35) Declare types which is exact similar to Output Parameter structure
Pic 32.jpg
 
 
36) SQL connection data declaration and its variables
 
Pic 33.jpg
 
37) Fetching the DB connection name should be maintained in DBCON table or using DBCO transaction.
 
Pic 34.jpg
 
38) Fetch the table name using the below CALL procedure WITH OVERVIEW
 
Pic 36.jpg
 
39) Execute Query which will return the table name
 
Pic 38.jpg
 
40) Execute the table using select and fetch the data
 
Pic 39.jpg
 
 
41) Assign the table result into target variable/internal table.
 
Pic 40.jpg
I hope this document helps to give an idea to extract the information from HANA using ADBC connection.

No comments:

Post a Comment