SAP Jobs

SAP Jobs start and monitor processes in the SAP target system. They can contain statements that start multiple processes (sub jobs). This job structure can be replicated in the Automic Web Interface. The SAP Job you create in the Automation Engine is the parent of those sub jobs (child processes) and serves as their container.

When you execute the SAP Job, its children start and are displayed in the Tasks list in the Process Monitoring perspective. Their object type is JOBD (dynamic job) and each child has its own unique RunID. In the Process Monitoring perspective you can check their status in the target system. You can also add comments, restart, cancel, edit them, and open the list of objects in which they are being used.

For more information about the integration between the Automation Engine and SAP, see AE and SAP.

Tip: Take a look at Example: Creating an SAP ABAP Job from within the AE for an example of how to set up your system to execute an SAP job from within the Automation Engine.

This page includes the following:

SAP Templates

The following templates are available for defining SAP Jobs: R3, SAP_ABAP, SAP JAVA and SAP_PI.

The R3 and SAP_ABAP templates are identical. They are named differently to let you find the name they are more familiar with.

All templates allow you to perform the following actions:

  • Add SAP commands on the Process page either as script or using forms. For more information, see Forms View on the Process Page
  • Add the script to be processed when the child processes have finished (Child Post Process page, see Process Pages)
  • Link to the Criteria Manager

R3 and SAP_ABAP Jobs also allow you to import SAP Jobs on the Process page using forms.

Prerequisites

Your Automation Engine system is connected to SAP using the SAP 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 using the Automic Web Interface and execute them in the SAP Client are:

  • Providing the necessary connection and login data

    1. The Agent binaries are installed and its INI file is configured to connect to the Automation Engine.
    2. The SAP Agent is defined
    3. 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). For more information, see Connection (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.
    4. A Login (LOGIN) object is defined that provides the necessary credentials for the job to be executed. For more information, see Login (LOGIN).

    For more information, see Technical Connection.

  • Activating the parent/child function in the SE38 transaction using the INITXBP2 program and the parameter REPLICATE=YES in the relevant script elements.

    This guarantees that SAP child processes are replicated in the Automic Web Interface as objects of type JOBD.

When these prerequisites are met, you can start building the scripts on the Process page of the SAP Job object definition.

Important: For SAP JAVA jobs, 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

  1. Open SAP NetWeaver Administrator.
  2. Go to Operations > Jobs > Java Scheduler.
  3. Click Add and enter a name and description.
  4. The User defined here must be set in the Connection (CONN).

SAP Commands

SAP Jobs in the Automation Engine are supplied with sets of predefined commands. A command is a group of SAP-specific strings or functions. You build the logic of an SAP Job on its Process page by adding commands to it. For more information, see Process Pages.

User-Friendly Scripting Using Forms

The script editor of the Process page in an SAP Job has two views. The usual one that is available for all Jobs, and the Form view. The Form view is an intuitive, user-friendly way of depicting the values you must enter for a particular command. The Form view of a command can contain dropdown lists, input fields, radio buttons, and so on. For more information, see Forms View on the Process Page .

SAP Child Processes

In addition to the Process pages common to all jobs, SAP provides an additional Child Post Process page. The script you enter on this page is processed for each individual child process immediately after it has finished.

Tracking External Jobs via the Remote Task Manager

Use the Remote Task Manager (JOBQ) to monitor processes that have not been started by the Automation Engine through an SAP Job.

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.

Important! Have a look at Important Considerations for SAP Processes for additional information on SAP jobs and the Remote Task Manager.

Restarting SAP Jobs from the Automation Engine

If a Job fails (its status is ENDED_NOT_OK), instead of initiating a new process request, restart it from the Task list in the Process Monitoring perspective. For more information, see Monitoring and Restarting External Tasks.

SAP ABAP Jobs

The options available on the SAP page for ABAP jobs can be used for every case in which the SAP Agent creates a background job in the SAP system at runtime. 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 be done with one single remote function call (BAPI_XBP_VARIANT_COPY) to the SAP system. In this case the job properties in the 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) within one Automation Engine job would lead to the creation of two SAP background jobs by default. In this case, the job properties in the 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 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.

This list provides details on the Keys, the variables and their possible values:

  • LOGID

    • Variable name: &@sap_bw_logid#

    • Value on chain level: "Logging Identifier of the Process Chain, (for example, DAUDN8Z697MBBFNJ4Q75JS80C)."

    • Value on step level: "Logging Identifier of the Process Chain (for example, DAUDN8Z697MBBFNJ4Q75JS80C)."

    • Value on step job level: "Logging Identifier of the Process Chain (for example, DAUDN8Z697MBBFNJ4Q75JS80C)."

  • NAME

    • Variable name: &@sap_bw_name#

    • Value on chain level: Technical Name of the Process Chain (for example, Z_NI)

    • Value on step level: Technical Name of the Process Chain (for example, Z_NI)

    • Value on step job level: Technical Name of the Process Chain (for example, Z_NI)

  • ID

    • Variable name: &@sap_bw_id#

    • Value on chain level: empty

    • Value on step level: "Technical Identifier of the Step (for example, DAUDN966N6KGDOWMEAPP5TFV0)"

    • Value on step job level: "Technical Identifier of the Step (for example, DAUDN966N6KGDOWMEAPP5TFV0)"

  • STEPNAME

    • Variable name: &@sap_bw_stepname#

    • Value on chain level: empty

    • Value on step level: Technical Name of the Step (e.g. RSM04000_ALV)

    • Value on step job level: Technical Name of the Step (e.g. RSM04000_ALV)

  • TYPE

    • Variable name: &@sap_bw_type#

    • Value on chain level: empty

    • Value on step level: Process Step Type (e.g. ABAP)

    • Value on step job level: Process Step Type (e.g. ABAP)

  • STATUS

    • Variable name: &@sap_bw_status#

    • Value on chain level: empty

    • Value on step level: Job Status of the Chain Step (e.g. F)

    • Value on step job level: Job Status of the Chain Step (e.g. F)

  • JOBNAME

    • Variable name: &@sap_bw_jobname#

    • Value on chain level: empty

    • Value on step level: empty

    • Value on step job level: SAP Job Name of the job (e.g. BI_PROCESS_TRIGGER)

  • JOBCOUNT

    • Variable name: &@sap_bw_jobcount#

    • Value on chain level: empty

    • Value on step level: empty

    • Value on step job level: SAP Job Count of the job (e.g. 13450100)

  • TYPE_TEXT

    • Variable name:&@sap_bw_type_text#

    • Value on chain level: "E_TYPE_TEXT of RSPC_API_PROCESS_GET_INFO (e.g. Processkette lokal)"

    • Value on step level: "E_TYPE_TEXT of RSPC_API_PROCESS_GET_INFO (e.g. Startprocess)"

    • Value on step job level: "E_TYPE_TEXT of RSPC_API_PROCESS_GET_INFO (e.g. Startprocess)"

  • VARIANT_TEXT

    • Variable name: &@sap_bw_variant_text#

    • Value on chain level: "E_VARIANT_TEXT of RSPC_API_PROCESS_GET_INFO (e.g. Chain with nested chain)"

    • Value on step level: "E_VARIANT_TEXT of RSPC_API_PROCESS_GET_INFO (e.g. Startni)"

    • Value on step job level: "E_VARIANT_TEXT of RSPC_API_PROCESS_GET_INFO (e.g. Startni)"

  • RESTART_COUNT

    • Variable name: &@restart_count#

    • Value on chain level: "number of restarts by BW_SET_CONSTRAINT, or 0 if not yet accessible"

    • Value on step level: "number of restarts by BW_SET_CONSTRAINT, or 0 if not yet accessible"

    • Value on step job level: "number of restarts of the parent by BW_SET_CONSTRAINT, or 0 if not yet accessible"

  • RESTART_COUNT_MAX

    • Variable name: &@restart_count#

    • Value on chain level: "number of restarts by BW_SET_CONSTRAINT, or 0 if not yet accessible"

    • Value on step level: "number of restarts by BW_SET_CONSTRAINT, or 0 if not yet accessible"

    • Value on step job level: "number of restarts of the parent by BW_SET_CONSTRAINT, or 0 if not yet accessible"

SAP Java Jobs

SAP Java Jobs allow you to handle jobs in the SAP Java Scheduler. To be able to work with them, the Java job definition must be deployed in the Java Scheduler. This makes it visible for the SAP Agent. It also 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.

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.

Note: 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 its execution data. The error is logged in the job "Agent Log" report and in the SAP Agent log file. The job aborts with return code 403.

Defining SAP Jobs

An SAP Job definition is made up of the following pages:

Tip: Some SAP Job reports can be very long. The Automation Engine supplies ready-to-use Style Sheet objects that you can use to format them. For more information, see Style Sheet (XSL).

To Define an SAP Job

Prerequisites:

  • 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 start up. 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.
  1. 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.
  2. Enter a name and click Add Object.
  3. The SAP Job definition pages open up displaying the SAP-specific one. Define the settings for SAP ABAP or SAP Java Jobs as described below.

  4. Go to the Process Pages and enter your script there.

  5. Switch to the Attributes Page and 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:

    1. Open the Explorer list in the Process Assembly perspective.
    2. Select the job and click the Details button on the toolbar.
    3. The key data on the job is displayed.

SAP ABAP Jobs

Start Parameters section:

  • Language

    Language used in SAP. The code of the language you select here is passed on to SAP in uppercase letters. Please, keep this in mind when you set the language using the script (SAP_LANG attribute, :PUT_ATT script element)

    For more information, see SAP Language Settings

  • Job Name

    Name of the job in SAP. It can contain up to 32 characters. If no job name is specified here, the default format is used by default: UC_JOB_RUN#

  • Job Class

    This value specifies the priority that will be applied for handling jobs in SAP.

    When jobs are waiting for a free batch process in SAP to be executed, their priorities determine which jobs go first.

    Tip: Assign Job ClassA (highest priority) to system jobs (basis, warehouse and maintenance jobs in SAP executed by system administrators), as these are prerequisites for all other jobs to run smoothly.

  • Target System

    No specification or target system in SAP. This is the name of an SAP Server in the form "<host name>_<system ID>_<system no>". For example: "host31_T40_00". This SAP Server must contain work processes for batch processing.

    SAP recommends to not use these parameters because they invalidate "Workload Balance" for batch processes.

  • Delete Job

    • Do not delete job

      The job is not deleted after it has been executed.

    • Always delete job in CCMS after completion

      The job is deleted in SAP after it has been executed. Deletion takes place in the CCMS (Computing Center Management System) which is a special application area for administrators.

      This is the default. When this option is activated, the job is no longer visible in your Process Monitoring perspective as soon as the job is completed. This is useful in case of multiple jobs that run at short intervals.

      Tip: If you want to have access to the tasks not only from the Automation Engine but also from your SAP system, deactivate this parameter.

    • Only delete job from CCMS if no error occurred

      The job is deleted in SAP after it has been executed only if the execution was successful and error-free.

  • Login Override

    Activate this option to use the credentials defined here to log on into the SAP system instead of the agent login defined in the Attributes Page.

  • Start Mode

    • As soon as possible, possible fallback to SAP system

      The system attempts to start the job as soon as possible. If there is no SAP background task available, the job is scheduled in the SAP system.

    • Immediately, abort if no SAP background task is available

      The system attempts to start the job immediately. The job aborts if there is no SAP background task (Type BTC) available.

Spool List Recipient section:

Define the basic details such as the Recipient, Address Typeetc. For using the Report Send Status, Report Status by Mail and No Printing options, the following SAP support packages are required:

  • for 4.6C - SAPKB46C52
  • for 6.20 - SAPKB62059
  • for 6.40 - SAPKB64017
  • for 7.00 - SAPKB70008

SAP Java Jobs

Start Parameters and Job Definition sections:

  1. Click the browse button to the right of the Job Definition filed to open a picker dialog where you can select the SAP Java job. The input and/or selection fields that correspond to the selected job are displayed below.

  2. In Job Settings define the following:

    • Job Children

      The job in the SAP system can have sub jobs.

      • Activate Wait for Children if you want the Automation Engine job to wait for those sub jobs to end. Then, the Automation Engine can also finish.
      • Activate Abort when child aborts if you want the Automation Engine job to abort as soon as a sub job in the SAP system aborts.
      • The SAP job you specify in the Automation Engine serves as container for those sub jobs in SAP; 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 Replicate Children.
    • Job Log

      • Activate and enter a value in Delete after x days to remove the job jog from the Java Scheduler after the specified number of days.
      • Activate Do not delete if you want to keep the job jog in the Java Scheduler.
      • Activate Use default settings to use the settings specified in the job definition in SAP.

      The job log is always deleted together with the job instance.

    • Fetch Size

      Specify here the number of lines of JXBP jobs to fetch.

For information on the Job Report section, see Job Reports.

Use Cases

Take a look at the topics listed below for examples:

See also: