Understanding the Concept of Background Processing

Objective

After completing this lesson, you will be able to explain the basic concepts of background processing

Introduction to Background Processing

In this lesson, you will learn about the basics of background processing.

Business Example

Reports that are to run on a regular basis and long-running programs are scheduled as jobs in the SAP system. The administrator schedules jobs and monitors the system's background processing to ensure that it is running correctly.

The Idea of Background Processing

Dialog work processes for processing end-user requests should generally be made available immediately, or at least without a noticeable wait time. Therefore, dialog work processes should only be used for requests with short processing times to ensure the maximum possible throughput and rapid availability. Up to SAP_BASIS 754, the system profile parameter rdisp/max_wprun_time exists for this reason. It limits the maximum runtime of a dialog step within a dialog work process. This should ensure that dialog work processes are not blocked by long-running programs, thus interfering with online operation. After the maximum runtime has elapsed, the program is terminated.

The operation of the parameter rdisp/max_wprun_time is described in detail in SAP Note 25528: Configuration of maximum work process runtime - parameter rdisp/max_wprun_time .

Note

As of SAP_BASIS 740, a more precise setting is possible: The maximum runtime can be set using the following parameter depending on the kernel priority (high, medium, low):

  • rdisp/scheduler/prio_high/max_runtime: Maximum runtime for requests executed with priority high (for example, GUI requests) .

  • rdisp/scheduler/prio_normal/max_runtime: Maximum runtime for requests executed with priority medium (for example, RFC requests).

  • rdisp/scheduler/prio_low/max_runtime: Maximum runtime for requests executed with priority low (for example, dialog requests triggered by background requests).

However, the following applies for compatibility reasons: If the parameter rdisp/max_wprun_time has been configured explicitly, its value overwrites the more specific settings.

As of SAP_BASIS 755, the parameter rdisp/max_wprun_time is removed from the ABAP kernel. Also the upgrade procedure removes it from the profiles during upgrade to SAP_BASIS 755 and above. See SAP Note 2918906: Deprecation of Profile Parameter "rdisp/max_wprun_time" for details. The set of the three new parameters above provide much more flexibility. Moreover, SAP assumes that the default values of the new profile parameter should meet the needs of most customers and their applications. But because of the mentioned compatibility rules of releases prior to SAP_BASIS 755, their values are often overwritten and the benefit is lost. Also, a switch from an old profile where rdisp/max_wprun_time has been set to the new priority-based defaults might cause incompatibilities if the ABAP code of the application is not well written.

As the figure Purpose of Background Processing illustrates, you can use the background work processes (sometimes also called batch work processes) for long-running tasks. You can also use background processing for recurrent tasks, such as the daily database backup or the month-end work for financial accounting.

You can define new jobs in transaction SM36. You can also call the Job Wizard (transaction SM36WIZ) from here. Alternatively, you can schedule background tasks in transaction SA38, along with numerous application transactions.

Note

In most cases, background tasks are scheduled by experts in the user departments. As the system administrator, you ensure that the scheduled jobs can actually run in the system (by ensuring a suitable system configuration, for example).

As shown in the figure above, when you define a job, you have to enter the following information:

  • General specifications such as job name, job class / priority (default: "C") and (optional) execution target / target server (group)

  • Definition of one or more job steps

  • Definition of a start condition (time-dependent or event-dependent)

Job steps and start criteria will be discussed in more detail in the remaining part of this lesson.

The Job Wizard supports you when defining jobs by guiding you easily through the creation process.

Note

The way in which a job is created ("classic" or using the Job Wizard) has no influence on the result. Some functions, such as specifying an SAP user for each step, or swapping steps, are not available with the Job Wizard.

Jobs and Job Steps

Every job is processed without interruption by one single background work process. As outlined in the figure Jobs and Job Steps, a job comprises one or more steps. A step within a job can be the following:

  • ABAP Program: Every ABAP program in the SAP system can be scheduled as a step of a background job. If the ABAP program has one or more selection screens, it might be required to create the necessary input in advance in the form of a variant. It is a Pre-assignment of the input fields of a selection screen for reports, for example, to enable the execution of the report in the background. A variant makes it possible to run an ABAP program in the background even if the program requires an input. The values stored in the variant are then used during the execution of the program. If an ABAP program has a screen output as its result, this will be saved in a spool list. You can specify an (e-mail) recipient for this spool list when defining the job. This recipient then receives the job output by e-mail after the job has been executed. You must also specify a printer for the creation of spool lists even though, as a result of background processing, there is not necessarily any direct output to a printer (this depends on the printer’s access method). This may have to be explicitly started later.

  • External Command: An external command is a call of a predefined script, a command, or a program at the operating system level. With external commands, you can "mask" operating system calls and store them in the SAP system under an elective name. You can also use the SAP authorization concept to protect the execution of an external command. This enables you to determine which users are allowed to execute which external commands (and on which target hosts and/or operating systems).

  • External Program : An external program is any operating system command. The SAP authorization concept only specifies whether a user can call external programs or not. A more detailed authorization assignment, for example, at the level of program names, is not provided. You should use external commands for this.

Step User

With the classic definition of jobs using transaction SM36, you can assign an (execution) user to each step of the job (see the following figure). The specified user is used for the authorization checks during the execution of the step, as shown in the figure below. By default, the name of the logged-on user appears in this field, and your job is performed using your authorizations. Enter a different user name, if your job should not be performed using your own authorizations.

Hint

To be able to do this, you must, however, have the appropriate authorization (authorization object S_BTCH_NAM) to enter names other than your own in the User field. An enhancement to this is authorization object S_BTCH_NA1 which controls not only the User field but also the ABAP program name field.

It is useful to set up technical step users (also known as "background users") for various work areas that have the necessary authorizations for the required activities, and that can be used by users with the same authorizations to schedule background tasks in this work area (such as for system administration). These users have separate user master records and are created specifically for use in jobs (this means it may not be possible to use them in dialog, which is just fine).

Note

End users should not be allowed to use technical step users that have more authorizations than their dialog user; otherwise this could pose a security risk.

Use the System user type when creating step users. A dialog log on with a user of this type is not possible. In the same way, users of this type are exempt from the usual settings for the validity period of a password. The password of a system user can only be changed by user administrators using transaction SU01 (UsersChange Password).

Note

The Job Wizard does not offer the option to specify a dedicated user to each step: When you use the Job Wizard to define a job, the name of the user who is logged on is included in the authorization check for each step automatically.

Priorities

As the figure above shows, background jobs can be scheduled with different priorities:

  • Class A (highest priority)

  • Class B (medium priority)

  • Class C (normal priority)

If a job should be executed on a particular server or job server group, it is handled preferentially compared to other jobs with the same class. This preference only applies if multiple jobs of various priorities request background processing at the same time, for example, because they are scheduled for the same start time.

Hint

You should ensure that a large share of all background tasks (about 90% of all jobs) are normally scheduled as a job with class C without target server specification. "System" background tasks are also executed in this way, such as the (database-related) tasks that you schedule with transaction DBACOCKPIT.

Start Options for Jobs

As shown in the figure above, a background job can be triggered in one of the following ways:

  • By scheduling it on a particular date at a particular time. This includes the start time "immediately" as well. If there are no free background work processes available when the job is released, the job will be scheduled with <actual date / time> as a start condition.

  • By the occurrence of a particular event defined in the SAP system. This includes jobs that should be started after other jobs or at operation mode changes. If there are no free background work processes available when the event is triggered, the job will be scheduled with <actual date / time> as a start condition.

Related Information on the Concept of Background Processing

For more information on the concept of the background processing, see the online documentation for background processing which (for example) is available on the SAP Help Portal (http://help.sap.com) for SAP S/4HANA, under Product Assistance, area Enterprise TechnologyABAP PlatformApplication Server ABAP - InfrastructureComponents of Application Server ABAPBackground Processing in the SAP System.

In addition, the following SAP Notes may be helpful:

  • SAP Note 25538Configuration of maximum work process runtime - parameter rdisp/max_wprun_time

  • SAP Note 2918906: Deprecation of Profile Parameter "rdisp/max_wprun_time"

  • SAP Note 519059FAQ: Background processing system

Log in to track your progress & complete quizzes