SAP Jobs
This subtype of the JOBS object defines SAP-specific processing steps to be carried out in a target system. Like all other job objects (JOBS), SAP jobs can run independently or they can be added to a group (JOBG) or to a workflow. For details on the integration between the Automation Engine and SAP please refer to AE and SAP.
This topic provides information on the following:
- Overview
- Prerequisites to Start SAP Jobs from the Automic Web Interface
- SAP Jobs and Child Tasks
- Child Processes
- Restarting SAP Jobs from the Automation Engine
- Tracking SAP Jobs via the Remote Task Manager
- SAP ABAP
- SAP BW: Data for Chain Steps Published as Script Variables
- SAP Java Jobs
- To Define an SAP Job
- Use Cases
- Next Steps
Four templates are available for defining SAP Jobs, namely:
Template | Includes |
---|---|
R3 |
The R3 and SAP_ABAP templates are identical. They are simply named differently to allow users to find the name they are more familiar with. |
SAP_ABAP | |
SAP_JAVA |
|
SAP_PI |
|
The SAP page for a sample SAP_ABAP job is shown below.
Provided you have an active connection to the target SAP system, you can then execute the jobs from within the Automation Engine. You can check their status, restart or cancel them if necessary, retrieve reports created in SAP, etc.
SAP jobs have two peculiarities. On the one hand, an additional Process page ( SAP Jobs - Child Processes) is available where you enter the scripts to be processed as soon as an individual SAP child process ends. On the other, script editor on the Process page of SAP ABAP jobs contains an additional function in the case of SAP jobs, namely the possibility to build scripts using pre-defined sets of commands via forms. See SAP Forms.
Take a look at Creating and Executing an SAP ABAP Job from within the Automation Engine for an example of how to set up your system to execute an SAP job from within the Automation Engine.
Prerequisites to Start SAP Jobs from the Automic Web Interface
Thanks to the integration with SAP systems, you can execute jobs in SAP directly from within the Automation Engine.
Your Automation Engine system is connected to SAP via the agent, which interprets and transforms the commands sent by the client so that SAP understands them. This means that the only prerequisites your system must meet to be able to create jobs via the Automic Web Interface and execute them in the SAP client are providing the necessary connection and login data, namely:
- The agent binaries are installed and its INI file is configured to connect to the Automation Engine.
- The SAP Agent is defined
-
At least one Connection (CONN) object provides the necessary data for connecting the agent to the SAP application server (the user and his/her login data). See Connection Object (CONN).
Take the following into account:
- For SAP ABAP jobs, you need a Connection object of type R3/Remote Function Call.
- For SAP Java jobs, you need a Connection object of type R3/Internet.
- A Login (LOGIN) object is defined that provides the necessary credentials for the job to be executed. See Login Object (LOGIN).
Please refer to the Technical Connection chapter for detailed information.
Additionally, for SAP JAVA jobs, take into account that the Java job must be deployed in the Java Schedule; this makes it visible for the SAP agent and allows you to define a Job object as instance of that job definition.
To Define an External Scheduler
- Open SAP NetWeaver Administrator.
-
Go to Operations > Jobs > Java Scheduler.
-
Click Add and enter a name and description.
- The User defined here must be set in the Connection Object (CONN).
SAP commands can contain statements that start multiple processes. As happens with all other executable objects, each execution of a job or process in SAP is identified in the Automation Engine by a unique runID.
The SAP job you specify in the Automation Engine is the parent and serves as container for the actual processes; the object type of its children is JOBD. They are displayed as subordinate to the job in the Tasks list (Process Monitoring perspective) as follows:
Here you can check their status in the target system, add comments, restart and edit them as well as open the list of objects in which they are being used.
Please make sure that the Tasks list in the Process Monitoring perspective is in hierarchical view mode to be able to see the parent/child tree structure.
In addition to the Process pages common to all jobs, SAP jobs have an additional Child Post Process page; The script defined on this page is processed immediately after the child process itself finishes. See SAP Jobs - Child Processes.
Restarting SAP Jobs from the Automation Engine
If a job fails (its status is ENDED_NOT_OK), instead of initiating a new process request, you can simply restart it from the Task list in the Process Monitoring perspective.
See Monitoring and Restarting External Tasks.
Tracking SAP Jobs via the Remote Task Manager
The Remote Task Manager Object (JOBQ) allows you to display, start, cancel, intercept and monitor external operations, that is, operations that run on applications outside the Automation Engine.
In a Remote Task Manager object you collect the filter criteria that identify the external tasks that you want to control. The external processes that comply with those criteria (in this case, SAP jobs) are then displayed on the Tasks window of the Process Monitoring perspective as sub-tasks of the Remote Task Manager object (the hierarchical view must be activated for this purpose). Their object type is JOBD.
Please have a look at Important Considerations for SAP for additional information on SAP jobs and the Remote Task Manager.
The input fields and options available on this page for SAP ABAP jobs are designed to be used for every case in which the SAP Agent creates a background job in the SAP system at run time. However it is not necessary for the Automation Engine to create an SAP background job for every use case. Copying a variant, for example, does not require a job. This can simply be done with one single remote function call (BAPI_XBP_VARIANT_COPY) to the SAP system. In this case the attributes (Start Parameters and Spool List Recipient sections) are useless.
On the other hand, one SAP job might create multiple SAP background jobs at run time. Applying the function for SAP ABAP program submission twice (R3_ACTIVATE_REPORT) subsequent within one Automic job would lead to the creation of 2 SAP background jobs by default. In this case the attributes (Start Parameters and Spool List Recipient sections) would be applied to every background job in SAP. If defined, both jobs would have the same job name in SAP.
SAP BW: Data for Chain Steps Published as Script Variables
In SAP jobs with BW chains, the agent creates the following script variables for each child process. These variables and their values are available automatically in the (child) post process window and are displayed in the Details window of the tasks.
Key | Variable Name | Value On Chain Level | Value On Step Level | Value On Step Job Level |
---|---|---|---|---|
LOGID | &@sap_bw_logid# | "Logging Identifier of the Process Chain (e.g DAUDN8Z697MBBFNJ4Q75JS80C)." | "Logging Identifier of the Process Chain (e.g DAUDN8Z697MBBFNJ4Q75JS80C)." | "Logging Identifier of the Process Chain (e.g DAUDN8Z697MBBFNJ4Q75JS80C)." |
NAME | &@sap_bw_name# | Technical Name of the Process Chain (e.g. Z_NI) | Technical Name of the Process Chain (e.g. Z_NI) | Technical Name of the Process Chain (e.g. Z_NI) |
ID | &@sap_bw_id# | empty | "Technical Identifier of the Step (e.g. DAUDN966N6KGDOWMEAPP5TFV0)" | "Technical Identifier of the Step (e.g. DAUDN966N6KGDOWMEAPP5TFV0)" |
STEPNAME | &@sap_bw_stepname# | empty | Technical Name of the Step (e.g. RSM04000_ALV) | Technical Name of the Step (e.g. RSM04000_ALV) |
TYPE | &@sap_bw_type# | empty | Process Step Type (e.g. ABAP). | Process Step Type (e.g. ABAP). |
STATUS | &@sap_bw_status# | empty | Job Status of the Chain Step (e.g. F) | Job Status of the Chain Step (e.g. F) |
JOBNAME | &@sap_bw_jobname# | empty | empty | SAP Job Name of the job (e.g. BI_PROCESS_TRIGGER) |
JOBCOUNT | &@sap_bw_jobcount# | empty | empty | SAP Job Count of the job (e.g. 13450100) |
TYPE_TEXT | &@sap_bw_type_text# | "E_TYPE_TEXT of RSPC_API_PROCESS_GET_INFO (e.g. Processkette lokal)" | "E_TYPE_TEXT of RSPC_API_PROCESS_GET_INFO (e.g. Startprocess)" | "E_TYPE_TEXT of RSPC_API_PROCESS_GET_INFO (e.g. Startprocess)" |
VARIANT_TEXT | &@sap_bw_variant_text# | "E_VARIANT_TEXT of RSPC_API_PROCESS_GET_INFO (e.g. Chain with nested chain)" | "E_VARIANT_TEXT of RSPC_API_PROCESS_GET_INFO (e.g. Startni)" | "E_VARIANT_TEXT of RSPC_API_PROCESS_GET_INFO (e.g. Startni)" |
RESTART_COUNT | &@restart_count# | "number of restarts by BW_SET_CONSTRAINT, or 0 if not yet accessible" | "number of restarts by BW_SET_CONSTRAINT, or 0 if not yet accessible" | "number of restarts of the parent by BW_SET_CONSTRAINT, or 0 if not yet accessible" |
RESTART_COUNT_MAX | &@sap_bw_max_restart_count# | "max number of restarts BW_SET_CONSTRAINT, or 0 if not yet accessible" | "max number of restarts by BW_SET_CONSTRAINT, or 0 if not yet accessible" | "number of restarts of the parent by BW_SET_CONSTRAINT, or 0 if not yet accessible" |
SAP Java jobs give you the possibility to handle jobs in the SAP Java Scheduler. A prerequisite for working with them is that the Java job definition be deployed in the Java Scheduler; this makes it visible for the SAP agent and allows you to create an SAP Java job in the Automation Engine that is an instance of the job in SAP.
Between the SAP Java job and the Automation Engine job there is a 1:1 relation.
In Start Parameter you select the Job Definition as available in the SAP Scheduler. For this purpose, and provided the connection with the SAP target system is available, clicking the browse button opens a picker dialog where you can select the SAP Java job. For example:
Depending on your selection here, the corresponding input and selection fields are displayed, where you can enter the values you need.
In the Job Settings section, on the other hand, you determine how to handle the child jobs as well as the job logs created in SAP.
SAP Java jobs can also contain sub processes. The SAP job you specify in the Automation Engine is the parent and serves as container for these child jobs; the object type of its children is JOBD. If you want them to be displayed as subordinate to the job in the Tasks list (Process Monitoring perspective), you must activate the Replicate Children checkbox.
Special Cases
In an environment with several nodes, the Java Scheduler jobs are processed on the node on which the Scheduler Service is active. If this node is deactivated or fails, job processing continues on a different node.
The agent periodically attempts to re-establish the connection to the Java Scheduler if it has been lost during job execution. The job remains active in the Automation Engine and with status Waiting for remote system.
The job aborts if calling the Java Scheduler results in an error. In this case, there is no report about the Java job's execution data. The error is logged in the "Agent Log" report of the job as well as in the SAP agent's log file. The job aborts with return code 403.
These instructions assume the following:
- The SAP agent is up and running and that it contains the necessary rights in the client in which you are defining the SAP job.
- A Connection (CONN) object has been defined that provides the connection data to the SAP application server as well as the SAP Login parameters (SAP client, user and password). This allows the agent to login into the SAP system at startup. For ABAP jobs, the connection type is Remote Function Call, for Java jobs it is Internet.
- The Connection object has been assigned to the SAP agent.
- A Login object is available that contains the credentials of the SAP user under which the job will be executed in the SAP system.
- In the Process Assembly perspective click Add Object. In the dialog scroll down to expand the Job (JOBS) list and select one of the available templates.
- Enter a name and click Add Object.
-
The SAP Job definition pages open up displaying the SAP-specific one:
For SAP ABAP Jobs: Define the required values in the Start Parameters section
For SAP ABAP Jobs: Define the required values in the Spool List Recipient section
Define the required values in the Job Report section
-
Switch to the Process page and enter your script here. In case of ABAP jobs you can use either the script editor or the Form view. See SAP Forms.
- Switch to the Attributes page.
-
Specify the Execution Settings. This is where you establish the relationship between the job, the agent that will connect to the appropriate SAP client and the Login object that contains the SAP credentials:
You can easily check the settings of your job before executing it:
- Open the Explorer list in the Process Assembly perspective.
- Select the job and click the Details button on the toolbar.
- The key data on the job is displayed.
Take a look at the topics listed below for examples:
- SAP Solution Manager
- Monitoring SAP PI Communication Channels
- Monitoring SAP Programs Update Requests
- Compare Values in SAP Spool Lists
- Automated System Copy for SAP
The list below tries to depict a possible road-map to define and work with Job objects and provides short descriptions of the actions you can take, additional information that can help you understand how they work and links to topics that further describe them:
-
Define the job general settings, which include the following:
- The basics, on the General Page.
- If required, apply a Sync object to the job; You do so on the Sync Page.
- On the Runtime Page specify the job runtime settings.
- Fine-tune access rights at object level on the Managing Authorizations at Object Level.
- Specify the object Attributes on the Attributes Page.
- Register the output files that will be produced when processing them on the Output Page.
- To be able to carry out searches in those output files and, if required, perform follow-up actions, specify these settings on the Output-Scan Page.
- You may want to use variables or prompts. You do so on the Variables & Prompts Pages.
- You may want to define the settings to backup and restore a job task when included in a workflow. This is useful to recover the last successful status in case of failed processes. You do this on the Rollback Page.
- The Version Management Page lists all the versions of an object and allows you to restore it to an older version in case of a misconfiguration.
- Enter information on the job you are defining on the Documentation Page.
-
Job objects (JOBS) have three pages on which you enter the scripts to be processed. They provide a number of convenience functions to help you with your work. If you enter scripts on all of them, they are processed in the following order:
- Pre-Process Page
- Process Pages
- Child Post-Process (SAP and PeopleSoft only), see Child Post-Process Page.
- Post-Process Page
- You can easily reuse code using Include Object (JOBI), which saves time and helps you keep your scripts consistent.
-
Execute the job.
There are multiple ways to do this that can be grouped as follows:
-
By a parent task.
This is the case of jobs that are included in a parent object (for example a Workflow or a Group). When defining them, take into account that their activation time can be different from their start time; the latter usually depends on the parent object.
-
Stand alone
This is the case when the job is not part of a parent object or, even if it is, you execute it independently of its parent. You have three possibilities:
When executable objects are processed, they go through the following four stages: 1. Activation, 2. Generation, 3. Processing and 4. Completion. Take a look at these topics to understand what happens with every processing stage.
-
-
When processing jobs, the Automation Engine generates output files and reports that guarantee traceability and auditability. Have a look at the following topics to learn more about this:
-
Monitor the generated object.
As soon as the job is activated, it is available as task in the Process Monitoring perspective. In the Task list you can see its status.
Right-click it to open its monitor (see Monitoring Jobs); it contains three pages that provide the most important information on the job parameters.
You can also access the Job Monitor from the Process Assembly perspective.
- In the Process Monitoring perspective a number of functions are available, depending on the status of the job. See Working with Tasks.
See also:
- SAP Jobs - Child Processes
- SAP Forms
- Executing Jobs in Java Stack (JXBP)
- Have a look at this use case to learn how to define and configure all you need to work with SAP jobs: Creating and Executing an SAP ABAP Job from within the Automation Engine