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: 

Job Schedule (SM36) query

Former Member
0 Kudos

I have a requirement:

I want to process something (Send a mail to the user) once a job is finished / cancelled / Errored.

I think one way of doing this is create a new step in the job and process it depending on the status of earlier step (But I doubt whether this can be achieved).

Is there a way of doing conditional exceution of any step (i.e The execution of a step depends on the success/ failure of earlier steps)

Is there a better way of achieving this?

Thanks

Amit Jain

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi.

While creating the job itself u have the option called "mail receipient"..why dont u use that??

Y do u want to go for another step...

Or

u can create 2 jobs...scond job is to send mail ,and this second job should be triggered once the firt job is over...(For ths econd job ,starting condition would be completion of first job)...

Cheers,

Ravi

6 REPLIES 6

Former Member
0 Kudos

Hi.

While creating the job itself u have the option called "mail receipient"..why dont u use that??

Y do u want to go for another step...

Or

u can create 2 jobs...scond job is to send mail ,and this second job should be triggered once the firt job is over...(For ths econd job ,starting condition would be completion of first job)...

Cheers,

Ravi

Former Member
0 Kudos

Hi,

You can add a Step to that job, for that spet create a new report program in that Program write the select statment from Background job tables and look at the status, then give the output, even you can write QAIT statment in the second report to wait for some amount of time

background tables are

TBTCO Job Status Overview Table

TBTCP Background Job Step Overview

TBTCR Batch scheduler execution time

TBTCS Background Processing: Time Schedule Table

TBTCA Subsequent relationship in batch job sched

TBTCB Preceding relationship in batch job schedu

Regards

Sudheer

0 Kudos

Thanks for your replies,

To be specific.. I have 30 jobs and if any of the 30 job errors (Status: Cancelled), a mail needs to be sent.

Some options I think of is:

1> create 30 new jobs which depends on the status of original 30 jobs and my job triggers only if the corresponding original job errors (Is there a way to accomplish this and how?)

2> Create an additional step in each 30 original job. This step should execute (which sends an email) if and only if any of the above steps has errored.

Can this be accomplished and how?

Thanks

Amit Jain

0 Kudos

But our new step wont get executed unless the earlier steps were executed successfully.

If the step 1 failed, then the control wont got to my step(which might be 2 ) and our logic wont get executed.

Former Member
0 Kudos

I have accomplished this using an Oracle dbms_job and a stored procedure to interrogate the background tables identified previously. In principle, the same approach can be used to create an ABAP to do the same. It is a very simple solution.

This process runs every N hours and will email to a designated distribution list a listing of all jobs that have a canceled status. Also, an exception mechanism is provided which allows you to ignore certain jobs.

I chose to do it via the Oracle method due to some peculiarities in our processing environment

0 Kudos

David,

Can you please elaborate on how to schedule Oracle DBMS job and get this job done?