How to Schedule dependent Batch job in sequence in SM36?

Share on Facebook29Share on LinkedIn2Tweet about this on TwitterShare on Google+1
Please Share!!

In the era of in-memory, HANA, Fiori, SAPUI5 and other future ABAP, we are pulling you back to the pre-historic period. 🙂 We will talk about scheduling job which should trigger after another job is complete. In short, we will see how to schedule dependent jobs.

The motivation for this article is a recent experience where a consultant with more than 10 years of experience was not able to schedule a batch job which would trigger immediately after another job would complete.

How many of you have seen this error?

“Job XXXXXXX does not exist or does not have status ‘scheduled’/released‘”.

Job XXXXXXX does not exist or does not have status 'scheduled'/'released'

There are many unanswered questions in popular Q&A forums for this issue.

scn question
consolut question

Even after 10 years of SAP experience, if you follow the below steps to schedule batch jobs in sequence, then either you have never scheduled dependent batch jobs which are supposed to trigger after a job completes or you were always in projects where there were some dedicated teams who did all batch job scheduling.

Let us see how most of the ABAPers wrongly think a dependent batch job should be scheduled.

1. Execute the first program in background mode.

First job is active

The expectation is, when the first active job (in this example, ZWM_UPDATE_SWBS_CHAR) is complete, another job should trigger.

2. Now, schedule the second program which should trigger after the first program completes. Go to t-code SM36. Give Job Name hit enter (or Steps) and provide the Program Name and Variant and hit save.

1

2

3. It would show the variant screen. Hit Back icon to go back to the SM36 initial screen. Now hit Start Condition (you know this is the place which controls the trigger).

31

4. Hit After Job button. Provide the first job name which you scheduled in step 1. Hit save and you expected your work was done.

4

Oops, you get this message. “Job <Jobname> does not exist or does not have status ‘scheduled’/released‘”.

Where did you go wrong?
The answer is in the error message itself. You can schedule dependent jobs only in case of predecessor jobs which are in status Scheduled or Released. But, your first job was already in Active status when you tried to schedule the second job dependent on the first one.

Correct steps to schedule dependent jobs in sequence.

Part I – Schedule First Job
1. Go to t-code SM36 to schedule the first job.
Give the job name for the first program. Hit Step icon or hit enter. Provide the program name and variant. Hit Save.

7

You would be in Step List Overview screen. Hit back.

8

2. You are back to the initial screen of SM36. Hit the Save icon. You would get the message “Job saved with status: Scheduled”. Your first job would be scheduled successfully.

9

3. Double check that the first job is in scheduled status. Hit Own Jobs in the SM36 screen. Our job is in scheduled status.

10_0

10

You have done the first part correctly.

Also Read: How to create and change variant in SAP Production System without Fire Fighter Id.

Part II – Release Second Job
Now steps to schedule the dependent jobs which should trigger after the first job is complete.

4. Go to t-code SM36 to schedule the second job.
Give the job name for the second program. Hit Step icon or hit enter. Provide the program name and variant. Hit Save.

11

You would be in Step List Overview screen. Hit back.

12

5. You are back to the initial screen of SM36. Now hit Start Condition icon.

6. Hit, After Job button. Provide the first job name which you scheduled in the step above. Hit Check and then Save icon.

13

7. You are back to the initial screen of SM36. Hit Save icon. You would get message “Job saved with status: Released”.

14

8. Double check that the second job is in released status. Hit Own Jobs in the SM36 screen. Our second job is in released status.

16_0

Part III – Trigger/Start first Job

9. Now we need to start our first job. Go to SM36. Hit Own Jobs. Select your first job and hit Release button. In the next screen, hit Immediate button (or Date/Time if you want) and hit check and Save icon.

15
Your first job is triggered. Check the below screen. It says, the job is in Ready status.

Now wait and watch!!! The moment the first job completes or cancels, the second job would immediately trigger.

Check both jobs are complete. Also, note job 2 began just after job 1 competed.

16

So next time if someone complains that he is getting an error “Job <Jobname> does not exist or does not have status ‘scheduled’/released'”, you know exactly how to guide him. Happy Sharing and Learning. 🙂

If you want to get practical issues and resolutions straight to your inbox, please SUBSCRIBE. We respect your privacy and take protecting it seriously.

If you liked this post, please hit the share button and also like us on facebook.

Thank you very much for your time!!

Share on Facebook29Share on LinkedIn2Tweet about this on TwitterShare on Google+1
Please Share!!

8 Comments on "How to Schedule dependent Batch job in sequence in SM36?"

  1. Yogesh Khemani | July 6, 2016 at 4:42 am |

    Very well explained. Good job!!

    • Thanks Yogesh. This was a simple topic but we realized lots of consultants really do not schedule jobs in sequence so they are not aware.

      Hopefully, this post would help them.

      Regards,
      Team SAPYard.

  2. Good and detailed Explanation!!!

    • Dear Narmda – Thank you so much. Glad you liked this topic and our presentation.

      Welcome to your blog.

      Regards,
      Team SAPYard.

  3. very good explanation guys.
    please correct me if i am wrong !. as of my understanding if we want to create dependent job so first job should be in the state of scheduled or released right? so .. then second job would be start after complete/cancelled of first job.. so we need to do manually release the first job? if not kindly explain the process of scheduled dependent jobs..!! where i do not want to release manually. hope you understand my question!

    warm regards:
    mahesh

  4. Hi,

    Very helpful post, indeed. Thank you.

    One question; if the first job is periodic, second job would be getting executed all the time when the first gets completed or cancelled status.

    ~Shoyeb

    • Dear Shoyeb – If the first job is period, the second job can run just once or in a periodic fashion as per the start condition you define.

      In the second job Start Condition, if you just hit After Job button and save, it would run only once.

      In the second job Start Condition, if you hit After Job button and then Date/Time and give a start date/end date and select the check box Periodic Job, then you can make your second job Periodic too.

      Please try and let us know for further question.

      Regards,
      Team SAPYard.

Comments are closed.