How to Create Background Jobs in SAP: A Step-by-Step Guide

In SAP, you can create background jobs using the SAP Job Scheduler to automate and schedule tasks to run in the background without user intervention. Background jobs are useful for running routine, time-consuming, or resource-intensive processes. Here’s a step-by-step guide on how to create a background job in SAP:

What is Background Processing?

In the SAP system, batch jobs are called background jobs. They are executed whether a user is logged on to the system or not. This is the main difference from the execution of a program in dialog mode. Background jobs provide the following advantages:

  • Users can run jobs after work or on the weekend.
  • The program can run without locking a user session.
  • Jobs that take a lot of time might be canceled if they are executed online as soon
    as they exceed a certain time limit.

Numerous SAP transactions let you choose between an execution in dialog mode or in the background. For dialog and background processing, the SAP system provides different work process categories. If you choose background processing, a background job is created that uses a batch work process (BTC category). If you run the transaction in dialog mode, a dialog work process (DIA category) is blocked. As an alternative to creating a background job from a specific transaction, you can also create and schedule background jobs yourself.

Creating Background Jobs

In the SAP system, background processing is mainly used for the execution of regularly scheduled jobs. Regularly scheduled jobs are background jobs that are executed according to a schedule, for example, every day at 11am or every Sunday at 5am.

Unlike spontaneously performed background jobs, the start is specifically planned, and the execution is repeated at certain intervals. Regularly scheduled jobs are used for the following tasks, for example:

  • Collecting performance data for statistics
  • Importing data into an information system, for example, Special Ledger
  • Generating reports
  • Generating a data file for an outbound interface
  • Processing an inbound interface
  • Performing cleanup tasks, for example, deleting obsolete spool requests

Documenting Critical Jobs

You should list all critical scheduled jobs. This refers in particular to job runs that are important for the business processes of your enterprise, such as interfaces or overnight processing programs. You should record the following for every job of this category:

  • Day/time of the planned start
  • Expected duration
  • Contact persons (name and telephone numbers) in case problems occur
  • Restart or troubleshooting procedures.

General

You must generally consider the following aspects when scheduling regular or spontaneous background jobs.

User ID

Like dialog mode, background processing requires an SAP user with ID and the corresponding authorizations. In dialog processing, programs are usually executed with the ID of the user who is currently logged on to the system. For background processing, a job is normally always started with the user ID of its creator.
However, you can also define another user ID afterward You can create specific user IDs that are solely used for the scheduling of batch jobs, for example, BATCH1. You should work with several user IDs for the different task areas if batch jobs are scheduled by different organizations or groups or if they are scheduled for them. The disadvantage is that you have to administer multiple accounts.

Using Multiple User IDs
You can assign the user IDs as follows, for example:

  • BATCH_BC: System jobs
  • BATCH_FI: Financial accounting
  • BATCH_KR: Vendors
  • BATCH_WH: Warehouse
  • BATCH_MM: Material planning/stock

These special user IDs enable you to schedule jobs independently of the person. So you avoid jobs that can’t be executed when an employee leaves the enterprise, for example, because the user ID of the employee has been locked or deleted. Another advantage of this procedure is that background users can also be of the system type (see Chapter 13); in other words, in a security-oriented environment, they can have more authorizations than would be acceptable for dialog users.

Variants

For the execution of a program with specific settings or selection parameters, a batch job may require the creation of a variant. Variants enable you to start jobs with default parameters, for example, predefined selection criteria. You have to create this variant in the dialog mode before you schedule the job. You can then specify this variant when scheduling the job.

Other

Various components and functions may require specific regularly scheduled jobs. The Special Ledger, for example, requires a regular job for copying data from the Financial Accounting/Controlling (FI/CO) components and for generating sets in the Special Ledger. Furthermore, several cleanup jobs may have to be executed at the database and operating system level.

Creating and Scheduling Background Jobs

Follow these steps to create and schedule new background jobs:
1.Enter Transaction SM36 in the command field and press the (Enter) key (or select the menu option Tools • CCMS • Background Processing • SM36—Define Job).
2.Make the following settings (see Figure 1):
► Enter a name in Job Name.
► Define the start priority of the job with Job Class.
► Optionally, define a specific server as the Exec. Target provided that your SAP system comprises various application servers. The Status is preset.

How to create background Job in SAP
Figure 1 Creating a Background Job
Naming Convention for Background Jobs
Using standard naming conventions facilitates the administration of jobs.
Job Classes
The job class defines the start priority of a background job, that is, the sequence in which a free batch work process is assigned to the jobs. A job of class A is started before a job of class B, and a job of class B before a job of class C. Class C is the default job class. After the start, all jobs have the same priority. That means a job of class A doesn’t occupy processing resources of jobs of class B to accelerate the execution. Queued jobs
don’t have an effect on running jobs. A queued class A job doesn’t replace a class C job that is currently running. You can reserve batch work processes for jobs of class A in an SAP system. This enables you to control that the execution of very critical background jobs isn’t blocked by unimportant jobs because no work processes are available.
  1. Now, select Step, and click on the ABAP Program button in the subsequent dialog box to schedule an ABAP program (see Figure 2).
Using Job Classes Efficiently
Use job classes efficiently. For example, it doesn’t make sense to assign every job to class A because all jobs are executed with the same priority then. Usually, jobs should be assigned to class C. Only jobs that must be started as preferred should be assigned to class A. There should be a reason for the assignment to a higher priority. You can use the SAP authorization concept as a reference.
Job Steps
Each job consists of one or several steps that need to be defined individually. The steps
are executed in succession.

4.Enter the following data here:
► In User, you can optionally define a user ID under which the job will be executed.
► In the ABAP program area, enter the name of the program in Name.
► If there are variants of the program, you can also enter a Variant.
► Click on Check to check the consistency of your entries.

User IDs in Background Jobs
The User of the job step provides the authorizations with which the job is executed; irrespective of this entry, the job overview (see Section 2) lists the job with the user ID of the creator. You can only use user IDs of the user type dialog, system, or service for background processing.
How to create background Job in SAP
Figure 2 Creating a Background Job for Executing an ABAP Program
  1. Click on Print specifications. If the program generates a spool or output request, enter the name of the printer in Output Device (see Figure 3).
  2. Click on Properties to define the required spool control options in the Spool Request Properties screen (see Figure 4). Your settings depend on whether you want to print the lists directly and for how long you want to retain them. When you’re finished, choose Continue .
How to create background Job in SAP
Figure 3 Defining the Output Device
How to create background Job in SAP
Figure 4 Setting the Spool Request Attributes
  1. Also confirm the selection of the printer in the previous screen, Background Print Parameters,
    with Continue.
  1. Save your entries in the initial dialog box, Create Step 1 (refer to Figure 2)
    using Save.
  2. The overview of the already-defined steps is displayed (see Figure 5). Here you can add more steps and change or delete already-defined steps if necessary. Select Backback, to return to the initial screen of the job definition (refer to Figure 1).
How to create background Job in SAP
Figure 5 Overview of Defined Steps
  1. Click on Start condition. If you schedule a regular job, select the Date/Time button (see Figure 6). Enter a date and time in Scheduled Start. For No Start After, enter the last possible date and time for the program start. If you want to start the execution of the program immediately, select the Immediate button.
Considering the Time Zones of the Database Server
The date and time of the scheduled start refer to the database server and not to the local time.
Don’t Schedule Jobs for 24:00
Never set the start time for a job to 24:00 because this job will not start. In the SAP system, 23:59 is always followed by 00:00; that is, the time 24:00 doesn’t exist from the technical point of view.
Option "No Start After"
The entry in the No Start After field is important if performance-intensive programs mustn’t start at certain times to avoid jeopardizing running operations or to prevent one job from passing the other.
How to create background Job in SAP
Figure 6 Defining the Start Time
  1. Activate the Periodic Job checkbox, and click on the Period values button.
  2. In the dialog box, select the required period (e.g., Daily), and click on Check. If the system doesn’t output an error message, select Savesave (see Figure7).
How to create background Job in SAP
Figure 7 Defining the Period Values
  1. Verify your entries in the Start Time screen (refer to Figure 6) using the Check button and confirm them with Savesave . This navigates you back to the Define Background Job screen.
  2. Again, click on Save. The status bar now displays a message that confirms the creation of the background job (see Figure 8).
How to create background Job in SAP
Figure 8 Status Message to Confirm Job Scheduling
Job Wizard
As an alternative to referring to these instructions, you can call the Job Wizard. It guides you through the individual steps of the process described.

Leave a Comment