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.
We create a XS Project with a new package as follow:
In the next step we must to set the project name
We select the workspace:
In order to schedule a XS Job we need to create a new file under out package:
Please, select XS Job Scheduler File:
Now we have the following file structure:
Here the example of xsjob file:
“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
This code enable to call 2 stores procedures per execution. Don’t put the character “;” at the end of the call procedure.
Now we need to access to XS Engine with the URL http://<XSengine-host><XS-port>/sap/hana/xs/admin/
Here we need to activate it:
If you want to confirm when the XS Job will run, click on View Logs:
And check the Planned Time:
My system is on CEST with DST, for this reason the planned time is 2 hours after scheduled.
Juan de la Cruz Arellano Royo