Skip to Content
Author's profile photo Former Member

Scheduling a XSengine Background job to call a procedure

Background:

Xsengine Background jobs can be scheduled for SQL script procedures and XSJS functions.

Prerequisites:

  1. ) Add a section “scheduler” to xsengine.ini with property enabled = true

  And run reconfigure service for the xsengine as SYSTEM user under Landscape\services tab

/wp-content/uploads/2015/06/tt1_720104.jpg

This will enable the XSengine job scheduling.

  1. )    You got access to role sap.hana.xs.admin.roles::JobAdministrator and sap.hana.xs.admin.roles::HTTPDestAdministrator

Setup:

Can be done either in HANAstudio development perspective or HANA web based development editor, which can be reached through:

http://< HOSTNAME>:8000/sap/hana/xs/ide/editor/

Sample using Webbased development editor:

Creating a new subpackage for my jobs for an easier overview:

/wp-content/uploads/2015/06/tt1_720104.jpg

Creating new .xsjob file:

/wp-content/uploads/2015/06/tt1_720104.jpg

Code sample:

{

   “description”: “Background job test”,

   “action”: “<package_path>::<procedure_or_function>”,

   “schedules”: [

       {

         “description”: “Background job test”,

         “xscron”: “* * * * * * */*”

     

       }

   

    ]

}

Xscron samples:

2013 * * fri 12 0 0 -> Run the job every Friday in 2013 at 12:00.

* * 3:-2 * 12:14 0 0 -> Run every hour between 12:00 and 14:00 every day between the third and second-to-last day of the month.

* * * -1.sun 9 0 0 -> Run the job on the last Sunday of every month at 09:00.

Enabling the scheduling:


Open XSengine Administration:

http://<HOSTNAME>:8000/sap/hana/xs/admin

  Browse to your job and specify a USER and PASSWORD under which the Job should be executed, tick the active checkbox and save. (A dedicated user with the required access should be created for this task)


/wp-content/uploads/2015/06/tt1_720104.jpg


The job will run not and its status can be monitored in the Job log section:

  1. e.g.

/wp-content/uploads/2015/06/tt_720115.jpg

Or with the tables:

“_SYS_XS”.”JOBS”

“_SYS_XS”.”JOB_SCHEDULES”

“_SYS_XS”.”JOB_LOG”

Hope this document will help you to overcome the usage of external tools to call a procedure. Now HANA Supports this feature.

Regards,

Sharath Borra

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Nice Article..

      Author's profile photo Former Member
      Former Member

      This is good 🙂 . Is it possible to schedule parameterized procedures? Pass parameters on the fly?

      Author's profile photo Former Member
      Former Member

      Sharath - Great blog.

      When I am going to schedule the job from admin console, I am seeing an error about missing application privileges while setting up the configuration tab to set up the start and end time for the schedule.

      Do you have any inputs what are possibly missing privilege?

      the user that I am using has the necessary roles sap.hana.xs.admin.roles::JobAdministrator and sap.hana.xs.admin.roles::HTTPDestAdministrator

      Thanks in advance!

      Abhi

      Author's profile photo Former Member
      Former Member

      Hi Abhishek,

      make sure you have .xsapp, .xsaccess files in the same path where your .xsjob or .xsjs file are present. refere the below note for solution.

      SAP note 2185884 - Unable to save XSEngine job configuration: Missing application privilege. Update failed

      Thanks

      Ranjith