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

Create stored procedure

Create Hana XS project in HANA developer perspective

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

 

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

 

Log in HANA XS web administration tool

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

 

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

Select the XS application and choose the job file


Choose the JOB id

Provide user id pwd and check the active and save job

Now go the Job Dashboard

We can see our job is ready and running successfully

Go to table to check for new data getting inserted

 

 

 

 

New NetWeaver Information at SAP.com

Very Helpfull

User Rating: Be the first one !