Schedule SAP HANA XS JOB – Part 2
Welcome to the second part of this three part series where we learn how to schedule SAP HANA XS JOB. If you have directly landed on this page, please read the Part 1 tutorial before going further below.
How to schedule SAP HANA XS JOB (Contd..)
Next, move to the “Configuration” tab. Select the checkbox “Active” and select our XS JOB’s check box. This step is to switch the INACTIVE job to ACTIVE state.
Press the “Save Job” button as shown below to confirm the job activation.
As seen below, the JOB now switches to active state. This means that it will run at the next possible schedule that was specified in the XS JOB code. To confirm if the JOB was scheduled, click on the “View Logs” button marked below.
This shows that the job has been scheduled to run as shown below. The first run in this case will be at 01:31:30 and it will run every one hour as specified by our logic. The status of this job is still SCHEDULED. This means that it has not run yet. When it runs, the job status will switch to wither SUCCESS or ERROR based on the outcome.
As soon as the clock hit 01:31:30, the job ran and was a SUCCESS as shown in the status below. As soon as the job is run, the next one is added to schedule by the SAP HANA XS JOB Scheduler and we can see this in the below screenshot where JOB ID 303 is scheduled at 2:31:30 – exactly one hour after our previous XS JOB run as specified by our logic.
Now, we come back to HANA to check if the sales log table was populated with the details for CM_WHEAT material. The SELECT statement picks up the correct data as shown below. This confirms that the DESIGNTIME XS JOB we created ran successfully as expected.
In cases, where you do this for learning, ideally you should switch off or change the job status to INACTIVE so that the job doesn’t keep on running forever in schedule when you forget to switch it off. To do this, Uncheck the “Active” checkbox on the job and click “Save Job”. This will make the job inactive and it will cease to run again until reactivated.
As mentioned in this tutorial, this was a design-time XSJOB – it meant that the schedule it’s properties were decided by the XSJOB file we created in SAP HANA.
But what if the XSJOB administrators wants to create a schedule of their own? That would require them to ask a HANA developer every time to change or create an XSJOB. Thankfully, all this is not required. An XS job administrator can create their own schedules for each pre-defined job. These are called runtime XSJOBs. We will discuss this in the next part of this tutorial. Be sure to check it out on the next page.
Thank you for reading through this tutorial on scheduling SAP HANA XSJOBs. I hope this clarified the process and was easy to follow. Be sure to share this tutorial on social media and to your colleagues to help this website grow.