dietgerma.blogg.se

How to create a stored procedure in sap hana studio
How to create a stored procedure in sap hana studio






how to create a stored procedure in sap hana studio

In this example i am creating a private synonym “SY_ARTICLES”.ĥ.

how to create a stored procedure in sap hana studio

Select Public checkbox to create a public synonym (or) leave it blank to create a private synonym. Right click on the table and choose New Synonym.Ĥ. Provide the synonym name and click on Execute. In this example i am going to create a synonym for the table “ARTCILE_INFO” which is in the schema “SAPLEARNERS”.ģ. Identify the table for which you want to create a Synonym. Now this, Abap program can be schedule to run through process chain in SAP BW.2. An Abap Program Z_Data_daily is developed under BW developer perspective, to call the Abap class/method as shown below.

How to create a stored procedure in sap hana studio code#

In Abap class, the stored procedure can be either called or the whole code can be written in Abap class.ģ. This is to merge delta of Table2, to move the data from delta storage to the main storage in HANA as recommended by SAP.īelow, is the code written in Abap class. Once the data is loaded, another stored procedure, “_SYS_BIC”.”TEST::DATA_MERGE” is called. While running, HANA view may consume high memory and CPU so the run is split based on each month instead of running for 15 months at the same time. This is done as the HANA view is very complex and generates very high volume of data. So, using this the stored procedure is called 15 times, by passing calmonth one by one. Using the For loop, calmonth is passed one by one to the stored procedure. There is no delta/change recorded mechanism implemented.Īnother Stored procedure “_SYS_BIC”.”TEST::DATA_TRUNCATE” is called which deletes the data from Table2. This data is dropped on daily basis and 15 months data is loaded daily. The requirement here is to store only last 15 months data. Under the class Method “Datapersist”, cursor C_DATE is declared which holds the last 15 months calmonth. This has been created in HANA studio through the Abap perspective. This helps to keep a tracking of each run of the stored procedure.Ģ. In this step, an Abap class is created to call the stored procedure. Table1 and Table2 are under XYZ schema.Īt the end of the stored procedure, Table1 (logging table) is updated with the end timestamp of the procedure. (This will be shown in Abap class in Step2). Later, we are reading the data from HANA view ABC_CV based on the calmonth which will be passed to stored procedure. Table1 is used for logging and tracking the run date of the procedure, time taken by procedure to run. In the second part, the data is inserted in table1. Hence, the same is implemented through a work around. Note – AMDP(Abap managed database procedure) does not support statement such as Commit, rollback. The second variable is created to hold the value ‘COMMIT’. In the first part of the procedure, ‘STARTIME’ variable is used to hold the current timestamp value in ‘YYYYMMDD HH24:MI:SS’ format. The read only statement has been removed. This is read write procedure as can be seen in below script. Here, the calmonth value will be passed and then HANA view results will be calculated based on this. There is an input parameter which is created on Calmonth. Here, the default schema given is “XYZ” as Table1 and Table2 are created under this schema. In the procedure, the default schema can be given. It is preferred to create the Stored Procedure in _SYS_BIC schema. This stored procedure reads the data from HANA view and inserts the data in a table which is under “XYZ” schema. Repository Stored Procedure ‘DATA_PERSIST’ is created under TEST Package through HANA development perspective.The Steps performed have been explained below – Scheduling was required to be done from SAP BW Process chain to keep the daily loads monitoring simple and integrated at one place. Stored Procedure was written to read the data from HANA view and insert the data into HANA table. The data modelling was done in SAP HANA view and there was a need to read the output of the view and persist it in the HANA table. Calling Abap class in Abap program and scheduling through process chain.Calling Stored Procedure through Abap class.Creation of Repository Stored Procedure.








How to create a stored procedure in sap hana studio