This document is used to create a stored procedure and call the stored procedure using HANA XS job for every 30 seconds.

Main steps to create the stored procedure and HANA XS job

  1. Create a Stored procedure to Insert Streaming Data in HANA Table.
  2. Create a Sequence with Min value 1 and Max value 1000. Once the value reaches 1000 then the sequence will set to min value 1
  3. Create a HANA XS job to schedule the stored procedure for every 30 seconds
  4. Schedule the HANA XS job

Create Sequence

Creating HANA Stored procedure and XS job to insert table records

Create stored procedure

Creating HANA Stored procedure and XS job to insert table records

Create Hana XS project in HANA developer perspective

We use Hana XS Job to call and schedule the stored procedure for every 30 seconds

Creating HANA Stored procedure and XS job to insert table records

Creating HANA Stored procedure and XS job to insert table records

 

Create below files in the Project folder

MyFirstSourceFile.xsjs

MyJobs.xsjob

Code for MyFirstSourceFile.xsjs

function My_table()

{

//var query = “CALL >.>() “;

 

var query = “{CALL ”ZOSI”.”LAS_STREAM_PROC”()}”;

 

$.trace.debug(query);

var conn = $.db.getConnection();

var pcall = conn.prepareCall(query);

pcall.execute();

pcall.close();

conn.commit();

conn.close();

}

 

Code for  MyJobs.xsjob

 

{

“description”: “Job to Update MY_TABLE values”,

“action”: “Las_Stream:MyFirstSourceFile.xsjs::My_table”,

“schedules”:

[

{

“description”: “Table update every 2 second”,

xscron“: “* * * * * * 0:59/30”

}

]

}

 

Save Check and Activate the project

Creating HANA Stored procedure and XS job to insert table records

 

Log in HANA XS web administration tool

https://:8000/sap/hana/xs/formLogin/

Creating HANA Stored procedure and XS job to insert table records

 

After login XS Artifact administration, click the Settings icon on footer and choose tree view

Select the XS application and choose the job file

Creating HANA Stored procedure and XS job to insert table records


Choose the JOB id
Creating HANA Stored procedure and XS job to insert table records

Provide user id pwd and check the active and save job

Now go the Job Dashboard

Creating HANA Stored procedure and XS job to insert table records

We can see our job is ready and running successfully
Creating HANA Stored procedure and XS job to insert table records

Go to table to check for new data getting inserted

 

 

 

 

New NetWeaver Information at SAP.com

Very Helpfull

User Rating: Be the first one !