Friday, 8 July 2016

How to scheduling XS Job to call stored procedures

This tutorial try to explain how to schedule a XS job to call strore procedure.

We need to change the SAP HANA perspective to SAP HANA Development.

How to scheduling XS Job to call stored procedures

We create a XS Project with a new package as follow

How to scheduling XS Job to call stored procedures

In the next step we must to set the project name

How to scheduling XS Job to call stored procedures

We select the workspace:

How to scheduling XS Job to call stored procedures

Here we can create the XS JavaScript file, so we set the name of the file:

How to scheduling XS Job to call stored procedures

In order to schedule a XS Job we need to create a new file under out package:

How to scheduling XS Job to call stored procedures

Please, select XS Job Scheduler File:

How to scheduling XS Job to call stored procedures

Set the parent folder (previously created ZJUANDE_IBO) and set the XS JavaScript file name:

How to scheduling XS Job to call stored procedures

Now we have the following file structure:


How to scheduling XS Job to call stored procedures


Here the example of xsjob file:

Important is action. The action keyword enables you to define the function to run as part of the XS job, for example, an XS JavaScript or an SQLScript. The following syntax is required:
“action” : “<package.path>:<XSJS_Service>.xsjs::<functionName>”

The schedule for the specified task (defined in the “action” keyword); the schedule is defined using cron-like syntax. Following some examples:
2016 * * fri 12 0 0
Every Friday of 2016 at 12:00 hours

* * * * 12 0 0
Every day of every year at 12:00 hours

* * * * 12 0 *
Every second of every day of every year

* * * * * */5 30
Every five minutes and, in addition, at the 30th second in the specified minute

My code exeute the job every day at 00:00

How to scheduling XS Job to call stored procedures

This code enable to call 2 stores procedures per execution. Don't put the character ";" at the end of the call procedure.

How to scheduling XS Job to call stored procedures

Now we need to access to XS Engine with the URL http://<XSengine-host><XS-port>/sap/hana/xs/admin/

How to scheduling XS Job to call stored procedures

How to scheduling XS Job to call stored procedures

How to scheduling XS Job to call stored procedures

Here we need to activate it:

How to scheduling XS Job to call stored procedures

If you want to confirm when the XS Job will run, click on View Logs:

How to scheduling XS Job to call stored procedures

And check the Planned Time:

How to scheduling XS Job to call stored procedures

Source: scn.sap.com

No comments:

Post a Comment