Setting Up the Background Processing Environment

Objectives

After completing this lesson, you will be able to:
  • Evaluate the need for reserving work processes for high-priority jobs
  • Create Job Server Groups and explain their use
  • Create RFC groups for the parallel processing of jobs
  • Schedule housekeeping jobs
  • Perform simple tests to check the consistency of the background processing environment

Reservation of Work Processes for Class A Jobs

In normal operation, every background work process processes jobs of every priority.

You can, however, reserve some of the configured background work processes as desired for high priority jobs; that is, class A jobs. The reservation of work processes for class A jobs does not reserve any particular work processes. Rather, it ensures that a particular number of background work processes are kept free for class A jobs whenever possible.

Jobs of classes B and C can only be started if the defined number of work processes remains free for possible class A jobs, as shown in the figure below.

This option allows a choice between two prioritization strategies for your background jobs:

  • Critical track (class A) and two-level priority (classes B and C): If you have mission-critical jobs whose immediate execution must always be ensured, you can set up class A as your "critical jobs" category. In this case, reserve a work process for class A jobs and assign class A only to these mission-critical jobs. In this scenario, class B and C jobs are very unlikely to block a class A job.

  • Three-level priority for allocation of free work processes: You can also decide to run with a straight three-level priority scheme for allocating free work processes. In this case, reserve no work processes for class A. If the class A workload is small, or bottlenecks rarely occur in background processing, that is, at least one background work process is usually free, the reservation of a work process for class A jobs probably provides no advantages. In this case, reservation will simply mean that a work process is seldom used.

To set the number of reserved background work processes for class A, you can define an operation mode in transaction RZ04 (CCMS: Edit Operation Modes and Instances) and maintain the work process distribution for this operation mode. When doing so, you have the option of reserving work processes.

Hint

If you want to use the function for reserving background processes for class A jobs, it is usually enough to define one background work process for class A jobs in each system. We recommend that you do not reserve more than one background work process for processing class A jobs for each application server.

Target Server and Job Server Groups

Only instances with background work processes or a job server group can be used for the targeted scheduling of a background task.

A job server group contains one or more instances with available background work processes. You can use groups of this type in the same way as logon groups for dialog users. You can also process background tasks from different applications on selected instances.

Job server groups can be used to separate jobs from application servers being used by dialog users. In this case, the job server group used by a job would contain application servers other than those contained in the logon groups (transaction SMLG) for dialog users.

To set up a job server group, start transaction SM61(Display control object list) and then choose Job Server Groups. You can then define your job server group and assign your instances (see the figure above).

For more information, see SAP Note 612838Administration of job server groups.

Hint

There is a default job server group that you can create and use as described in SAP Note 786412Determining execution server of jobs w/o target server.

Note

In transaction SM61, you can also perform health checks for application servers (leading to transaction SM65) and (by choosing Modify control object list entry in the application toolbar) you can change the trace level for background control objects.

Parallel Processing of Jobs

For some long running SAP reports, the nights are just getting too short. Especially at customers with large volumes of data, some reports that customarily run in the background processing system (such as material planning runs) may have run times of many hours. These jobs can exceed the "night-time" that is available, particularly if the dialog users are distributed across multiple time zones.

SAP offers a solution to the "short nights" problem: parallel-processed background jobs. Long-running reports can now implement parallel processing where the work to be done can be distributed into smaller packages for the available work processes. The results can then be collected and synchronized.

In parallel processing, a job step is started as usual in a background processing work process. With the help of the ABAP command CALL FUNCTION <Function Module> STARTING NEW TASK <Task> DESTINATION IN GROUP <Group>, a program that runs in a job step can be programmed to have portions of the data to be processed run in parallel in other work processes (see the figure above). The calling program is continued as soon as the remotely called function has been started in the target system, without waiting for its processing to be finished.

Note

While the job itself runs in a background process, the parallel processing tasks that it starts run in dialog work processes. Such dialog work processes may be located on any SAP server.

Note

By default, a parallel-processed job uses all qualified servers in an SAP System according to automatic resource-allocation rules. However, by defining RFC groups, you can control which servers can be used for parallel-processed jobs. An RFC group specifies the set of allowed servers for a particular parallel-processed job.

By default, the group of servers eligible to be used for parallel processing is all qualifying servers in your SAP System (CALL FUNCTION <Function Module> STARTING NEW TASK with the argument DESTINATION IN GROUP DEFAULT). However, by defining RFC groups, you can control which servers can be used for parallel-processed jobs.

Definition of RFC Groups for Parallel Processing Jobs

An RFC group specifies the set of allowed servers for a particular parallel-processed job.

To define an RFC server group, use transaction RZ12. For RFC server groups, the descriptions of the individual parameters for resource allocation of the can be found in the F1 help in the system. Limitations concerning the SAP system parameters are explained in SAP Note 99284 – RFC exception: RESOURCE_FAILURE. Also, see SAP Note 2001276 – Changed configuration as of 7.40 SP2 for changes as of AS ABAP 7.40. It is recommended to deviate from the predefined SAP standard values for the parameter in very exceptional situations only (and must be tested with the relevant load on the system).

Note

When a server belongs to more than one group, jobs that use the group will compete for free work processes on the shared server(s). You must ensure that the group you create is also specified in the ABAP program that will use the group.

Standard Jobs (non SAP S/4HANA)

As a system administrator, you are going to work with a lot of batch jobs in your business, and want to know what you have to keep the batch functionality in an optimal state.

Standard jobs are background jobs that should run regularly in a production SAP system. These jobs mainly perform certain clean-up tasks in the system, such as the deletion of obsolete spool requests.

Note

For example, the batch system is an operative execution environment for jobs, therefore SAP does not reorganize the jobs by default but it keeps online the earlier executed jobs in the database, too. As a consequence, it is very important to work with an optimal reorganization strategy in your system in order not to let grow the table sizes for jobs in the system (tables TBTCO, TBTCP, ... ) too big. This is why it is important to execute corresponding housekeeping jobs in your system regularly (for example SAP_REORG_JOBS).

In AS ABAP-based SAP systems that are not SAP S/4HANA Server systems, you can access a selection of important standard jobs that you can schedule, monitor, and edit in the transaction SM36. To do so, you should choose Standard jobs in the application function bar. As the figure Scheduling Standard Jobs displays, you will see the table with all standard jobs (table REORGJOBS). If there are no standard jobs scheduled, the table will appear empty.

  • If you want to schedule all standard jobs, choose Default Scheduling and provide a system user under which the jobs should be executed. All standard jobs will be scheduled with the specified variant and period. If other jobs exist that execute one of the programs of the standard jobs, you will see an information message.

  • To schedule individual jobs, choose the selected job with the input help and specify an execution period.

  • To define an additional standard job that is not yet available in the selection (table REORGJOBS), choose Predefine new job.

Note

SAP recommends scheduling the jobs in client 000. However, some of the jobs specified work with client-specific objects (for example, jobs). For more information, see SAP Note 16083: Standard jobs, reorganization jobs.

Due to changes to standard jobs over time, schedule the standard jobs manually according to the SAP Notes listed below which also provide more information on standard jobs:

  • SAP Note 16083: Standard jobs, reorganization jobs
  • SAP Note 1034532: Changes for standard jobs
  • SAP Note 1411877: New Standard Jobs
  • SAP Note 1440439: New Standard Jobs (2)

Technical Job Repository (SAP S/4HANA)

In SAP S/4HANA Server systems, the Technical Job Repository serves the purpose to automatically schedule so-called technical background jobs (both in the "ADMIN" and "BUSINESS" clients) which must be running in order to keep the system "healthy". It replaces the "Standard Job" functions in transaction SM36 and consists of a design-time component and a runtime component.

  • The designtime component allows SAP to create Technical Job Definitions (in short: Job Definitions) which are basically templates for recurring background jobs.

  • The runtime component is automatically active in every SAP S/4HANA Server system. This can be checked with the help of program R_JR_UTIL_1 with default parameter settings.

    The runtime component is responsible for actual scheduling (or unscheduling) of background jobs as mandated by the set of delivered Technical Job Definitions. The run-time component is triggered by an hourly action which occurs automatically in an SAP S/4HANA system.

    Hint

    The profile parameter responsible for this is rdisp/job_repo_activate_time with default value 60M. The hourly Job Generation action stores its last execution time in table BTCCTL. So it is possible to receive the last Job Repository job generation time by displaying table BTCCTL with transaction SE16 and selecting the entry with key value CTLOBJ = JOBDSDL.

Almost every job definition contains the value "(DEFAULT)" in field User Name. This is actually a placeholder for the execution user that the runtime component will use when scheduling the background job. As default behaviour, the Technical Job Repository will use SAP_SYSTEM as batch job step user if this user is available in the current client. If no such user exists, user DDIC will be used as batch job step user as a fallback solution.

The job definition status (see figure above) differs from the background job status. A job definition can be consistent, but nevertheless the job is not scheduled, for example because it should not run in the current client.

The job definition status reason explains why no job is scheduled for a job definition, for example

  • if the user of the job definition does not exist in the current client (status reason "BTC User Error") or

    Note

    As of release SAP_BASIS 7.56, if you select one job definition from the list and choose button All clients in the application toolbar, you will get an overview of the selected job definition details in all clients.

  • if the job will not run in the current client (status reason "Not Relevant") or
  • if the job definition is scope dependent (see column Scope Dependent) but the scope conditions are not fulfilled (status reason "Not In Scope") .

Transaction SJOBREPO_STEPUSER allows you both to create a suitable technical user for Job Repository for the current client and to assign a technical user to the current client that is to be used by Job Repository. With the help of this transaction you can also display currently assigned Job Repository technical users for all existing clients.

For more information about the Technical Job Repository, see SAP Notes 2190119: Background information about S/4HANA technical job repository and 3236399FAQ - Technical Job Repository (SJOBREPO).

Access the Technical Job Repository

Task 1: Analyze a Job Definition

Steps

  1. Using the Technical Job Repository, answer the following questions:

    • What does the technical job definition SAP_REORG_JOBS do?
    • In which client(s) is technical job definition SAP_REORG_JOBS supposed to run?
    • What is the recurrence time of technical job definition SAP_REORG_JOBS?
    1. Log on to client 100 of your SAP system.

    2. Open the Technical Job Repository:

      • start transaction SM36, then choose Job Repository (Shift+F5)
      • start transaction SJOBREPO
    3. Keep the selection options unchanged and choose Execute (F8).

    4. Scroll down to and select the line for technical job definition SAP_REORG_JOBS.

      Hint

      You may also use the Find function.
    5. For the documentation, choose JD Docu (Ctrl+F4). After reading, Close the popup.

      Result

      Technical job definition SAP_REORG_JOBS refers to report RSBTCDEL2 and variant SAP&001, which deletes background jobs based on predefined deletion criteria.

    6. For the client information, double-click technical job definition SAP_REORG_JOBS. Choose Execution Terms and note the section Run job in.

      Result

      Technical job definition SAP_REORG_JOBS runs in Administration Client (which is client 000).

    7. For the recurrence, note the section Time based recurrence at the bottom of that view. When done, choose Exit (Shift+F3).

      Hint

      For details on the time zone, access the F1 help text for field Use system timezone.

      Result

      Recurrence is daily at 23:30 CET (CET because Use system timezone is not checked, and CET is the Default Time Zone for User (table TTZCU, field TZONEDEF)).
    8. Do not close the SAP GUI window with the Technical Job Repository.

  2. Using transaction SM37, analyze the step(s) of background job SAP_REORG_JOBS.

    1. Start transaction SM37.

    2. For Job Name, enter SAP_REORG_JOBS. For User Name, enter *. Choose Execute (F8).

    3. Job SAP_REORG_JOBS should show up once. Note that the client is 000.

      Note

      In case no background job SAP_REORG_JOBS shows up, enter a later To date at the job selection screen.
    4. Select job SAP_REORG_JOBS and choose Steps.

      Result

      Job SAP_REORG_JOBS consists of one step: ABAP program RSBTCDEL2 with variant SAP&001.
    5. Choose Back (F3) to return to the job list.

    6. Do not close the SAP GUI window with the job list.

  3. Using transaction SA38, determine the values of the following variants for program RSBTCDEL2:

    • SAP&001 (shipped by SAP)
    • CUS&TRAINING (prepared in the training system)
    1. Start transaction SA38.

    2. For Program, enter RSBTCDEL2.

    3. Choose Overview of variants.

    4. Double-click the line for variant SAP&001 and note the values. When done, choose Back (F3).

    5. Double-click the line for variant CUS&TRAINING and note the values. When done, choose Back (F3).

      Result

      Delete jobs with statusvariant SAP&001variant CUS&TRAINING
      Finishedolder than 14 daysolder than 28 days
      Canceledolder than 14 daysolder than 90 days

Task 2: Modify a Job Definition

Steps

  1. Within the Technical Job Repository, change the variant of technical job definition SAP_REORG_JOBS to CUS&TRAINING (in all clients).

    1. Switch to the SAP GUI window with the Technical Job Repository (transaction SJOBREPO).

    2. Ensure that you have selected technical job definition SAP_REORG_JOBS.

    3. Choose Change variant (Ctrl+F1).

    4. In the Configuration of a Job Definition popup, at field Variant for all clients, use the F4 help to select the CUS&TRAINING variant. When done, choose Save.

    5. In the Record in transport request popup, choose No.

    6. Choose Enter to close the Change Technical Job Definition Attributes popup.

    7. Back in the list of job definitions, note the column Custom Variant for technical job definition SAP_REORG_JOBS.

  2. Determine the value of profile parameter rdisp/job_repo_activate_time.

    1. Start transaction RZ11.

    2. For Parameter Name, enter (or select) profile parameter rdisp/job_repo_activate_time.

    3. Choose Display.

      Result

      Profile parameter rdisp/job_repo_activate_time is set to the default value 60M, meaning that a background job is scheduled every hour to check for changed job definitions and their (de)activation.
  3. Using transaction SM37, analyze the step(s) of background job SAP_REORG_JOBS. Refresh the output after one hour.

    Note

    While waiting, your instructor may continue with the class.
    1. Switch to the SAP GUI window with the background job SAP_REORG_JOBS listed (transaction SM37).

    2. Select job SAP_REORG_JOBS and choose Steps.

    3. Note the variant (table column Parameters) for RSBTCDEL2. When done, choose Back (F3).

    4. After one hour, choose Refresh (F8) to refresh the job list. Select job SAP_REORG_JOBS and choose Steps. Note the variant again.

      Result

      After one hour (at the latest), the variant should have changed to CUS&TRAINING.

Analyzing the Configuration of Background Processing

Certain requirements have to be met before the background processing can work. For example, profile parameters and authorizations must be set. A simple function is available for checking the consistency of the background processing environment: the analysis tool for background processing (transaction SM65). This tool is displayed in the figure below.

There are two test types available:

  • Basic tests (initial screen): Here you can check whether the profile parameters are correctly set and whether the user ID SAPCPIC exists (required for starting external programs). You can perform this check both for a particular background server and for all servers. It is required for starting external programs.

  • Expert tests (from the start screen, choose GotoAdditional Tests): In addition to the basic tests described above, you can us this option to also check the

    • user authorization for background processing

    • name of all job servers

    • function and status of the TemSe subsystem, which is required for writing the job logs

    • consistency of the database tables.

The background processing stores job data in multiple database tables. These tables can be checked for consistency. This test is especially important if problems occur with the database and you need to determine whether all job data is still available.

Note

In addition, the program BTC_OPTIONS_SET offers you versatile options for background processing in your system. For each option in this report, the SAP Note that provides additional information for the relevant function is identified. For example, you can allow to specify a target server or a target server group for execution in the background using transaction SA38 and from an application as well.

Checking the Background Environment

Business Example

Reports that should run on a regular basis and long-running programs are scheduled as background jobs in the system. It is the responsibility of the system administrator to schedule jobs and monitor the system's background processing to ensure that it is running correctly. As a system administrator, you want to check how background processing is configured in your SAP system.

Steps

  1. How many background processes are currently configured in your SAP system?

    1. Log on to your assigned SAP system with the credentials that your instructor provides. Start transaction SM50 (Work Processes of AS Instance <Instance name>).

    2. Choose System-Wide List in the application toolbar to display all work processes configured in the SAP system.

    3. Select column Type. Then choose Set Filter in the application toolbar and filter for work process typeBTC. Choose Execute.

    4. On the resulting screen, count the number of background work processes displayed (work processes of type BTC).

    5. To remove the filter, again select column Type, again choose Set Filter, remove the entry BTC and choose Execute again.

  2. How can you change the number of configured background work processes on an application server instance? What do you need to consider when you want to change the configuration?

    1. You can change the number of background work processes on an instance by setting the parameter rdisp/wp_no_btc in the instance profile in transaction RZ10.

      You can check the value of the parameter with transaction RZ11 or transaction RSPFPAR.

      Hint

      To make the changes effective, you need to restart the individual instance or the entire SAP system.

  3. Assume that all background work processes in your system are currently processing and there are, therefore, no free resources for other jobs. Can you make additional background work processes available without restarting the SAP system?

    1. If you have defined operation modes (transaction RZ04), you can provide your system with additional background work processes. You can then perform a manual operation mode switch using CCMS Control Panel (transaction RZ03) or use the time table in transaction SM63 to specify the current operation mode. In this case, there is no need to restart your system to make the changes effective.

  4. Optional: Find out if background work processes are reserved for class A jobs in your system.

    1. Start transaction RZ04.

    2. Choose Instances/operation modes.

    3. Examine the values in the BpA column.

  5. Use the Analysis Tool - Background Processing (Simple Tests) to perform tests on the background processing configuration in the system.

    1. Following a previous step, call the transaction SM65.

    2. Keep the default selection in the Basic tests section, but select All background servers to perform the tests on all application server instances where batch work processes are configured.

    3. Choose Execute.

    4. Examine the Analysis Log. It should state that all application servers are configured correctly for background processing.

Log in to track your progress & complete quizzes