Human Capital Management Blogs by SAP
Get insider info on SAP SuccessFactors HCM suite for core HR and payroll, time and attendance, talent management, employee experience management, and more in this SAP blog.
cancel
Showing results for 
Search instead for 
Did you mean: 
yogananda
Product and Topic Expert
Product and Topic Expert
3,097

As a developer, there are always more tasks to complete than you have time for in a day. While it’s important to prioritize time-sensitive, impactful or blocking issues, they’re usually not the kind of things that can be knocked off your list quickly. If you try breaking down bigger tasks into smaller subtasks, you just end up increasing the list of things that still need to get done.

Most developers hate doing things that could be automated.

Here it comes to save your time and automate boring tasks

SAP Job Scheduling Service

Define and manage one-time and recurring jobs or Cloud Foundry tasks.

SAP Job Scheduling service allows you to define and manage jobs that run once or on a recurring schedule. Use this runtime-agnostic service to schedule action endpoints in your application or long-running processes using Cloud Foundry tasks. Use REST APIs to schedule jobs, including long-running jobs asynchronously, and create multiple schedule formats for simple and complex recurring schedules. Manage jobs and tasks and manage schedules with a web-based user interface.

This is available via the Pay-As-You-Go for SAP BTP and CPEA payment models, which offer usage-based pricing.
The following features are available for the SAP Job Scheduling service:

Use flexible schedule formatsFlexibly choose between cron and human-readable date formats for your schedules.
Get secure accessRun jobs on behalf of an application secured by an OAuth 2.0 protected communication used when the service calls the action endpoint, and when the application invokes the services' REST APIs.
Schedule synchronously or asynchronouslyDefine and manage jobs synchronously or asynchronously as well as run long-running CF tasks asynchronously.
Optimize your resources usageRun Cloud Foundry tasks asynchronously and thereby optimize your resources usage.
App and scheduling logic separatedUSE REST APIs to perform CRUD operations on jobs and schedules and to retrieve run logs of executed schedules.
Dashboard for managing jobs and tasksUse the web-based user interface to create, edit, or delete jobs and tasks for a service instance. Create, manage, and monitor schedules for your jobs and tasks. Check the logs to see if a schedule was executed successfully.
Supports Node-js client libraries Convenient client library to execute CRUD operations, including create job, from your Node.js application.

 

Use cases

Developers/sysadmins do a lot of repetitive tasks on a daily basis like moving a file from one folder to another or running a specific job in the area of Devops. And as for the database admin owners, they might have to take a backup of their database schema on daily basis/nightly job or even on a hourly basis. Cron jobs could come in handy at situations like these.

There are tons of use cases to mention (few of them are below)

    • Execute Stored Procedure regularly.
    • Running Pipeline jobs based on the scheduled time
    • Trigger SAP Process Automation Jobs
    • Trigger SAP Integration Suite Iflows
    • Trigger S/4 HANA Cloud related manual tasks
    • Trigger SAP Commissions Pipeline Jobs
    • Trigger SAP Data Intelligence Jobs
    • Send Notifications if Services are down (Health Check Status)

Get Started to enable in your SAP BTP Cockpit Service


Go to Service Marketplace > find in Search "Job"

After you selected Job Scheduling Service - click Create

update json value as mentioned and click Next and Finish

Go to Instance & Subscriptions, you will find the Service name you created and click on the Job Scheduling Service link which will redirect to your Dashboard Portal.
After you enabled, Job Scheduling Service Dashboard with first look of glance with empty Tasks.

Create a Service Instance Using CF CLI

Plan : Lite

 

cf create-service jobscheduler lite <instance name> -c '{"enable-xsuaa-support": true}'

 


Plan : Standard

 

cf create-service jobscheduler standard <instance name> -c '{"enable-xsuaa-support": true}'

 


Get Started to create your own Use Case


There are 2 ways to Schedule & run the service :

    • Running Cloud Foundry Tasks
    • Consuming your existing deployed Application running on Cloud Foundry

manifest.yml

 

---

applications:

- name: commissions_pipeline

  memory: 128M

  disk_quota: 128M

  buildpacks:

    - nodejs_buildpack

  command: node server.js  

  services:

    - xsuaa_apiaccess

    - jobs

 


server.js

 

const express = require('express');

const app = express();

// write your logic to execute or trigger your scenario
const port = process.env.PORT || 3000;

app.listen(port, function () {
    console.log('listening');

})

 


package.json

 

{
    "main": "server.js",
    "dependencies": {
        "express": "^4.18.1"
    }
}

 


Run this command to deploy Cloud foundry

 

cf push --task

 


To check once if its running

 

cf run-task commissions_pipeline --command "npm start" --name taskfromCli 

or 

cf run-task commissions_pipeline --command "node server.js" --name taskfromCli

 


To check in logs what is executed.

 

cf logs commissions_pipeline --recent 

 

Go to SAP Job Scheduling Dashboard Portal and Create a Task and Save

 


Select the Pattern for Schedule as per your choice of execution for your use case.

Also you can define Human readable date format ( explained below)
After you configured from above steps, you can click this Description of your Job to view Inside the schedule logs

 you can go to Run Logs to check if Job is started or completed.

Job is ran successful and completed.

Go to SAP Commissions - Pipeline Workspace to see if your Pipeline is triggered and running already.


Human-Readable Date Formats

The SAP Job Scheduling service supports human-readable dates and ranges for configuring both job and task schedules.

Example

 

    • "10 hours from now"
    • "20 minutes from now"
    • "in 2 hours"
    • "tomorrow at 4pm"
    • "next week monday at 5am"
    • "9pm tonight"
    • "3.30pm"


Note:


In case you specify a certain time, note that: “SAP Job Scheduling service runs jobs in the UTC time zone“.


References


JobScheduler RestAPIs

JobScheduler Documentation

Purchase JobScheduler SAP Store

For more information about use cases for SAP Job Scheduling service, see SAP Discovery Center

crontab.guru