Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Background Job Scheduling

Former Member
0 Kudos

Hi,

I am scheduling a report to run in background.

In this report it is creating background jobs automatically for different company codes.

It submits the 1st background job and waits until it finishes.

Then 2nd job starts in background and continues with other jobs.

At end it finishes all the jobs and closes.

Now my problem is.

1. Whether is it possible for us to submit all the jobs at 1 time. And execute at same time. Ie., 1st, 2nd job will start at same time.

2. If possible how can we do that.

What I have written is

loop at companycode.

Create job name.

call fun 'Job_Open'.

submit xxxx user sy-uname via job job_name numer job_count

to sap-spool

spool parameters l_spool_parameter

without spool dynpro

with companycode

with ......

and return.

endloop.

Please help ASAP, urgent.

2 REPLIES 2

Former Member
0 Kudos

create a new function and hand-over the parameters you need.

The function should call the submit you have written in your post.

In your main program instead of calling the submit-statement call this function (with the option STARTING NEW TASK). In this way you loop over your data, call the function which starts a new task and returns immediately so that you can run into the next loop cycle.

hope that helps...

Matthias Nutt

SAP Consulting Switzerland

Former Member
0 Kudos

hi praveen,

Job Scheduling Explained

Definition

Before any background processing can actually begin, background jobs must be defined and scheduled. The scheduled time for when a job runs is one part of the job’s definition. There are several ways to schedule jobs:

From Transaction SM36 (Define Background Job)

With the "start program in the background" option of either Transaction SA38 (ABAP: Execute Program) or Transaction SE38 (the ABAP editor)

Through the background processing system’s own programming interface. (Many SAP applications use the internal programming interface to schedule long-running reports for background processing.)

Through an external interface.

Scheduling Background Jobs

Use

You can define and schedule background jobs in two ways from the Job Overview:

· Directly from Transaction SM36. This is best for users already familiar with background job scheduling.

· The Job Scheduling Wizard. This is best for users unfamiliar with SAP background job scheduling. To use the Job Wizard, start from Transaction SM36, and either select Goto ® Wizard version or simply use the Job Wizard button.

Procedure

...

1. Call Transaction SM36 or choose CCMS ® Jobs ® Definition.

2. Assign a job name. Decide on a name for the job you are defining and enter it in the Job Name field.

3. Set the job’s priority, or “Job Class”:

· High priority: Class A

· Medium priority: Class B

· Low priority: Class C

4. In the Target server field, indicate whether to use system load balancing.

· For the system to use system load balancing to automatically select the most efficient application server to use at the moment, leave this field empty.

· To use a particular application server to run the job, enter a specific target server.

5. If spool requests generated by this job are to be sent to someone as email, specify the email address. Choose the Spool list recipient button.

6. Define when the job is to start by choosing Start Condition and completing the appropriate selections. If the job is to repeat, or be periodic, check the box at the bottom of this screen.

7. Define the job’s steps by choosing Step, then specify the ABAP program, external command, or external program to be used for each step.

8. Save the fully defined job to submit it to the background processing system.

9. When you need to modify, reschedule, or otherwise manipulate a job after you've scheduled it the first time, you'll manage jobs from the Job Overview.

Note: Release the job so that it can run. No job, even those scheduled for immediate processing, can run without first being released.

Specifying Job Start Conditions

Use

When scheduling a background job (either from Transaction SM36, Define Background Job or CCMS ® Jobs ® Definition), you must specify conditions that will trigger the job to start.

Procedure

Choose the Start condition button at the top of the Define Background Job screen.

Choose the button at the top of the Start Time screen for the type of start condition you want to use (Immediate, Date/Time, After job, After event, or At operation mode) and complete the start time definition in the screen that appears.

For the job to repeat, check the Periodic job box at the bottom of the Start Time screen and choose the Period values button below it to define the frequency of repetition (hourly, daily, weekly, monthly, or another specific time-related period). Then choose the Save button in the Period values screen to accept the periodicity and return to the Start Time screen.

Once you’ve completed specifying the job start conditions, choose the Save button at the bottom of the Start Time screen to return to the Define Background Job screen.

No job can be started until it is released, including jobs scheduled to start immediately. Since releasing jobs can be done only by a system administrator from the job management screen (Transaction SM37) or by other users who have been granted the appropriate Authorizations for Background Processing, no unauthorized user can start a job without explicit permission

Managing Jobs from the Job Overview

Use

The Job Overview, or Job Maintenance, screen is the single, central area for completing a wide range of tasks related to monitoring and managing jobs, including defining jobs; scheduling, rescheduling, and copying existing jobs; rescheduling and editing jobs and job steps; repeating a job; debugging an active job; reviewing information about a job; canceling a job's release status; canceling and deleting jobs; comparing the specifications of several jobs; checking the status of jobs; reviewing job logs; and releasing a job so it can run.

Procedures

To display the Job Overview screen, choose CCMS ® Jobs ® Maintenance or call Transaction SM37. Before entering the Job Overview screen, the system first displays the Select Background Jobs screen. You'll need to complete this Job Selection screen to define the criteria for the jobs you want to manage. Once you've selected jobs to manage, you can choose from a wide range of management tasks:

To copy a single existing job, choose Job ® Copy.

To reschedule or edit job steps or attributes of a single job, choose Job ® Change. A job step is an independent unit of work within a background job. Each job step can execute an ABAP or external program. Other variants or authorizations may be used for each job step. The system allows you to display ABAP programs and variants. You can scan a program for syntax errors. You can also display the authorizations for an authorized user of an ABAP job step.

To repeat a single job, choose Job ® Repeat scheduling.

To debug an active job, choose Job ® Capture: active job. Only a single selection is allowed. If an active job seems to be running incorrectly (e.g., running for an excessively long time), you can interrupt and analyze it in debugging mode in a background process, and then either release it again or stop it altogether.

You will be able to capture a background job only if you are logged on to the SAP server on which the job is running. To find server information in the Job Overview, select and mark the job, then choose Job ® Job details.

To review information about a job, choose Job ® Job details. Details displayed can include:

current job status

periodicity, or the repetition interval

other jobs linked to the current job, either as previous or subsequent jobs

defined job steps

spool requests generated by the current job

To cancel a job's "Released" status, select the job or jobs from the Job Overview list and choose Job ® Release -> Scheduled.

To cancel a job from running but keep the job definition available, select the job or jobs from the Job Overview list and choose Job ® Cancel active job.

To delete a job entirely, select the job or jobs from the Job Overview list and choose Job ® Delete. Jobs with the status of Ready or Running cannot be deleted.

To compare the specifications of more than one job, select the jobs from the Job Overview list and choose Job ® Compare jobs.

To check the status of jobs, select the job or jobs from the Overview Job list and choose Job ® Check status. This allows you to either change the job status back to Planned or cancel the job altogether. This is especially useful when a job has malfunctioned.

To review job logs, select a job or jobs with the status Completed or Canceled from the Job Overview list and

regards

karthik

reward me points if helpfull