Overview on Work Processes:
The SAP R/3 Dispatcher and it's Work Process constitute the R/3 Runtime System. From the perspective of the host operating system, the R/3 Runtime System appears as a collection of parallel processes.
On each application server, these parallel processes include a dispatcher and work processes, the exact number of work processes is variable and depends on the specific configuration.
There are seven types of work processes:
1. Dialog work process processes the online user input from SAPGUI and executes the business logic
2. Update work process updates the database. It has two types of components:
a) U1 components for executing time-critical database changes
b) U2 components for executing non-critical database changes
3. Enqueue work process for setting and releasing locks on SAP business objects.
4. Spool work process for spool formatting.
5. Background work process for executing background jobs.
6. Message work process coordinates requests across R/3 system services within a single R/3 system.
7. Gateway work process handles communication services between R/3 systems and external systems like R/2 and others.
In this wiki, I am going to explain how to process a job in background.
Background Work Process:
Background processing enables one to plan the start of ABAP/4 programs. Then, at the given time, they are started by special work processes called a Background (Batch) work processes.
Background processing runs are composed of jobs. Each job consists of one or more steps (i.e. programs) that are processed one after another.
In general, job processing is not triggered immediately; usually, a specific start time is defined when the job is planned.
Phases of Background Processing:
The three phases of background processing are:
1. Job Scheduling
2. Job Processing
3. Job Overview
Scheduling a Background Job:
To schedule/create a background job, the menu path System > Services > Jobs > Job Definition (or transaction SM36) is used. When creating a background job, a job name and a job class (priority level A, B, or C with A being the highest priority) must be specified.
A F4 help on Status field displays the popup as shown below.
Next, the steps (i.e. programs) to be included in the background job are to be entered:
To include an ABAP/4 program in a background job, the program name and, if necessary, its variant must be specified.
A variant is a set of parameter values needed for the execution of a particular program.
A background job can be scheduled to run immediately or at a specific Date/Time. Other options are available for scheduling jobs:
After Job- allows to start a job provided that another job has been completed.
After Event- allows to specify the event when you want your job to run.
At Operation Mode - allows to start a job when the system switches to a particular operation mode.
This option is identical to the 'After Event' option using the event name 'SAP_OPMODE_SWITCH' and the name of the operation mode as the event parameter).
Jobs can be scheduled to run at regular intervals, not just one time, by specifying a frequency.
Processing a Background Job:
The Batch Scheduler initiates the start of background jobs at the specified starting time. The dispatcher dispatches this request to the appropriate background (batch) work process.
To display the work processes for a particular application server, use the menu path Tools > Administration > Monitoring > System Monitoring > Process Overview (or transaction SM50).
Notice that the application server in the above example contains eight Update (UPD - Update), twelve Online (DIA - dialog), and two Background (BTC - batch) work processes. After a background job has been initiated, start and end modules are automatically generated. Each of these modules puts an entry into the job log. During the execution of each step in a background job, entries are made to the job log with any MESSAGE statement in the program or with any job-progress message from the system. Also, WRITE statements within a program will create a list which is put into the print spool.
Overview of a Background Job:
To get an overview of background jobs, use the menu path System -> Services -> Jobs -> Job Overview or GoTo -> Job Overview from the Job Definition screen (transaction SM37).
In the Job Overview, you can see the status of background jobs:
1. Scheduled - The job has been created, but it has not yet been assigned a starting time.
2. Released - The job has been created and it has been assigned a starting time.
3. Ready - The job is ready to be processed.
4. Active - The job is being processed.
5. Finished - The job has finished successfully.
6. Cancelled - The job did not finish successfully.
From this Job Overview, we can manage background jobs (i.e. release, change, delete, display, etc.). We can also display the job log for a particular background job and view its spool list.
The job log of a background job will indicate when the job started, when each of the job steps started, and when the job finished. Along with the system messages indicating the progress of the job, any program messages will be displayed in the job log.
So, the main points that i wanted to share with you all in this blog are,
The three phases of background processing are: Job Scheduling, Job Processing, and Job Overview.
In Job Scheduling, you indicate which programs make up the job. Also, you specify a starting time.
In Job Processing, the Batch Scheduler initiates the start of background jobs and the Dispatcher dispatches the request to the appropriate background work process.
In Job Overview, you can see the status of background jobs, manage jobs, and display the job log and spool list.
The content in this blog is written based on personal exeperience taking the R/3 hand book as reference.