Dialog work processes are intended for dialog processing. For this reason, the duration of a dialog step is limited. Background processing is intended for operations that require a longer time to run. Background processing is also suitable for activities that are scheduled to run regularly, for example database backups or financial evaluations.
A background job consists of one or more steps. A step can be: An ABAP program An external command An external program Each job is processed without interruption by a single background work process. A job can be triggered to run: At a predefined date and time At the occurrence of a predefined event Background jobs can be prioritized as: Class A (high priority) Class B (medium priority) Class C (low priority) Jobs allocated to target servers have higher priority than untargeted jobs.
To define a new job, use transaction SM36 . From Release 4.6A, you can use the Job Wizard to define new jobs as follows: Specify job name, class, and optional target server Define a job step (a step can be an ABAP program, external command, or external program) Add further steps (if necessary) Start condition (time or event based) Complete the definition The Job Wizard allows you to go back and make changes at any point during the definition process.
The start conditions of a job can be time based or event based. Time based : Immediate At date/time On a chosen workday (defined as a certain workday per month) All time-based start conditions can be periodic. That is, a job can be performed at regular, defined time intervals. Days that are not workdays can be treated as exceptions. Parameter rdisp/btctime specifies the time interval of the job scheduler. Event based : After event (optional parameters can be used to further specify events) These can be periodic. That is, the job can be triggered every time the event occurs. After job (this can depend on the status of the previous job) At change of operation mode (for example, between day and night) Parameter rdisp/btcname specifies which application server handles events triggered from within R/3.
A job step can be any one of the following. ABAP program Any ABAP program that generates a list can be used as a job step. If the program includes a selection screen, you must create a variant before you can let it run in the background. A variant is the result of assigning definite values in the fields that appear in the ABAP program selection screen. The list is stored in the R/3 spool system. When you define the step, you can set the print parametsrs (for example, output device) and a spool list recipient (this is a SAPoffice addressee). External command An external command is any non-R/3 program, script, or command that is executed at operating system level. Since these commands are defined in R/3 by the system administrator, the administrator use R/3 authorizations to limit the scope of the commands and their availability to R/3 users. External program An external program is also any non-R/3 program, script, or command that is executed at operating system level. The system administrator has not previously defined these programs in R/3 and no check is made for critical or dangerous programs. In the latter 2 cases, the programs are called up at the operating system level by program sapxpg . The programs are processed synchronously (job waits for termination of the external program) or asynchronously (next job step is processed immediately). The output (stdout and/or stderr) of the external program can be taken up in the job log.
The job status can be any of the following: Scheduled : job is created but has no start condition Released : job is completely defined and waiting for selection Ready : job has been selected for execution Active : job is being executed by a background work process Finished : the entire job has been successfully executed Canceled : job terminated with problems As long as a job has status scheduled or released , it can still be changed. If execution of a job has already started, its progress can be monitored in the job log. If the job contains ABAP programs, their output is stored in spool lists. To create the steps of a new job from an existing job, choose Copy .
Typically, customers require more dialog processes during the day and more background processes during the night. To adjust the proportions of the various R/3 work processes to suit different phases of system activity, you can: Maintain the instance profile and restart the system (for unusual changes) Define operation modes and use the operation mode switch (for daily changes) Operation modes optimize system resources for different phases of system activity. Operation mode switching reconfigures your R/3 System dynamically, so you do not need to change the instance profiles for your server and you experience no system downtime. An operation mode configures the use of resources for all the instances in your R/3 System based on: The services or work processes you need The time interval you choose
To monitor jobs, call transaction SM37 . From Release 4.6A, the initial screen offers an extensive range of selection criteria. For example, you can select jobs by specifying one of their steps. To list event-based jobs, you must specify an event. This job list presents the user selection at the top of the screen. The ABAP List Viewer (ALV) is used to display the list and enables you to store multiple display variants. From the job overview, you can navigate to various detailed job-related views: The job log enables you to monitor the progress of a job. The spool list contains the output of ABAP programs, if any. Job details include the job definition, execution time, and background work process number.
Why Background Processing? Reasons for Background Processing Dispatcher Reducing load on dialog workprocesses D B Scheduling regular activities vsMon Tue Wed Thu Fri Sat SunMon Tue Wed Thu Fri Sat Sun
What is a Background Job? Job 1 A job consists of one or more steps A job step is one of the following: Job 2 ABAP program (maybe with Job 3 variants) Step 1 external command external program One job is processed by one background Step n workprocessA job can be triggered There are 6 priorities: high 12 Class A job with target server Class A job without target server 11 1 10 2 9 3 by time Priority Class B job with target server 8 4 7 6 5 Class B job without target server Class C job with target server Class C job without target server by event low
Task flow Defining a Job Using the Job Wizard Transaction SM36 General job Define Define Job Wizard information a step start conditions The Job Wizard is an easy way to create a job. Start condition of a job could be one of th Congratulations! 1.) immediately - meaning as soon as pos Step-by-step dialog screens guide you 2.) based on exact date time assignment through the process. You have successfully defined a job. Choose Done to 3.) after another job actually create the job in the system. 4.) after an event You can use the navigation buttons go back to previous steps. 5.) when a certain operation mode switch You can also choose Back to revise the job definition or Cancel to cancel the whole process. On the last screen, you will see what Immediately you have defined before you save Date/time ------------------------------------------------------------------ After job After event At operation mode switch Here is the job you have defined: Start on workday Job not released Job view Job name : GULP Job class : C - LOW PRIORITY Target server : Back Complete Cancel
Start Conditions of a Job 12 11 1 10 2Time based 9 3 Event based 8 4 7 6 5Immediate After event once or periodically once or periodically if periodic, exceptions with or without parameter possible After jobAt Date/Time status dependent 1 Job Job 2 once or periodically if periodic, exceptions At change of possible operation mode Day NightOn chosen workday (per month) once or periodically rdisp/btctime rdisp/btcname
Executing Programs as Job StepsR/3 System ABAP Program External Command External Program No selection screen With selection screen predefined within R/3 Any command on + • Operating system • Command Operating System level Variant • Parameters sapxpg sapxpgOperating System External Program External Program
Status of a Job Scheduled Change job Released Ready Active Monitor Job log Finished CanceledUse Copy Spool listto create a new job (only for ABAPs)