Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
CarlosRoggan
Product and Topic Expert
Product and Topic Expert
19,882

This series of blogs intends to show in an easy way how to use the Job Scheduling service in SAP Business Technology Platform (SAP BTP).

Note: The Job Scheduling service is available in both the SAP BTP, Cloud Foundry environment and the SAP BTP, Kyma runtime.

In this first blog, we’re going to prepare ourselves before we start with the first example.

Overview



What's Job Scheduling service?

It is a tool.
It allows to define jobs in SAP BTP.
A job can be configured to run regularly, or just once.
A job triggers an action.


What is it not?

The Job Scheduling service is not a framework.
It doesn't help to create the actions which should be executed.
It's just a tool to trigger anything which already exists.


How does it work?

SAP Job Scheduling service is part of SAP Business Technology Platform (SAP BTP).
The service has a Job Scheduling Service Dashboard with its own separate UI that you can open from the SAP BTP cockpit. This dashboard allows you to define jobs.
A job is configured with a URL.
This means your job would invoke that URL e.g. every night.
A job can be configured with a Cloud Foundry task as well.


How does it work technically?

You have an application in SAP BTP.
You add a REST endpoint to your app, which can be invoked and which does something.
You bind your app to an instance of the Job Scheduling service.
Now you can configure the Job Scheduling service to call this endpoint every night (or whatever).
The result of the HTTP call is evaluated by the Job Scheduling service.


More details please?

The Job Scheduling service requires that you bind your app also to an instance of the SAP Authorization and Trust Management service (xsuaa).
Note: The order of binding is relevant!


Which features does it have?

The Job Scheduling service functionality of triggering actions. It doesn’t help to define such actions.
The service has a user interface for creating jobs and defining schedules, to view results, etc.
Interface to manage jobs/schedules via API (REST, node.js, Java)

Details:
Support for Cloud Foundry tasks
Schedules can be defined with cron or human readable format.
Jobs can run synchronously or asynchronously.
2 service plans: 'lite' and 'standard'


What's the difference between both service plans?

Service Plan 'lite'
Is only intended to be used on the Trial landscape.
Allows to create multiple jobs (or Cloud Foundry "Tasks") with minimum schedule frequency of an hour (non-productive usage).
Supports HTTP REST endpoints to be triggered by a job.
Supports as well Cloud Foundry "Tasks".
Allows 15 schedules.

Service Plan 'standard'
Minimum schedule frequency is 5 minutes.
Support for multitenancy
OAuth2 for REST API

Note:
In case you're facing a problem with the display of the Job Scheduling Service Dashboard:
Are you using an old Microsoft browser?

Background:
Newer UI5 versions (from 1.88) don’t support the legacy browsers IE11 and Edge Legacy (Edge HTML) anymore. See Update: Future SAPUI5 versions will no longer support Microsoft's legacy browsers.
To solve the problem, you should use a modern browser.

 

Preparation

If you want to use the Job Scheduling service in SAP BTP, you need to create 2 service instances.


Create instance of Job Scheduling service

Creating an instance of the Job Scheduling service is anyways the first step to do.
It can be reused by all required applications.

1. In the SAP BTP cockpit in the Cloud Foundry environment, go to your space and open the Service Marketplace. Search for the tile “Job Scheduling Service”.

Note: If you don’t see the Job Scheduling service in the Service Marketplace, you need to configure Entitlements. See Appendix.

2. Click the tile Job Scheduling Service > Create, which opens the New Instance or Subscription wizard.

3. Provide an instance name of your choice, e.g. jobschedulerinstance.

4. Choose the 'lite' Plan from the dropdown. Anyways, in Trial, only 'lite' is supported.

5. Click Next.

6. Fill in the following into the text field :

{
   "enable-xsuaa-support": true
}

Note: The configuration parameter enable-xsuaa-support is always required, unless you want to trigger only CF Tasks (no REST endpoints).

7. Click Next.

7. Review your instance details and click Create.



Create instance of SAP Authorization and Trust Management service (xsuaa)

After creating the instance of the Job Scheduling service, the next task to do is creating an instance of SAP Authorization and Trust Management service (xsuaa).

However, this instance requires a configuration which is a bit specific to the use case.
As such, it will be described later.

Only one info: You should use service plan 'broker'.

Note: If you already have a SAP Authorization and Trust Management (xsuaa) service instance that is bound to your application, then you can also re-use it and bind it to the Job Scheduling service. It might require the update-service command.

 

Summary

In this blog, we've learned that the Job Scheduling service is a tool which can trigger actions,
e.g. invoke REST endpoints.
It can be configured to do that on e.g. regular basis.

To use the Job Scheduling service, you need and application (with an endpoint) and you have to bind it to service instances of the Job Scheduling service and the SAP Authorization and Trust Management service (xsuaa). And remember that the order of creation and binding is important!

 

Next Steps

Recommended readings:
Part 1: First simple use case in Trial account
Part 3: Simple use case with authentication and authorization
Part 5: Long-running operations (async jobs)
Part 6: Troublemaking (get little help for 403 error)

 

Links

See links section in the overview blog post.

 

Appendix: How to Configure Entitlements

1. Go to your global account at https://cockpit.hanatrial.ondemand.com/trial, e.g. P123456789trial.

2. Click Entitlements in the left menu panel.

3. Click Entity Assignments.

4. Select a subaccount in the Subaccounts/Directories dropdown, e.g. ‘Trial’, and click Select.

5. Click Edit.

6. Click Add Service Plans.

7. In the dialog, search for the Job Scheduling service.

8. Select the ‘lite’ checkbox in Available Plans on the right side of the dialog.

If the allowed service plan is grayed out, then you might need to remove from other subaccount or, in productive environment, purchase quota.

9. Click the Add 1 Service Plan button.

10. Don’t forget to click Save.

11. Go back to the Service Marketplace. You should see the Job Scheduling service tile there.

 

22 Comments