Introduction
- SAP S/4 HANA includes the SAP Job Scheduling Service that implements the SAP Job Scheduling Service REST API for managing and operating SAP Jobs.
- This JITL Job Template implements a JS7 adapter for SAP S/4 HANA® Jobs.
- The JS7 adapter makes use of the publicly available SAP REST API.
Maintainer Notes
- Development of the SAPS4HANAJob template has been completed and currently is on ice: the job template does not ship with current JS7 releases.
- Our intention is to make the job template available for users who operate JS7 with its Open Source License, see JS7 - License.
- To this purpose ongoing testing and adjustments with new releases of the SAP REST API is required.
- Interested parties who are ready to provide access to testing environments are invited to get in contact.
Features
Functional Features
The SAPS4HANAJob template performs the following actions available with the SAP Job Scheduling Service and with JS7.
SAP Job Scheduling Service
- Create an SAP Job
- Create an SAP Job Schedule
- Start an SAP Job
- Check for SAP Job completion
- Retrieve SAP Job execution results and log output
JS7 JobScheduler
- Manage job configuration
- Map JS7 Jobs to SAP Jobs. SAP Jobs are integrated in JS7 Workflows.
- JS7 Workflows allow cross platform execution of SAP jobs and all other jobs executed with the same workflow across JS7 Agents on all platforms.
- JS7 job dependencies apply, e.g. for mutual exclusion by JS7 - Resource Locks.
- JS7 error handling applies, e.g. for rerunning SAP Jobs and catching SAP Job errors.
- Manage Calendars and Schedules
- Automated starting of workflows for SAP Jobs based on JS7 Schedules.
- Allowing cyclic job execution.
- Maintain Job History
- Recording job execution history with start time, end time, exit code etc. of SAP Jobs.
- Maintaining SAP Job logs.
Interface Features
- Monitor and control SAP Jobs from the JOC Cockpit user interface for browsers.
- Monitor and control SAP Jobs from the JS7 JS7 - REST Web Service API and the JS7 - PowerShell Module.
- Start SAP Jobs manually in addition to automated job starts from JS7 Schedules.
- Visualize SAP Job logs.
- Note: The SAP Job Scheduling Service does not allow to stop or to terminate running SAP Jobs.
Operational Features
- Execute any number of parallel SAP Jobs with the same or different JS7 Agents:
- Running separate SAP Jobs in parallel.
- Running any number of instances of the same SAP Job in parallel.
- Recover from loss of the connection to an SAP Job Scheduling Service:
- SAP Jobs will continue to run in case of a connection loss between JS7 and an SAP system.
- SAP Job execution results and logs can be recovered after a connection has been re-established.
Integration Scenario
Authentication
- The JS7 JITL Job makes use of SAP user/password authentication.
- Support for OAuth 2.0 authentication is an option as JS7 integrates with authentication servers such as Vault by HashiCorp®, for details see JS7 - Identity Services.
Job Scheduling
SAP Jobs are configured with the SAP S/4 HANA system. The JS7 JobScheduler implements a JITL Job to execute SAP Jobs.
- A 1:1 mapping of a JS7 JITL Job and an SAP Job applies. This allows parameterization on a per job basis.
- The JS7 JITL Job is added to JS7 - Workflows which are either configured:
- to execute individual SAP Jobs or
- to execute a number of jobs including SAP Jobs and any JS7 - Jobs with any registered JS7 Agent.
- This allows cross-platform scheduling with SAP Jobs being integrated into a sequence of jobs that is executed for SAP systems and for other platforms.
- The JS7 JITL Job uses JS7 - Calendars and Schedules.
- The JS7 - Schedules determine the parameters and the point in time at which the SAP Job is started.
- SAP Jobs therefore are started immediately from the point of view of the SAP Job Scheduling Service. JS7 manages any schedules and connects to the SAP Job Scheduling Service at the point in time of job execution to launch the SAP Job.
Job Execution
SAP Jobs can be executed synchronously and asynchronously. This is decided by the SAP transaction.
JS7 has to know the type of scheduling supported by the relevant SAP transaction:
- Synchronous Execution
- When the SAP Job is started by the JS7 JITL Job then the response to this call is delayed until the SAP Job is completed. Only then are additional calls to request SAP Job execution results and log output performed.
- Asynchronous Execution
- When the SAP Job is launched by the JS7 JITL Job then there is an acknowledging response that returns the SAP Job run identification. The JS7 JITL Job has to repeatedly check the SAP Job execution status. The interval for status checks by the JS7 JITL Job is configurable.
Job Control
The JS7 JITL Job acts as a shadow job for the SAP Job. It allows user intervention such as starting or stopping an SAP Job when the relevant operation on the JS7 JITL Job is performed from the GUI.
- Starting the JITL Job causes the SAP Job to start.
- Job parameters as available from the SAP Job configuration are forwarded when starting the SAP Job.
- JS7 supports the following parameter data types: String, Number, Boolean.
- The same applies to return values from SAP Jobs. Any return values from SAP Jobs are available to subsequent JS7 jobs in a workflow.
- Job parameters as available from the SAP Job configuration are forwarded when starting the SAP Job.
- Checking the JITL Job status and job logs returns the SAP Job status and log output with the JS7 JOC Cockpit GUI.
- Note that the SAP REST API only offers job logs after execution.
- Running logs, which typically available with JS7 jobs are not available from the SAP Job.
- Stopping the JS7 JITL Job results in the relevant SAP REST API call to:
- complete a running SAP Job and then to fail the JS7 Order:
- Execution of JS7 - Orders can be cancelled by using the CANCEL operation from the JS7 GUI. This allows the current SAP Job to complete execution and removes the JS7 order from the workflow - provided that the SAP transaction implements the respective operation to cancel execution.
- Execution of JS7 orders can be suspended by using the SUSPEND operation from the JS7 GUI. This allows the current SAP Job to complete execution and puts the JS7 order to a SUSPENDED state.
- terminate running SAP Jobs:
- Execution of JS7 orders can be cancelled with a CANCEL option to abort the currently running SAP Job and to remove the JS7 order from the workflow, provided that the SAP transaction implements a cancel/force option.
- Execution of JS7 orders can be suspended with a CANCEL option to abort the currently running SAP Job and to put the JS7 order to a SUSPENDED state, provided that the SAP transaction implements a suspend/force option.
- complete a running SAP Job and then to fail the JS7 Order:
- Error handling by the JS7 JITL Job includes checking execution results reported by the SAP REST API. If the execution is successful then the JS7 order will be continued. Otherwise the order has failed.
- The usual methods for JS7 error handling such as configurable retries by use of a JS7 - Retry Instruction, handling of catchable errors with the JS7 - Try-Catch Instruction etc. apply.
Further Resources