Scheduling Background Jobs

Objectives

After completing this lesson, you will be able to:
  • Create a time-based job
  • Create an event and a job based on that event
  • Create a job that contains external commands or external programs
  • List options to extend the standard background system

Time-Based Scheduling

A job can be started in a time-based or event-based manner. As the figure above shows, a time-based start allows you to choose between the following options:

  • The job should be executed immediately.

  • The job should be executed at a particular date/time.

  • The job should be executed on a particular work day.

You can choose to make all time-based start conditions for jobs recurrent. This means that the job is executed again after a defined period of time has elapsed. You can specify exceptions (such as postponement to the following work day in the case of holidays in the factory calendar).

The job is started at the specified date and time, in accordance with the job priority and availability of background work processes.

You can also specify a time period during which the job should be executed. To do this, you specify a time after which the job should no longer be executed (No Start After). With this function, you prevent periodic jobs being executed at an undesirable time, among other things. For example, suppose your company has a reorganization job that should only be executed at night, and the job becomes delayed. With a start time window, you can avoid this job being executed during the day, when the dialog users are active and there are fewer system resources available.

If you use periodic job scheduling, it is not possible to define an end to the periodic execution – for example, a scheduling condition such as "every day to the end of this year" is currently not supported.

Load Balancing

As the figure below shows, the profile parameter rdisp/btctime specifies the time period in which the time-driven job scheduler is active. To avoid the time-driven job scheduler, you can execute jobs with the start condition immediate. For jobs with an immediate condition, the dialog work process of the scheduling user performs the job scheduling. However, if no free resources are found, the job is scheduled in a time-based way. The scheduled start time then corresponds to the date and time at which it should have started.

Background work processes can be configured on every application server of the SAP system using the profile parameter rdisp/wp_no_btc or, for example, when configuring operation modes.

The number of background work processes required in the SAP system depends on the number of tasks to be performed in the background. If the Transport Management System is used to perform imports of transport requests, there must be at least two background work processes in the system.

The combination of job ID and job name defines the job uniquely in the system.

On every SAP application server on which background work processes are defined, the time-driven job scheduler runs every rdisp/btctime seconds (default value: 60 seconds). This is an ABAP program (SAPMSSY2, an auto ABAP program) that runs automatically in a dialog work process. While the job scheduler is supposed to run every 60 seconds (by default), these runs usually do not take place exactly on the minute. Instead, they could run the 42nd second of the minute on one application server and the 9th second of the minute on another application server. You cannot influence this start time. It changes when the application server is restarted, at the latest, and depends on when certain system activities are performed for the first time after an instance restart – and then every 60 seconds from that point.

Hint

The job scheduler is also started every time a job ends, which can increase the throughput of background processing significantly (depending on how many jobs there are).

SAP Note 923228: Background job scheduler: Use of processes that have become free describes this changed behavior and its requirements.

The time-driven job scheduler checks the job scheduling table in the database for jobs that are waiting for processing. These jobs are transferred to free background work processes on the SAP application server, in accordance with their priority and execution target.

  • Jobs that are not assigned any particular execution target can be executed with any free background work process. This means that the workload is automatically distributed between the SAP instances.

  • If a job is explicitly assigned an execution target (such as a selected instance or a group of instances), the special properties of the execution target can be used. For example, you can ensure that a job is performed on a particular operating system, or that the job is executed by a background work process that is running on the same host as the database. This means, however, that you lose the advantages of automatic load balancing.

Note

For more information, see SAP Note 24092Distribution of background jobs on application server.

Create and Monitor a Job With Time-Based Scheduling

Business Example

As a system administrator, you are responsible for scheduling jobs and monitoring the system's background processing to ensure that it is running correctly. You want to schedule background jobs that run in the system when a certain start condition is reached.

Note

In this exercise, when an object name or value contains ##, replace ## by the number your instructor has assigned to you.

Task 1: Create a Time-Based Scheduled Job

You want to create a periodic background job by providing a name and a time-based start condition.

Steps

  1. In your SAP system, create a periodic, time-based job with the following properties:

    PropertyValue
    Job NameTIME-JOB-##
    Job ClassC
    Target Server<Leave empty>
    StepABAP Program: RSPFPAR with variant SAP&LOGIN
    Start Condition<System time + 3 minutes>
    PeriodDaily

    Hint

    Bear in mind that the system time (SystemStatus) is the relevant time for jobs.

    1. Log on to your SAP S/4HANA Server system using the credentials that your instructor has provided. Start transaction SM36.

    2. In the Job Name field, enter TIME-JOB-##.

    3. Choose Step (from the application toolbar).

    4. In the Create Step 1 dialog box, choose ABAP Program.

    5. In the Name field, enter RSPFPAR.

    6. In the Variant field, choose the F4 value help to select the SAP&LOGIN variant.

    7. Choose Save.

    8. On the Step List Overview screen, choose Back.

    9. Back on the Define Background Job screen, choose Start condition (from the application toolbar).

    10. In the Start Time dialog box, choose Date/Time.

    11. Enter the actual date and the time<system time + 3 minutes> as scheduled start.

      Note

      To get the actual system time, choose New GUI Window from the upper left menu of the dialog box and then SystemStatus...

    12. Select the Periodic Job checkbox.

    13. Choose Period Values, and select Daily as period.

    14. Choose Save to save the period value.

    15. Back in the Start Time dialog box, choose Save to save the start condition.

    16. Finally, on the Define Background Job screen, choose Save once to save the job definition.

      Result

      The job should now be saved with status Released.

Task 2: Monitor Your Job

You want to check if your time-dependent background job has been executed successfully.

Steps

  1. Display the job TIME-JOB-## that you have created in the previous task in the Job Overview.

    1. Following the previous task, start transaction SM37.

    2. Add job status Sched. to the selection.

    3. As To Date (in section Job Start Condition), choose the date for next Sunday.

    4. Keep the other selection criteria unchanged and choose Execute.

      Note

      A periodic job is always scheduled by its immediate predecessor during processing, so your periodic jobs will begin to display in the system after the previous periodic job has started. Therefore, in the Job Overview, only the (finished jobs and the) next periodic job is displayed.

  2. Find out details for the job you have created, such as the class, client, job ID, user who has scheduled and released the job, and the work process that has executed the job.

    1. Following the previous task, choose Refresh until the first run of your job has finished.

    2. Select the line for the finished job TIME-JOB-## by double-clicking on it.

    3. Choose Job details.

      Result

      A dialog window with the required information is displayed.
    4. Examine the displayed information.

  3. Examine the spool list for your job.

    1. Following the previous task, choose Continue and then Back to go back to the Job Overview screen.

    2. Select the line for the finished job TIME-JOB-##.

    3. Choose Spool (from the application toolbar) to switch to the spool request that has been generated.

    4. Select the line with the spool request and choose Display contents.

      Hint

      Spool lists are created only for job steps that contain ABAP programs with output. They are only printed immediately if you have made the corresponding setting in the printer settings in the definition of the job step or in your user defaults (transaction SU3).

  4. Determine with which delay your job has run.

    1. Following the previous task, go Back twice until you are on the Job Overview screen.

    2. Depending on the settings, you will already see the delay time (in seconds) in the Delay column.

      Hint

      Possible reasons for delays include, for example, occupied background work processes or the fact that the time-driven job scheduler ran periodically, but not at the exact planned start time of the job.

Task 3: Optional: Create and Monitor a Time-Based Scheduled Job With a Variant

To schedule periodic background jobs for programs that require an input, you first need to create a job variant. Then you play the role of an enduser and schedule a job with this variant from transaction SA38. Finally you act as an administrator again and monitor this job.

Steps

  1. Create a variant DISP_## in transaction SA38 for the RSPFPAR report, so that it only displays profile parameters for the ABAP dispatcher.

    1. If you have not already done, log on to your SAP S/4HANA Server system using the credentials that your instructor has provided. Start transaction SA38.

    2. In the Program field, enter RSPFPAR.

    3. Choose Execute.

    4. In the Profile Parameters field, enter rdisp/*.

    5. Choose Save as Variant ... from the application toolbar.

    6. On the following screen, in the Variant Name field, enter DISP_##.

    7. In the Description field, enter Parameters of the dispatcher.

    8. Leave the other fields unchanged and choose Save to save the new variant.

      Note

      You can also create variants in the ABAP editor (transaction SE38).

  2. In transaction SA38, run the RSPFPAR report in the background using the created variant.

    1. Start transaction SA38 from scratch again.

    2. In the Program field, enter RSPFPAR.

    3. In the application toolbar, choose Background.

    4. In the Variant Name field, use the F4 value help to select the DISP_## variant. Make sure that the Report Name is RSPFPAR.

    5. Choose Run Now to schedule the job with immediate execution.

      Result

      You should get the message that the report RSPFPAR has been started as background job.
  3. Display the job in the Job Overview and the check which parameters appear in the spool list that has been generated.

    1. Following the previous step, start transaction SM37.

    2. Leave the selection criteria unchanged and choose Execute.

    3. In the Job Overview, double-click on the Spool list button in the row of the RSPFPAR job to open the spool list.

    4. Select the line with the spool request and choose Display contents.

      Result

      The spool list displays only profile parameters that start with rdisp/.

Task 4: Optional: Create a Time-Based Scheduled Job with the Job Wizard and Check its Result

You want to be guided through the job scheduling process, so you use the Job Wizard to create a background job.

Steps

  1. Use the Job Wizard to schedule a background with the following properties:

    PropertyValue
    Job NameTIME-WIZ-##
    Job ClassC
    TargetLeave empty
    Screen Job definition: Job stepABAP program step
    Screen ABAP program stepABAP Program Name: RSPFPAR with VariantDISP_## and Execution LanguageEN
    Add additional steps (optional)<do not select>
    Step Spool List Recipient< do not select anything>
    Start conditionsImmediately
    Periodic jobsSelect Period
    Period definitionHourly
    1. If you have not already done, log on to your SAP S/4HANA Server system using the credentials that your instructor has provided. Start transaction SM36WIZ.

      Hint

      Alternatively, you can start transaction SM36 and choose the Job wizard button in the application toolbar.

    2. Choose Continue.

    3. Fill the screens as specified in the task description. Use the value help wherever possible. Where no values are specified, use the default values. Choose Continue to get to the next screen.

    4. Finally choose Complete to finish.

  2. Display the job in the Job Overview.

    1. Following the previous step, start transaction SM37.

    2. Leave the selection criteria unchanged and choose Execute.

    3. In the Job Overview, check the result of the TIME-WIZ-## job.

Event-Based Scheduling

An event is a signal to the background processing system that a particular status has been achieved in the SAP system. The background processing system receives events and then starts all jobs that are linked to this event.

As listed in the figure above, event-based jobs can be scheduled with one of the following three start conditions:

After event

The job starts after a defined event is received by the SAP system.

At operation mode

With this option, you can link a job to the activation of an operation mode when scheduling the job.

After job

With this option, you can create simple job chains where the execution of the successor job can be made dependent on the status of the predecessor job.

Hint

The profile parameter rdisp/btcname is no longer evaluated and is therefore no longer relevant. For more information, see SAP Note 1035355: Background processing events: Handling of target server.

Events

You can trigger events with the function Background Events: Overview and Administration (transaction SM64). There is a distinction between system events and user events. System events are events predefined by SAP that you cannot modify and, if possible, you should not trigger manually.

As the figure above shows, events can be triggered in several ways:

  • Manually, using transaction SM64.

  • By the ABAP program BTC_EVENT_RAISE (see SAP Note 919458Program 'BTC_EVENT_RAISE') or by calling the function module BP_EVENT_RAISE.

  • At the operating system level, through program sapevt.

  • Using HTTP(S) by calling the ICF service /default_host/sap/bc/batch/event_raise.

Note

There are even different options (not included in the list above), such as to use the RAISE method of class CL_BATCH_EVENT.

When an event is triggered, a parameter can also be provided. In this way, you can define jobs that wait for the occurrence of the event together with the specified parameter.

You can display a history of events in the Event History (transaction SM62).

Note

For error analysis, SAP Note 1645120: Trigger of a background event is unknown may help.

sapevt is a program located in kernel directory which is used to trigger an event from a program running outside the SAP system. The syntax for the sapevt program is shown in the figure above.

  • Example: sapevt myevent name=S4D pf=/usr/sap/S4D/SYS/profile/S4D_D11_s4dhost.

sapevt writes its output in a trace file dev_evt in the directory from where sapevt was called.

Note

SAP Note 802172: sapevt (Version 4): Release-independent version describes the individual parameters in detail. In addition, SAP Note 826779sapevt (Version 5): Security settings in the Msg. might be helpful if the sapevt program must use a different port to communicate with the message server due to increased security requirements.

To be able to react to external events, the SAP system must be active. Otherwise an event triggered by an external program is lost.

Hint

If the name of the event contains a blank character, you must specify the event in quotation marks when you call sapevt.

  • For example: sapevt "my event" name=S4D pf=/usr/sap/S4D/SYS/profile/S4D_D11_s4dhost.

Note

If you want to call sapevt from a remote host, refer to SAP Note 374379: Triggering SAPEVT from a remote host.

The figure Examples of sapevt Calls shows further details.

Due to unavoidable changes as of Kernel 7.40 in the internal SAP message format, there is a break in sapevt in kernel release 7.40 when used on a cross-release basis. In addition, since sapevt communicates unauthorizedly with the message server, the program may no longer function in general if secure message server communication is active.

When sapevt is called on the application server with the user <sid>adm the parameter pf=<instance profile> must be provided. This behavior depends on the type of the operating system and the release and patch level of the kernel of the SAP system. Newer SAP systems on Windows require this input, on Linux it might be that an error message will be returned, but the event might have been raised successfully.

So if in doubt, provide pf=<instance profile>.

SAP provides two more options to trigger a batch event externally.

  • ICF service /default_host/sap/bc/batch/event_raise (see the figure below and SAP Note 2001336Downport: ICF service for triggering batch event and its attached PDF) .

  • RFC client sapevt_rfc on operating system level which calls function module BP_REMOTE_EVENT_RAISE (see SAP Notes 2015788Program "sapevt_rfc" and 2014139Function BP_REMOTE_EVENT_RAISE).

Regarding the ICF service /default_host/sap/bc/batch/event_raise, you have several options:

  • A user and password is stored in the section Logon Data of the ICF service. Then it is sufficient to pass to the http client a parameter string like the following to trigger the event SAP_TEST: http://<host name>:<ICM-Port>/sap/bc/batch/event_raise?sap-client=<client>&eventid=SAP_TEST. This call is basically equivalent to a call of the old program sapevt, because it does not require authentication.

  • Specify the logon data in the parameter string (at least for testing) . This would result in http://<host name>:<ICM-Por>t/sap/bc/batch/event_raise?sap-client=<client>&sap-user=<user name>&sap-password=<password>&eventid=SAP_TEST.

  • It is also possible to logon with X.509 certificates.

Additional Information

The following SAP Notes might be helpful:

  • SAP Note 802172: sapevt (Version 4): Release-independent version

  • SAP Note 1021079 : Event history

  • SAP Note 1645120: Trigger of a background event is unknown

  • SAP Note 2000417: Problems with SAPEVT as of kernel release 7.40

  • SAP Note 2001336: Downport: ICF service for triggering batch event

  • SAP Note 2015788: Program "sapevt_rfc"

Create and Monitor an Event-Based Job

Business Example

As a system administrator, you are responsible for scheduling jobs and monitoring the system's background processing to ensure that it is running correctly. You want to schedule background jobs that are triggered by certain events.

Note

In this exercise, when an object name or value contains ##, replace ## by the number your trainer assigned to you.

Task 1: Prerequisite: Create a Customer Event

To trigger a job that runs in the SAP system when an event is executed, you need to create a customer event first.

Steps

  1. In your SAP system, create a customer event EVENT_##.

    1. Log on to In your SAP S/4HANA Server system using the credentials that your instructor provides. Start transaction SM64.

    2. On tab BckProcEvnts , choose Create....

    3. In the Event field of the Event Definition dialog box, enter EVENT_##.

    4. In the Description field, provide a meaningful descriptive text.

    5. Do NOT select the System checkbox.

    6. Save the event definition.

    7. In the dialog box Transport Event choose No.

Task 2: Schedule and Monitor an Event-Based Job

You want to create a periodic background job by providing a name and an event-based start condition.

Steps

  1. Copy the time-based background job TIME-JOB-## from the previous exercise and name it EVENT-JOB-##.

    Note

    If your system does not have a job TIME-JOB-##, you can copy another job or create a new one in transactionSM36 first.

    1. Following the previous exercise, start transaction SM37.

    2. Leave the selection criteria unchanged and choose Execute.

    3. In the Job Overview, select the line with job TIME-JOB-##.

    4. From the menu, choose JobCopy.

    5. In the New job name field, enter EVENT-JOB-##.

    6. Choose Copy to confirm your entry.

  2. Schedule the job EVENT-JOB-## periodically for the event EVENT_##.

    1. Following the previous step, choose Back to go to the start screen of transaction SM37 again.

    2. Add job status Sched. to the selection.

    3. Leave the other selection criteria unchanged and choose Execute.

    4. On the resulting Job Overview screen, select line with the job EVENT-JOB-##.

    5. Choose Release (from the application toolbar).

    6. In the Start Time dialog box, choose After Event.

    7. In the Event field, choose EVENT_## using the F4 value help.

    8. Leave the Parameter field blank.

    9. Select the Periodic Job checkbox.

    10. Choose Save to save the start condition and to release the job.

    11. Refresh the Job Overview to display the job.

      Hint

      If the EVENT-JOB-## job does not appear in the Job Overview after you have released it, change the selection criteria on the initial screen of transaction SM37. Here, in the Job Start Condition area, select the entry EVENT_## or * for field Or after event as well and keep the other settings unchanged. Then choose Execute.

Task 3: Trigger the Customer Event

To trigger a job that runs in the SAP system when an event is executed, you need to execute a customer event that exists in the system.

Steps

  1. Trigger customer event EVENT_## in a new session and check if the job has run successfully in the Job Overview.

    1. Following the previous exercise, start transaction SM64 in a new GUI window.

    2. On tab BckProcEvnts, select the line with your event EVENT_##.

    3. Choose Trigger....

    4. On the following dialog box Trigger an Event, leave the Parameter field blank and choose Trigger again.

    5. Switch to the GUI window with the Job Overview (transaction SM37).

    6. Choose Refresh to update the job overview

      Result

      The job EVENT-JOB-## should now have run successfully and should also have been rescheduled because it has been scheduled (event-)periodically.
  2. Optional: Trigger the event EVENT_## with sapevt at the operating system level of the host where your SAP system is running on. For this you have to be logged on with user <sid>adm at operating system level. Check if the job has run successfully in the Job Overview.

    Hint

    If the name of the event you defined contains a blank character, you must specify the event in quotation marks when you call sapevt.

    1. If you have not already done so, log on to the operating system level of the host where your SAP system is running on using with the credentials of user <sid>adm. For example, use the Remote Desktop Connection.

    2. Open a Terminal session (for example, by choosing ApplicationsUtilitiesTerminal).

    3. Execute the following command:

      sapevt EVENT_## name=<SID> pf=/usr/sap/<SID>/SYS/profile/<SID>_<instance>_<server name>

      (<SID> stands for your system ID (for example, "S4D"), <instance> stands for the instance name and number to execute the external command (for example, "D11") and <server name> for the host name of the application server you are logged onto (for example, "s4dhost").

    4. Optional: Open the trace file dev_evt that was created in the current directory (for example, by entering the command more dev_evt).

    5. In your SAP system, choose Refresh to update the Job Overview list in transaction SM37.

      Result

      The job EVENT-JOB-## should have run successfully again and should have been rescheduled again because it has been scheduled (event-)periodically.

External Commands and External Programs

The background processing system differentiates between external commands, which are intended for "normal" users, and external programs, which should primarily be used only by system administrators. This differentiation gives administrators the ability to run any required external program, while normal users are restricted to external commands for which there are name-specific authorization checks. In both cases, the program sapxpg is called at operating system level, which in turn starts the relevant program at operating system level, as shown in the figure below.

External commands are host system commands or programs predefined in the SAP system by an administrator. They are protected by authorizations so that end users can only schedule the external commands for which the system administrator has explicitly granted them authorization. You can, therefore, provide functions outside the SAP system, at operating system level, for users of the SAP system. The successful execution of external commands requires authorization for authorization object S_LOG_COM: Authorization to execute external operating system commands. This authorization object consists of three fields: COMMAND, OPSYSTEM, and HOST.

External programs are unrestricted commands that are neither predefined nor restricted by specific authorizations. A user with administration authorization can enter any external program in a job step. No further SAP authorization check is performed before the execution of the command. External programs provide an administrator (user with administration authorization for external commands (authorization object S_RZL_ADM: Background Processing: Background Administrator)) the flexibility to run any required host system command in the SAP system without administrative preparation.

The figure above illustrates the steps required in creating external commands:

  1. Call transaction SM69 (ToolsCCMSConfigurationDisplay/Change External Commands).

  2. Choose Create.

  3. Enter the information for the new command, using the following rules:

    • External commands are uniquely identified with a command name (beginning with Y or Z) and an operating system type. The Type field is filled automatically.

    • Specify an executable operating system command (if required: with the complete path) and specify any additional required or optional parameters.

    • Select the Additional Parameters Allowed checkbox if users are allowed to specify argument parameters when they execute the external command later or schedule it in a job. The additional parameters are added to parameter strings that may already be specified under Parameters for Operating System Command.

    • The Trace field is usually left blank. To follow the execution of an external command, use the trace parameter for the function module SXPG_COMMAND_EXECUTE.

    • If you have defined an additional authorization check, enter the name of the function module that performs it in the Check module field. This is usually a customer copy of the function module SXPG_DUMMY_COMMAND_CHECK. The system calls the function module automatically when a user tries to execute the external command or schedule it in a job.

  4. Choose Save. To return to the command overview, choose Back.

Additional Information

The following SAP Notes might be helpful:

  • SAP Note 677435: Overview: external programs and external commands
  • SAP Note 686765: Security check when you execute external commands
  • SAP Note 854060: Authorizations for external commands
  • SAP Note 859104: Authorizations for external programs

Control Flags

As the figure below illustrates, you can use control flags to make specifications about the task and other runtime options. You do not normally need to change the default values.

You can, for example, specify the following:

  • Whether the process is to be logged. The output data is written to the log as it is output by the external program. The language here can differ from your logon language. You can also call additional information about the data of an external program in the job log.

  • Whether the SAP control program should wait for the end of the external program on the target computer (use this option for example if you want to receive the return value from the external program).

  • Whether you want to switch on the mote detailed level of the trace.

Hint

You can display additional information about the meaning of the control flags using the F1 help on the Set Control Flags for External Programs screen.

Create Jobs with External Command and External Programs

Business Example

As a system administrator, you are responsible for scheduling jobs and monitoring the system's background processing to ensure that it is running correctly. You want to schedule background jobs that execute external commands and programs at operating system level.

Note

In this exercise, when an object name or value contains ##, replace ## by the number your trainer assigned to you.

Task 1: Create an External Command

You want to create an external command in the SAP system to restrict the execution of commands at the operation system level for end users.

Steps

  1. On your SAP S/4HANA Server system, create an external operating system command Z_OSUSER_## in transaction SM69 that executes the whoami command.

    1. Log on to your SAP S/4HANA Server system using the credentials that your instructor provides.Start transaction SM69.

    2. Choose Create.

    3. In the Command Name field, enter Z_OSUSER_##.

    4. In the Operating System Command field, enter whoami.

    5. Leave the remaining default values unchanged and choose Save.

      Note

      In contrast to external programs, for external commands you can assign "name-specific" scheduling authorizations to end users in field Check Module.

    6. Optional: You can test your external command directly. For this choose Execute. Then choose Execute again.

Task 2: Schedule and Monitor a Job with External Command as Job Step

You want to schedule a background job that includes an external command as a job step.

Steps

  1. In your SAP system, create a background job with the following properties:

    Job NameEXT-CMD-##
    Job ClassC (default)
    TargetNo entry (default)
    StepExternal command: Z_OSUSER_##
    Start ConditionImmediate
    Periodnone
    1. Following the previous task, in your SAP system, start transaction SM36.

    2. In the Job Name field, enter EXT-CMD-##.

    3. Choose Step.

    4. On the Create Step 1 dialog box, choose External command.

      Result

      Section External Command (command predefined by system administrator) is highlighted.
    5. In the Name field, use the F4 value help to select Z_OSUSER_## command.

    6. In the OS field, use the F4 value help to select Linux as operating system.

      Note

      In addition, feel free to analyze the Control flags. Keep the default values and choose Cancel to go back to the previous screen.

    7. Back on the Create Step 1 dialog box, choose Save.

    8. On the Step List Overview screen, choose Back.

    9. On the Define Job screen, choose Start condition.

    10. In the Start Time dialog box, choose Immediate.

    11. Choose Save to save the start condition.

    12. Back on the Define Background Job screen, choose Save once.

      Result

      The job should now be saved with status Released.
    13. Choose Own jobs (in the application toolbar) to see whether the execution of your job EXT-CMD-## was successful.

    14. Select the line of your job and display the output of the job in the Job log.

Task 3: Schedule and Monitor a Job with External Program as Job Step

You want to schedule a background job that includes an external program as a job step.

Steps

  1. In your SAP system, create a background job with the following properties:

    Job NameEXT-PROG-##
    Job ClassC (default)
    TargetNo entry (default)
    StepExternal program: whoami
    Start ConditionImmediate
    Periodnone
    1. Following the previous task, in your SAP system, start transaction SM36 again.

    2. In the Job Name field, enter EXT-PROG-##.

    3. Choose Step.

    4. On the Create Step 1 dialog box, choose External program.

    5. In the Name field, enter whoami.

      Note

      Feel free to analyze the Control flags. Keep the default values and choose Cancel to come back to the Create Step 1 dialog box.

    6. On the Create Step 1 dialog box, choose Save.

    7. On the Step List Overview screen, choose Back.

    8. On the Define Background Job screen, choose Start condition.

    9. In the Start Time dialog box, choose Immediate.

    10. Choose Save to save the start condition.

    11. Back on the Define Background Job screen, choose Save once.

      Result

      The job should now be saved with status Released.
  2. In the Job Overview, check the success of the scheduling and the output in the job log.

    1. Following the previous step, on screen Define Background job choose Own jobs.

    2. Select the line for job EXT-PROG-## by double-clicking on it.

    3. Choose Job log to display the output of the job.

Options for Extending the Standard in Background Processing

The job scheduling options described in the previous sections of this lesson do not cover all possible requirements. The following options – aside from using SAP Business Process Automation by Redwood (SAP BPA) – are available for realizing more complex scenarios:

The SAP system has various internal function modules that support you when defining your own job processes. These function modules are in the function groups BTCH and BTC2. You can define any complex scenarios with the help of these function modules.

SAP provides a set of interfaces that enable other system management environments to be connected to the SAP Computing Center Management System (CCMS).

  • The eXternal Monitoring Interface API (XMI-API) interface logs the activities of external users and programs.

  • The eXternal interface for Background Processing (XBP-API) interface allows the use of external job scheduling programs.

With these tools, you can schedule background jobs beyond the boundaries of the SAP system and include non-SAP systems, as shown in the figure below.

In addition to conventional, local SAP background processing (transactions SM36 and SM37), you can use a job scheduler for landscape-wide background processing.

For information about SAP Business Process Automation by Redwood (SAP BPA; formerly known as SAP Central Process Scheduling by Redwood – SAP CPS), see SAP Note 2005087SAP BPA V9.

SAP Solution Manager also provides some central functions for job scheduling in the Job Management work center. SAP Cloud ALM also offers central functions in the Job & Automation Monitoring tile as part of SAP Cloud ALM for Operations.

Log in to track your progress & complete quizzes