The SAP system includes functions that allow users to work noninteractively, or offline. These functions are handled by the background processing system. Users normally work interactively with the SAP system. Interactively means they are working online, they input data into the application screens, and the system responds. The interactive service is provided to the users through the dialog work processes.
There is, however, the option of working noninteractively, or offline. Noninteractively means that instead of executing programs and waiting for an answer, users can submit those programs for execution at a more convenient, planned time. This type of work is performed by the background work processes.
Introduction to Background Processing
The execution of programs in the background are submitted in the form of background jobs, or simply jobs.There are several reasons to submit programs for background execution: The interactive user sessions are always fighting to get a free dialog work process for their requests. The maximum allowed time for online execution is defined in a SAP parameter profile (rdisp/max_wprun_time), which normally should not exceed 300 seconds. This means that for ABAP programs whose processing time would exceed that parameter, users would get a TIMEOUT error and an aborted transaction. To avoid these types of errors, you could submit jobs for background processing.
You can continue to work in the system while your program is executing—this is the most important reason to run background processing jobs. When working online with a long processing report, you cannot interact with the system and have to wait until it finishes or the dispatcher throws you out if you exceed the time limit.
This does not mean that interactive or online work is not useful. Both types of processing have their purposes. Online work is the most common one: entering business data, displaying information, printing small reports, managing the system, and so on. Working interactively or online requires the person to be present to interact with the system. However, with background jobs, the system does not need user input or users have already provided the input in the job definition.
Background jobs are used mainly for the following tasks:
For example, if interactively running a report that takes two or three minutes to finish, the SAP session in which the report is executing will be busy until the report execution ends. During that time, the user cannot interact with the session. Instead, the user could have scheduled it for background processing, creating a background job and specifying the name of the report. When releasing the job, the system will execute it in the background but will give the user the control of the SAP session so he or she can keep on working and interacting with the system.
Jobs executing in the background are working online with the SAP system, so any actions performed by the program steps, such as locking a table or updating the database, will have an immediate effect just as if an interactive user was running the same program. Background jobs execution is handled with the background work processes. The way to implement the background work processes depends on the particular needs of the SAP installation.In any case, when installing a SAP system for the first time, the system configures by default the background processing system in the central SAP instance with a number of background work processes depending on the hardware configuration.
The number and location of background work processes is configurable both with SAP system profile parameters and with the use of the CCMS operation modes. With operation modes, system managers can define some work processes to work as dialog during certain hours and then switch automatically to background processes without the need to restart the application server instances.
A SAP background job defines the program or group of programs that are going to be executed by the background work processes, In order to do this, the job must be defined. SAP includes several utilities to define, manage, monitor, and troubleshoot the background jobs. Figure shows the initial screen for job definition. You can get to this screen from many different places: by entering transaction code SM36 in the command field, by selecting from the initial SAP screen Tools | CCMS | Jobs | Definition, or by selecting System | Services | Jobs | Define jobs from any SAP screen.
Initial screen for defining jobs
Components of the Background Jobs
A background job has the following components:
Refer to the next section about job status.
All these components of background jobs are explained in greater detail in the following sections of this chapter.
Starting Background Processing
Starting background processing means reaching any type of job definition screen in order to specify the needed data for the background execution of programs. There are several ways to start the background processing system:
The last three methods mentioned are virtually the same thing, though the system can display different selection screens. With these three methods of starting background processing, after indicating Background Execution, the SAP system displays the Execute Report in Background screen.
The job will have automatically included the report as the first job step, whereas the user has to enter additional job definition fields, such as the job class, target host, start time, and so on.
Defining Background Jobs
Starting background jobs is a two-step process: you first define the job and then you have to release it. When users define a job and save it, they are actually scheduling the report, that is, specifying the job components, the steps, the start time, and the print parameters. So to schedule a job is the same thing as to define it. More precisely, a scheduled job is a job definition that has been saved. When users schedule programs for background processing, they are instructing the system to execute an ABAP report or an external program in the background.
Scheduled background jobs, however, are not actually executed until they are released. When jobs are released, they are sent for execution to the background processing system at the specified start time. Jobs are released automatically if the user is authorized to release jobs, and they automatically start the execution in the background system if the user has chosen the Start Immediately option. Both the scheduling and the releasing of jobs require authorizations. Standard SAP users have authorization that allows them to schedule jobs; however, releasing jobs is a task normally assigned to the system administration and requires another authorization.
Protecting the releasing of jobs with authorization enables system administrators to better monitor and maintain the background system and allows the available resources to be better distributed. The drawback is that scheduling jobs is such a common task that it can surpass the administrator's ability to maintain the whole system. Therefore, reserve some time for studying which users should be allowed to release their own jobs. When users do not have release authorization, the start time or frequency they specify does not have any affect at all, except for informing the administrator in charge of releasing them of their preference for executing the job. Administrators or users with authorization for releasing jobs can change the start time specifications and the interval. The authorization objects that control the background jobs are described later in this chapter.
When scheduling jobs, users can specify several steps, each having a different report or program. Each step has its own attributes, such as authorized users or print parameters. The same job can contain steps with ABAP reports and steps with external programs or commands (this is explained more fully in a later section). When defining jobs, users also have the option of scheduling a program as a separate job or modifying an existing job which has not yet been processed and adding it to the list of job steps.
Users, and especially administrators, should avoid having too many released jobs during normal, operative working hours, because the system processes the background jobs during online operation where there are available background work processes. Remember that a background job will perform the same tasks as if the functions were performed online. So, if a background job does lock a table or updates the database, it will have an immediate result and can affect the work of online users.
Job Definition Fields
As introduced earlier, to schedule or define a background job, there are some input fields that must be filled. From the initial job definition screen as shown in Figure, you can see in greater detail which are the job definition fields and what their intended functions are.
Job Name The job name identifies the job. You can specify up to 32 characters for the name, including letters, numbers, and space characters. Try to give a name which will easily identify the function of the job; also, you could use the same starting letters of words for related types of jobs, since the name will often be used to display lists of jobs.
Job Class The job class determines the priority of a job. The background system admits three types of job classes or priorities: A, B, and C, which correspond to job priority. Class A is the highest priority class; class B is the next priority class; and normal jobs have the C class, which is the lowest and default priority for most jobs. To schedule jobs with higher priority, users must have special authorizations or request the administrator to change the priority of the job.
Job classes are very useful when you need to reserve some of the background work processes for scheduling important or more critical jobs. You can reserve background work processes for class A jobs. This can ensure that class A jobs will always have free processes so that they can be executed (in case there are no more class A jobs waiting for work processes reserved for class A). Class A jobs can be processed as well by normal background processes, and they have priority over regular class C or class B jobs.
With this method, administrators can decide how they want to use background processes of type A:
The advantage of having work processes reserved for class A jobs is that even when there are many released jobs of class C waiting to be processed because all work processes are busy with other jobs, these normal-priority jobs will not use the reserved work processes intended for jobs with the class A. Therefore, even in high-load background situations, administrators can release important jobs by assigning a higher priority job class. To reserve background work processes for class A jobs, you have to configure the instance operation modes with the CCMS utilities.
Exec. Target This field is used to specify the server instance where the background job is to run. You can select the instance by clicking on the possible entries list arrow and choosing one of the hosts from the list. However, this field is normally left blank, which instructs the system to execute the job in the system with the lightest work. Because of the possibilities for distributing the SAP systems services, not all servers might offer background services (run background work processes), and it's also possible to configure one or several servers just for background processing.
The target field is used mainly when, for any reason, a job must be processed on a particular server. Some of the reasons to do that might be: a job will read operating system files only accessible from a particular server, the printer defined for the job output is only defined in that server, and so forth. For example, you should be particularly careful when performing change request imports in a system with several servers. In order for the background job RDDIMPDP not to fail the first time, all SAP servers where background jobs might run should have access to the common /usr/sap/trans directory; otherwise, you should specify a target host for the importing jobs.
Commonly, jobs do not require a target instance for being executed, because the CCMS system with the help of the message server is responsible for distributing the load among the available background servers. Note Do not confuse this target host, instance, which specifies a host running background work processes, with the target host as specified when defining external programs as job steps. It can be the same, but not necessarily.
Once the general job definition fields are entered, you have to click on the Steps function button to define the programs that will be executed as part of the job.
Screen for creating a job step
There are three types of steps that can be defined depending on the nature of the program to be executed. You can notice these types by looking at the buttons on the program values box shown in Figure. These types are as follows:
Scheduling ABAP Programs as Job Steps
When scheduling ABAP reports as job steps, there are several type parameters which can be specified. The most important one is usually the selection criteria for the execution of the report as it would be normally specified when launching the report online. A group of selection criteria is saved in variants. Refer to Chapter for a description of report variants. When an ABAP program is specified as part of a background job, if it needs selection criteria, the variant must have been previously created; otherwise you will not be able to save the ABAP step.
To define an ABAP program as a job step, from the initial job definition screen, press the Define Steps button on the application toolbar, and then click on the ABAP Program button on the Create Step screen. Then proceed as follows:
Scheduling External Commands
Both external commands and external programs are executed by means of the sapxpg program. This program is called either by a remote shell (rsh, remsh, and others) or by the SAP gateway (the usual way under Microsoft Windows platforms). External commands to be scheduled must have been previously defined by the system administrator (transaction code SM69 or Tools | CCMS | Configuration | External Commands). To define these commands as job steps, first click on the External Command pushbutton on the Create Step dialog box.
On the Name input field, click on the possible entries arrow to select one of the available external commands. Only the commands available for the target operating system can be successfully executed. The Parameters input field is used for specifying additional flags or parameters for the command. Select Operating System from the available options, and the Target Server where the command will be executed. Finally, verify the definition by clicking on the Check icon. If no errors are found, proceed by saving the step definition.
Scheduling External Programs
You can schedule external programs as job steps. These external programs can be of any type as long as they can be reached from the SAP server and the host where the program resides can execute the program itself. It can be any compiled or executable program, shell script, and so forth. The step definition for external programs allows you to include any parameters the program needs in a complete transparent way. The error messages generated by external programs are included in the log file for the background job.
To enter an external program as part of a job, when on the Create Step screen, click on the external program. The system will change the colors for the relevant input fields while graying out the field for the ABAP programs.
Notice how the command buttons in the lower part of the screen change as well, depending on the type of program. Enter the following information for the external program:
The Control Flag display for external programs
With the Control Flag options, you can activate a trace for the external programs, and also direct the output and error information to the job log. But the most interesting option within the Control Flags is the Job to wait for ext. termination. By selecting the Check button option, the SAP system will start the external programs as service programs in the host where they are started, which means that they will remain active in the system. When starting these types of service program which do not terminate, these programs return control to the SAP background system which terminates the job as soon as it has been started.
Defining the Start Conditions for the Job
For background jobs to execute, you have to specify their start time. SAP systems provide many options that virtually cover most needs both for defining start-time criteria and for defining a repeat interval. In any case, jobs are not executed until they are released, independently of the start time defined. Start time can be defined before or after the definition of the job steps. However, if no start time is specified, the job will be saved but will never be executed unless the system or job administrator modifies a job and defines a start time and then releases it. To define a start time, click on the Start Condition button on the initial job definition screen. Figure shows the resulting display. The system provides the following start options:
Job start options
For those jobs which need to be periodically executed, SAP also provides the facility to specify a repeat interval, which can be assigned to every start option. The following sections cover available start options one by one.
Immediate For immediate start jobs, the background processing system sends the jobs for execution as soon as they are released. The immediate start jobs are released by clicking on the Save icon. When users define immediate as the start option, the background scheduler processes the job immediately if there are available background work processes. If there are no background work processes available, the job will wait in Released status until one of the background work processes becomes free. This also applies if the job class is B or C (normal priority) and the free work processes are reserved for class A.
If, when defining the job, the user specifies a target host, immediate start jobs will also wait for execution if there is no free background work process in the specified host, even if there are free background work processes in other hosts. When no target host is specified, immediate start jobs are evenly distributed among the available background processing servers. When selecting the Immediate option, the system includes this information within the Date/Time box and presents additional options on the same screen, such as the check box to specify whether it's going to be a periodic job and whether you want to specify additional restrictions for the start time of the job.Users not having authorization for releasing jobs cannot use the Immediate start option.
Date and Time The Date/Time option allows you to specify the date and the time when the job will be processed. When you click on the Date/Time button, the system opens input fields under the Date/Time box to allow for entering the start data, and also automatically shows the Periodic Job check box and additional function buttons on the bottom part of the screen. In the input fields, enter the requested start date and time. You can either type the requested information or click on the possible entries arrow to choose a value. In this case, when selecting dates and time, similar to the rest of the SAP system, clicking on the arrow for a date will display a dialog box with a calendar.
Sometimes, it might not be convenient for the job to be released for execution if there are no free work processes available at the specified date and time. In these cases, the system allows for restricting the job not to start after a specified date and time by entering that information in the input field No Start After. Specifying periodic intervals for execution and additional start restrictions are explained in the following sections. After Job The After Job start option lets you specify starting a background job after the execution of a previous job. Figure shows the list box displayed by the system in which you enter the name of the previous job.
Specifying a job after a predecessor
The After Job option includes the check box Start Status-Dependent, which is used to specify whether to start the job independently of the status of the previous job or only execute the job if the previous job was finished successfully. Selecting the check box indicates the background system to start the job only if the previous job was successful. The After Job option is quite useful for defining "cascaded" jobs which need to be executed one after another.
After Event With the After Event start option, users can define jobs that will be executed when the system triggers a specific event. Events are signals that indicate that a certain condition, phase, or stage has been reached, for example, that the SAP system has just been started, a certain database operation has been performed, and so forth. Events can be triggered by ABAP programs, by the SAP system itself, or by using the sapevt program from the operating system.
Starting background jobs by sending events is quite useful especially in situations where there is an interface or relation between operating system processes and SAP. Two typical examples are as follows:
It is also possible to specify the jobs started after events to be periodic. This means that when the job is triggered, the first thing it does is to automatically reschedule itself for the next time it receives the event. You can display a list of available events by clicking on the possible entries arrow. Or you can create your own events. To do that, from the main menu, select Tools | CCMS | Jobs | Maintain Events. Alternatively, run transaction SM62. A practical example is as follows:
At Operation Mode Change Another option for starting background jobs is when the system changes the operation mode. This option can be quite useful for system or job administrators when having to reschedule many jobs for other users at a more convenient time in order to optimize system resources and performance. For example, when changing the operation mode, the system is configured to switch many dialog processes to background work processes (for example, in operation modes defined for nightly or weekend operation), which is a better time to schedule the jobs that could not be processed during a normal operation mode.To define a job at operation mode change, click on its function button and enter the operation mode name in the input field.
Additional Start Restrictions The system includes an option to restrict the job start time to a specific workday linked with a factory calendar. This option can be useful when jobs are not needed on holidays or weekends, but only on certain workdays, for example, background jobs that generate production orders or project worksheets that are only required for operative users who do not work on holidays or weekends. Restrictions on workdays and the factory calendar can only be applied to jobs with the Date/Time start option. To specify start restrictions, when in the Date/Time option, click on the Restrictions button.
Specifying start restrictions
In the restrictions for the Start Date dialog box, you can define jobs to execute only on workdays and decide how the background system will behave in case the scheduled job's planned start is on a nonworking day. The system allows you to either cancel the job, always execute it, move it to the next workday, or move it backward to the previous workday.
Relative Start Option The last available start option is to specify the number of workdays relative to the beginning or end of a month when a job should be started. As with every option in the system that uses workdays, it must be linked with a factory calendar. To display the dialog box for specifying relative start times, press on the >> icon on the initial Start Date/Time screen. The Period input box is specified in number of months. For instance, 02 means that the job will be repeated every two months.
Defining a Repeat Interval Period
The background processing system allows for defining a repeat interval for jobs that you want to execute periodically. For example, administrators can run cleaning background jobs everyday, sales managers can have a sales report run in the background every month, and so on.
To define a repeat interval period, you first define a start option. The dialog box automatically shows the Periodic Job check box. Select this box and then click on the period values. The system displays a new pop-up box. This is five standard options: hourly, daily, weekly, monthly, and other. To select any of the periodic values, just click the pushbutton.
The periodic value pop-up box
With the fifth option, Other Period, you can specify virtually any repeat period option. Enter the desired values in the corresponding input fields. When specifying a repeat interval for jobs started with the After Event option, you cannot specify a repeat time value; instead, when the job is defined as periodic, the system will reschedule it every time it is processed.
Specifying Job Print Parameters
Often, the result of an ABAP program or external program makes database modifications that are not output in lists. Often, too, the result of a background job is a report list, which can be passed directly to the printing system, either as an output request or directly sent to the printer. You can also send the spool output to a list of recipients. When defining ABAP reports that generate report lists, you can decide to define the print parameters for the background jobs. To do that, click on the Print Specifications button, which appears in the dialog box for ABAP step creation. The Background Print Parameter screen is virtually the same as any other print request generated in the SAP system. Enter the requested print specifications and save the settings.
Specifying the Spool List Recipient
The system includes the possibility of automatically sending to a group of recipients the result of a job that includes a spool request. The system allows this output to be sent both to internal users or by other external means (Internet mail, fax, and so on) if these communication types have been previously configured in the system. To send the output of a job to a recipient or group, click on the Spool List Recipient pushbutton on the initial job definition screen. The system will display a dialog box for determination of recipients, as well as additional flags that will be attached to the message. Clicking on the possible entries arrow in the Recipient input field opens an additional dialog box for selecting the type of user or messaging system. Figure shows these screens.
Spool List Recipient options
Make your required entries and press the Copy icon to transfer the information to the job definition.
Management Operations on Background Jobs
Previous sections explained the process of defining and scheduling jobs. This section covers additional management options to handle modifying, monitoring, and controlling background jobs. Users can display a list of their own jobs by selecting System | Own Jobs from any SAP window. The most important background job managing operations are as follows:
Most basic management operations are performed from the Job Overview screen. To reach the Job Overview screen, first, from the main menu select System | Services | Jobs | Job Overview or, alternatively, enter transaction code SM37 in the command field.
Background jobs main selection screen
On the initial screen, enter the selection criteria for the jobs you want to look for. On the job selection screen, you can specify job name, user name, a date and time interval, job status, and so forth. Wildcards, such as the asterisk sign (*) are allowed. Do not forget to enter the event name or an * to select jobs which are started after event, even when they are already finished in the date and time range. Once the criteria are specified, press ENTER to display the job overview for the requested selection. This screen includes several menu options that allow you to perform common monitoring and management tasks over a job or a group of selected jobs.
Job Overview list
The next sections explain some of these common tasks.
The Job Status
A job can have one of the following statuses: scheduled, released, ready, active, finished, canceled. They indicate the following conditions:
This status is not seen very often. It is a short period of time before the job changes to an active status.
Modifying Scheduled Jobs
A job that has been released can be canceled, which reverts its status to Scheduled. To do this, from the Job Overview list, select the job, and then, from the menu, choose Job | Released | Scheduled. To release a scheduled job, from the menu, click on the Release Job button on the application toolbar. From the Job Overview screen, administrators can also change the definition of a job that has not yet been processed. By selecting the job and then choosing Job | Change from the menu, authorized users can modify the start time, the steps, print lists, restrictions, and so on.
Other available options under the Job menu are as follows:
For jobs that are already finished or have been canceled, you can display the job log by selecting the job and clicking on the Job Log function button on the application toolbar. To display the details of individual jobs, select the job and double-click on it or select Job | Job Details from the menu. From the Job Display screen, you can look further at the rest of the job information like the steps, start time, repeat interval, print specifications, and so forth.
Background jobs become very numerous in productive SAP installation and so do the number of job logs and job-related information. It is a good practice to periodically delete all the jobs that have already been processed and are no longer needed. Deleting jobs removes the associated job log and the internal table entries. There are two ways to delete jobs: manually, by selecting jobs from the job list display and then choosing the Delete function from the menu, or automatically, by defining one or several jobs which periodically clean up old jobs. The standard ABAP report RSBTCDEL is used for this purpose.
You can create several variants that delete only those jobs specified in the selection criteria. You can find more information about other useful cleaning jobs in the SAP Notes. When deleting jobs, be careful to determine which are predecessors of other jobs, because those jobs will no longer be started, although you have the option of rescheduling them by assigning a different start option.
Displaying Job Logs Every background job generates a job log after execution; job logs are only available for finished or canceled jobs. They record the messages that are issued by the programs specified in the job steps. The messages of the job log are language dependent. These logs can be very useful for finding the cause of errors, problems, and failures or for tracing important parts of a job. If no problem occurs in the job execution, the job log simply contains the start time and finish time of the job and an indication of the start of every job step.
Sometimes, depending on the nature of the executed program, job logs might also contain internal program information, such as statistical information. These messages are output to the log file using the MESSAGE keyword of ABAP. To display the log for a job, select the job from the Job Overview list and double-click on it or click on the Job Log button on the application toolbar. For each job log a job file is created at the operating system level. These are usually located under the SAP system global directory (/usr/sap/<SID>/SYS/global) and are managed within the TemSe (temporary sequential objects) database. These log files should not be deleted manually in the operating system, because they are managed by the SAP system and their deletion can cause inconsistencies in the TemSe database. The log files are automatically deleted by the system when the jobs are deleted.
The Graphical Job Monitoring Tool
Within the CCMS monitoring functions, the SAP system includes a utility for graphical job monitoring. To display the job scheduling graphical monitor, from the main menu, select Tools | CCMS | Control/Monitoring | Job Scheduling Monitor or transaction code RZ01.
The Job Scheduling Monitor main screen
The graphical Job Monitor is quite useful for looking at the available resources for background, the status of jobs, estimated runtime, operation mode switch, and so forth. The background processing system manages a statistics database used for making estimates of job processing times. This is particularly useful with periodic jobs. For jobs without runtime statistics, the monitor shows an estimate with the minimum length. In the left column of the display under Job Server, the monitor shows how many background work processes are available identified with the name of the host system.
The ruled horizontal line on top of the display shows the time unit used for monitoring. The broken vertical line shows the current time. The Monitoring tool shows the jobs as rectangles where you can click to display an overview with information about the particular job. The length of a job rectangle shows the approximate amount of time that the job requires for processing. For a finished job, it actually shows the time it took to complete.The status of a job is indicated by its colors. To display a legend of the meaning of each color, click on the Key button on the display toolbar.
Watch out for long yellow bars with shading, which might indicate a problem in the background scheduler or blocked work processes. Many red bars with >>> shading (estimated runtime exceeded) might indicate that the program is not running correctly. The graphical Job Monitoring tool can quickly give an idea of the load distribution among the available background work processes. From a general display, you can see if the system is executing jobs evenly among the available background servers. The Job Monitor uses an additional Alert Monitor, which automatically reports any errors related to the background processing such as canceled jobs. Since release 4.5 or the SAP Basis system, the background processing system was integrated into the new alert architecture and CCMS monitors.
To the right of the current time, the rectangles are for jobs that are waiting to be processed. On the menu bar of the graphical display, there are several functions available to configure the monitoring utility, as well as for displaying and managing jobs. The time unit menu allows you to change the time measurements on the display. By default it is set to minutes, but you can compress or expand the display by selecting another time unit such as hours or days.With the Jobs menu, administrators can display job logs and job overview information and can change the job information.
To perform any function under this menu, first select the function and then click on the job. For example, you can select Check Job Status from the Jobs menu and then click on any job in the display. The system shows a dialog box indicating whether the job status is OK or not. By clicking on the Timer On button, the system automatically updates the job display every three minutes. Using the Monitor | Customize function, you can decide to set some standard values for displaying jobs under the monitoring tool. For example, you can decide how many hours you want to have for displaying canceled jobs, what the standard expected runtime assigned to jobs without statistics is, and so forth.
SAP BASIS Related Interview Questions
|SAP CRM Interview Questions||SAP HR Interview Questions|
|SAP ABAP Interview Questions||SAP HANA Interview Questions|
|SAP Crystal Reports Interview Questions||SAP SOLMAN Interview Questions|
|SAP Security Interview Questions||SAP BPC Interview Questions|
|SAP Netweaver Interview Questions||SAP UI5 Interview Questions|
|SAP Smart Forms Interview Questions|
Sap Basis Tutorial
Sap: From Sap R/3 To Sap Netweaver
The Architecture Of The Sap Web Application Server
Sap Netweaver: An Overview
Using Sap Systems
Upgrading To Sap R/3 Enterprise: The First Step Into Sap Netweaver
The Change And Transport System
Development Options With Sap Solutions: Abap Engine
User Management And Security In Sap Environments
Web Application Server System Management
Performance And Troubleshooting With Sap Solutions
Sap For It Managers: Implementation, Planning, Operation, And Support Of Sap Systems
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.