Working with Background Jobs - SAP BASIS

In this section, the use and basic management of background jobs are introduced. More advanced options and information about the background processing system are explained in Chapter.Background jobs are definitions of programs, printing specifications, and start times to be processed by the SAP background processing system. The programs can be either ABAP reports or external programs.With background processing, the system automatically runs the programs specified in the job at the scheduled time for its execution.

here are facilities to monitor the background jobs arid for displaying the job's results. Background jobs have the advantage over traditional online processing that once the job is defined, the background processing system takes care of running it. Otherwise, launching a program interactively locks your session for further input until the program is finished. Remember that in interactive dialog work processes there is a limit on the time a process can be running. If the programs surpass this limit, the system displays an error and the program is canceled. In cases of long-running reports, background jobs are the only way to execute those programs.

Because background jobs can be scheduled to run at any time, another of their advantages is that the execution of long reports can be specified to run at periods with less system load, such as nighttime or weekends. The background jobs offer a great advantage for defining automatic and periodic execution of the jobs, for example, periodic database cleaning jobs or the system performance collector, which runs hourly as a background job. System administrators have to define these jobs only once, and then they are regularly executed at the scheduled times. A report defined in a background job generates the same output as one run interactively. The output list can be either printed directly or sent to the output controller.

Because job definitions are held on the SAP database, jobs are available even when the whole SAP system or the computer itself is restarted. Jobs that were running at the time of a shutdown are canceled by the system, and the owner of the job has to schedule it back. There are several ways to define and schedule programs for background execution:

  • In some of the tasks within the SAP applications, the system automatically schedules long-running reports or programs for background execution.
  • From within the ABAP workbench program editor and from several other SAP application screens where programs can be executed, the menu bar or the application toolbar often contain the option to execute the program

either online or in the background. Within the ABAP editor, this function is under Program | Execute | Execute in Background. Upon choosing this option, the system displays the screen for defining and scheduling the job. At any time and anywhere in the SAP system, a job can be defined by selecting System | Services | Jobs | Define Job. Alternatively, system administrators can also go to the job definition screen by selecting Tools | CCMS | Jobs | Definition or directly with transaction SM36, where the job information must be specified.

Initial Job Definition screen

Initial Job Definition screen

Scheduling Background Jobs

The system offers several ways to define background jobs as stated earlier. A job definition basically consists of the following:

  • Entering a name for the job
  • Entering the date and time of when to execute the programs
  • Entering the program or programs to be executed in the background. Programs can also contain variants
  • Entering printing information
  • Entering the names of recipients of the spool list

There are many other options when scheduling a job, such as specifying the host to execute the job, indicating the priority, deciding whether to execute it periodically, specifying a system event instead of time, and so on. Since release 4.6 of SAP R/3 and other SAP Basis-based solutions, you can also find a Job wizard, which will guide you step by step in the process of defining a background job. To schedule a job, go to the job definition screen by selecting System | Services Jobs | Define Job from any menu. On this screen, enter a name for the job first. You can choose any meaningful name. In the Job Class input field, you can specify A B, or C. Job class C is the normal and default value. A and B are higher-priority classes, and users must have authorization for those classes.

Users can enter a target host (Exec. Target) for background processing or leave it blank for executing it on the default background server. Clicking on the possible entries arrow displays a list of available background servers. Select the start time for the job by clicking on the Start Condition button. The screen for specifying the start lime has many available options. Normal options are either Immediate, which schedules the job as soon as you save it, or Date/Time, which schedules the job for the date and time specified. The other options follow.

  • After job. The job will start when another job that must be specified has been completed. In order to use this option, you must know the name of the other job. If you check the box next to Start Status Depend, the job will only start if the previous job finished successfully. Otherwise, the job will not start.
  • After event. The job will start when the background processing system receives a signal with the event specified. You can see the available events by clicking on the possible entries arrow.
  • At operation mode. The job will start as soon as the operation mode becomes the active one. Operation modes are a way of configuring how the SAP system distributes the work processes.
  • Start on work day. The job will start on the day of the month you specify. Upon clicking on the possible entries arrow, the system displays the SAP factory calendar from which you can choose a workday of the month. For example, entering 07 will cause the job to start on the seventh work day of the month. You can specify additional restrictions, such as not starting before a specific date and so on.

Check your entries with the Check button and, if the system does not complain, save your entries. The system then takes you back to the job definition screen. Now, you mustspecify the program or programs to execute. Because a job might contain several programs (either ABAP or external programs), the system names them as steps. Click on the Define Steps button on the application toolbar. The system displays the Create Step screen. Initially, the input fields of the screen are grayed out until you either press the ABAP Program, External Command, or External Program buttons, depending on the type of program being sent to the background. Clicking on one of the buttons changes the color of the associated input fields. Select over one of the fields and fill in the needed information:

  • Enter the user ID under whose authorization the SAP system will run this background job. By default it uses the current user ID under which the user has logged on.
  • Enter the name of the program. If the program has a variant, the system will request that it be entered.
  • Enter the language in which you want to receive the output for the report. Remember that SAP Solutions supports many different languages.
  • Finally, using the Print Specifications button, you can specify how to print the results of the programs.

When specifying external programs, such as C programs, shell scripts, or other supported types, the full pathname must be specified together with the parameters the program might need, such as options or filenames, and the hostname where the program will be executed. Make sure the system can access the specified host and path and that it has the right permissions. Press the Save button to save the job. At this moment, the job is scheduled to be processed by the background system at the specified start date and time.

job that has been scheduled does not actually run until it is also released. To release a job, the user must have the right authorizations. If the user is not authorized to release jobs, then administrators must release the jobs for him or her. This is a security measure to better monitor and control the background processing system. To check the status of your background jobs, select System | Own Jobs from any SAP screen in the system. If you see a job with status Cancelled, it means the job has terminated abnormally. Press the Log button to find out the reason for the failure. System administrators can monitor background jobs graphically from the facilities of the CCMS.

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status