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: 

Periodic Background Jobs after another Job finishes

Former Member
0 Kudos

Hi

I have to schedule a job 'B' to run after job 'A' finishes.

When i schedule job 'B' to run after job A , it runs only once , while i need the job B to run periodically after job A finishes.

1) I cannt make job B as step 2 of job A , because job A is not scheduled by me and i cannt change that.

Can anyone tell me how to i trigger the job B periodicaly after job A finishes .

Any solution or hint would be appreciated.

Looking forward to some helpful replies from the gurus of SAP.

Regards

Purva

4 REPLIES 4

Former Member
0 Kudos

Hi Purva,

I don't think you can achieve this functionality just by SM36.

You should be able to change the job A using SM37, or you can ask the basis to change it for you, as it is the easiest and best way to do.

Revert back if you have further query.

Reward points if useful.

Regards,

Atish

Former Member
0 Kudos

Hi,

Giev ur job name as B.

U have an option in JOB START CONDITIONS.

U need to check AFTER JOB (provide job name as A-> this job is alraedy scheduled by the other guy)

check " Start if predecssor job ends succesfully".

This iwll trigger job B periodicaly after job A finishes .

It mean job will be eexecuted only when job A finsishes succesfully.

Revert back if any issues.

Reward with points if helpful.

Regards,

Naveen

Former Member

Dear Purva,

The condition "After job" doesn't work as you expected for "Periodic Jobs"

Please refer to [SAP NOTE # 919458|https://service.sap.com/sap/support/notes/919458] for details. An extract is showed below:

"The start condition "Start after job" is internally mapped by means of "Start after event SAP_END_OF_JOB with the parameter <Jobname><Jobcount> of the predecessor". The pair <Jobname><Jobcount> is the unique key for a job. If a job is executed periodically, the SAP_END_OF_JOB event is always triggered with different parameters.

The successor in turn waits for SAP_END_OF_JOB with just one particular parameter (this is the parameter with <Jobname><Jobcount> from the first predecessor). When the successor is rescheduled, the key fields from the next predecessor must therefore always be known in advance, something which is not always technically possible.u201D

I think you can use BTC_EVENT_RAISE to solve your problem as the note explains.

Regards,

Diego.

Dear Team,

Job ES_RPTMC_CREATE_CHANGEPOINT_AUTH  ran only once where as SEC:INDX_UPDATE_FOR_STRUCT_AUTHS ran daily.

CAUSE:

“The start condition "Start after job" is internally mapped by means of "Start after event SAP_END_OF_JOB with the parameter <Jobname><Jobcount> of the predecessor". The pair <Jobname><Jobcount> is the unique key for a job.
If a job is executed periodically, the SAP_END_OF_JOB event is always triggered with different parameters.
The successor in turn waits for SAP_END_OF_JOB with just one particular parameter (this is the parameter with <Jobname><Jobcount> from the first predecessor). When the successor is rescheduled, the key fields from the next predecessor must therefore always be known in advance, something which is not always technically possible.”


SOLUTION:

This task can be completed with the new ABAP program Program  BTC_EVENT_RAISE.
The program is delivered by Support Package for Basis Releases 640 and 700, and is included in the standard system in all subsequent releases.
The program is used to trigger a batch event. Existing programs do not therefore have to be changed. The BTC_EVENT_RAISE program has several parameters in the selection screen, including the event (and parameters) that is to be triggered.


PROCESS:

 Go To SM64
 Click on Create
 Create two events.

Our Case:
We created Z_ES_CP_AUTH and Z_SEC_AUTHS

 Go to SE38
 Give the event name as BTC_EVENT_RAISE
 Select Variants and click on Display
 Give the variant name as the one you created.

Our Case:
Z_ES_CP_AUTH

 Click on Create
 Give in the details for variants
 Click on attributes and give the details for attributes
 Go to the job which needs to be run first
• Select the job in released status
• Job->Change
• Step
• Add BTC_EVENT_RAISE as the last step of the job with the parameter as the variant created
Our Case:
Step: BTC_EVENT_RAISE, Parameter: Z_ES_CP_AUTH

 Go to the job which needs to be run next
• Select the job in released status
• Job->Change
• Start Condition -> After Event.
• Give the BTC_EVENT_RAISE parameter of the first job as the event of the second job.
Our Case:
After Event: Z_ES_CP_AUTH

 Save the changes.
 The jobs will start running one after the other with the given frequency.

Thanks

Joginadham U