How to maintain and monitor background jobs via SAP

The following document provides general procedures for creating, maintaining, and monitoring background (batch) jobs in SAP.  The procedures explain the most basic and common activities.  However, the creation and maintenance of SAP background jobs can become quite complex, and much of the detail is beyond the scope of this document.

AUDIENCE

All system maintenance personnel should review this document.

REFERENCES

For more information the following sources are recommended:
BC - System Administration Guide, Chapter 4: Managing Background Processing
SAP Extended Help (Select Extended Help from the Help menu while in transaction)

PROCEDURE

Creating a Background (Batch) Job in SAP

  1. To create a background job in SAP, enter the Define Background Job screen by using transaction code  SM36 or menu path System ® Services ® Background jobs ® Job definition.
  2. Enter a descriptive job name in the Job name field.  See document 15020 for naming conventions and reference.
  3. Enter the background job priority in the Job class field.  The different priority levels, from highest to lowest, are A, B, and C.  The job class determines how the background jobs are queued.  Jobs that are absolutely crucial should be classified as A, those that must run, but can be delayed without causing great disruption to operations should be classified as B, and jobs that the least imperitive to business functions (such as most reports, for example) should be classified as C.
  4. Enter the host (server) that will run the background job in the Target host field.  Click the down arrow on the right side of the field to get a listing of possible entries.  If this field is empty, the job will run on the host (server) that you are logged into.
  5. To schedule the background job, click on the Start time pushbutton.  This will bring up the Start Time pop-up window.
  6. There are several scheduling options:
  • Immediate   This option will be used on several occasions:   
      - When a job is run on request by a user.
      - When a job fails and must be restarted.
      - For some monthend jobs or jobs with dependencies on other platforms, they may need
      to be run when resources are available, or there predesessor jobs finish.
  • Date/Time   The date and time the job will release.  It may not start until resources are            available.  If a job is scheduled to be periodic, it will release at that time the next day,       week, month, etc based on the selected period.
  • After job      Jobs with dependencies will be scheduled to release upon completion of its       predecessor.  A status indicator may be checked.  If it is, the successor job will only release if the predecessor finishes completeley.
  • After event  Jobs may be set to release after pre-defined events are raised.  These events can           be coded into ABAP/4 programs.
  • At operation mode    These jobs will release when operation mode switching completes.  This would be useful  if many batch jobs need to be released around the same time.  They can be set to release when the operation mode switches a number of dialogue sessions to batch, ensuring adequate resources.
To schedule the background job according to one of the options, click the corresponding pushbutton at the top of the window.  After the selection, the appropriate entry fields will become active in the window.  The two most common options will probably be Immediate and Date/Time.
To schedule a background job to run immediately, click the Immediate pushbutton, and then the active Save button.  No additional entries are required.
To schedule a background job according to a specific date and time, click the Date/Time pushbutton.  Several fields will appear.  Enter the desired values in the Scheduled start fields.  Entries in these fields are required.  The background job will be released at this data and time but may wait in a queue.  To prevent a job waiting in the queue from running after a certain time, enter the desired values in the No start after fields.  The values in the Date fields should follow the default format for the login ID used.  (To determine this format, use transaction SU50 or menu path System ® User profile ® User defaults to see the user defaults.)  The values in the Time fields should be in military format.
When either the Immediate or Date/Time options are chosen, the Periodic job click box will appear at the bottom of the screen.  Click this box if you want to run this job at periodic intervals.  Options for periodic scheduling appear when the Period values pushbutton is clicked.  The background job will run at periodic intervals after the first background job runs.  In addition, a Restrictions pushbutton will appear.  In the Restrictions window, there are several options.  Click only on workdays to limit the days the job releases on.   You limit these days by specifying a calendar at the bottom of the window.  Separate calendars for Monday to Friday, Monday to Saturday, Everyday, and others will be created.  One of four buttons must also be set.  Always Execute will cause the job to releasee according to its period valued REGARDLESS OF ANY WORKDAY/CALENDAR RESTRICTIONS.  This is the default value, but it should almost always be changed.  Cancel Job will simply cancel the job on non-workdays.  Move to previous day will release the job on the workday previous to the date determined by the period value.  Move to next workday will release the job on the next available workday. To schedule a background according to the other options, use the F1 function key to obtain more information.
  1. After entering all the scheduling information, click the Save pushbutton.  This will bring back the Define Background Job screen.
  2. Click the Steps pushbutton to bring up the Step List and Create Step 1 windows.  These windows define the program(s) that will run in the background. 
  3. To run an ABAP/4 program, click the ABAP/4 pushbutton. 
10.  Enter the name of the ABAP/4 program in the Name field and, if necessary, enter the variant in the Variant field.  A variant specifies the set of parameters that an SAP program needs to execute.  To get a list of variants that have been created for a program click the Variant list pushbutton.  (Variants may defined in the ABAP/4 Program Development: Initial Screen using transaction code SE38 or menu path Tools ® CASE ® Development ® Program maintenance ® ABAP/4 development.)
11.  When an ABAP/4 program uses write statements, these write statements are printed, rather than displayed on a screen , when the program runs in the background.  The print job will use the print specifications of the login ID used.  (To determine these specifications, use transaction SU50 or menu path System ® User profile ® User defaults to see the user defaults.)  To change the print specifications, such as the printer, click the Print specifications pushbutton.
12.  Note that external programs on the UNIX platform may be executed using the SAP scheduler.  This will probably not be too common, but to do so, click the External program pushbutton.  Enter the information in the Name and Parameter fields.  For more information, use the F1 function key.
13.  Once the background program has been defined, click the Save pushbutton.  This will save one “step,”  which will now appear on the Step List screen.
14.  A background job may execute more than one program.  To specify additional programs, click the Create pushbutton on the Step List screen and repeat numbers 9 through 13 above for the Create Step 2 screen and so on.  The Step List screen also allows the list of programs for a background job to be changed using the different pushbuttons at the top.
15.  After the programs for a background job have been completely specified, click the icon with the green arrow to return to the original Define Background Job screen.
16.  Click the Save (yellow folder) icon to save the background job definition and submit it.

Maintaining and Monitoring Scheduled Background Jobs

  1. To maintain or monitor SAP background jobs, enter the Select Background Jobs screen by using transaction code  SM37 or menu path System ® Services ® Background jobs ® Job overview.  The window is a selection screen.  A listing of background jobs will appear according to this window.
  2. The following fields are available to query all background jobs.
  • Job name - To find a particular job, enter the job name in this field.  To find all job names, enter *.
  • User name - To find jobs created by a particular user, enter the user ID in this field.  To find jobs by all users, enter *.
  • Start From/To Date/Time - To find jobs with start times in a particular interval, enter the beginning of the interval in the From Date and Time fields and the end of the interval in the To Date and Time fields.  The beginning or end of the interval may be left open.  The values in the Date fields should follow the default format for the login ID used.  (To determine this format, use transaction SU50 or menu path System ® User profile ® User defaults to see the user defaults.)  The values in the Time fields should be in military format.
  • Start at event - To find jobs that were triggered by an event, enter the event in this field.  Leave the field blank if it is not applicable.
  • Jobs Status - To find jobs with a particular status, select the click box associated with each status.  More than one status may be chosen.  Select all click boxes to get a listing of jobs, regardless of status.  The statuses include:
    • Scheduled - This status applies to background jobs that have been defined by users who do not have the authority to kick them off.  These jobs must be released by users who do have this authority or else they will not run at their start times.
    • Released - This status applies to background jobs that will run at their start times.
    • Ready - This status applies to background jobs that have been kicked off at their start times but have been queued to run.
    • Active - This status applies to background jobs that are currently running.
    • Finished - This status applies to background jobs that completed normally.
    • Cancelled - This status applies to background jobs that ended abnormally.
    • Jobs without start date - To find jobs without a start date, select this click box.
    • Jobs with previous job - To find jobs with previous jobs, select this click box.
The number of jobs selected will decrease as more criteria are chosen.  To find more information on possible entries for each field, select the field and select the F1 function key.
  1. Once the selection criteria have been specified, click the Execute pushbutton.  This will bring up the Job Overview: Alphabetic screen, which gives a listing of jobs that satisfy the criteria with the status of each job.
  2. By default, the jobs are listed alphabetically.  To sort the list by different criteria, select Sort from the Edit menu.
  3. Click the Refresh pushbutton to update the information listed on the overview screen.
  4. To maintain a specific background job or obtain information about it, select the job by clicking its job name in the list.  The following pushbuttons provide several options:
  • Job log - Click this pushbutton to display the results of a completed background job.
  • Display - Click this pushbutton to display general data about a job.
  • Release - Click this pushbutton to release a scheduled job.  A user may schedule a job, but if the user does not have the proper authorization, the job remains in scheduled status.  It will not run until, an authorized user has released it.  Jobs created by authorized users are automatically released.
  • Spool list - Click this pushbutton to display a background job’s spool requests (print/fax jobs).
  • Steps - Click this pushbutton to display a background job’s Steps List (the programs that it will or has run).
Other options are provided in the Job menu.  These include:
  • Schedule job - Select this to cancel, release, or repeat an existing job.
  • Copy - Select this to copy an existing job to a new one.
  • Delete - Select this to delete a job.
  • Change - Select this to change or modify the definition of a job that has not run yet.
  • Capture - Select this to capture a job that is currently running and run it in the current on-line session.
  • Cancel job - Select this to cancel a job that is currently running.

1 comment:

zone-i said...


Your Welcome sir.