Skip to Content
Personal Insights

Multiple jobs created at once

Hi,

Have you ever had the need to create 80+ jobs in your productive system (or not :P) that have to run one after the other non-stop until the end? More precisely 2 jobs/month, every month for 4 years .. that’s 96 jobs πŸ™‚

Agreed, it’s not your everyday request, but it’s still some 4h+ of work, let alone create all the 96 variants to the transaction.

What if you could make them at the touch (click) of a button?

 

Said and done πŸ™‚

 

The issue with the manual work is that it’s not only tedious but prone to human errors since the name of the variants isn’t that long and 1 character can change everything. Also, since SM36 has a bug that doesn’t allow you to create one job after the other without exiting the transaction, there is a “/nSM36” that breaks the process … every time πŸ™

Since I already created an excel file with all the variants that need to be created for the current transaction, I figured I can use that as input to my new bright idea.

The input data is something like this:

In my case, job name and variant name are identical, but you can easily use this transaction to create multiple jobs, even if they are not dependent on each other or, in case of SM36 transaction restrictions, offer this option. It was just easier for me like this.

I also added the “Predecessor job name” column, to tell the program that the current job created has to be started after the previous “one” ended (with success or error, not specified).

Once all details are filled in, it’s only a matter of pressing “” to create all the jobs.

Before:

After:

Fortunately, SM36 provides most of the error messages, so I didn’t have to process them, including the checks for variant and program name (above you can see the variant check and below you can see the program check):

But I had to do some checks when deleting the job created. For one, if the job(s) were aborted for a reason or another, you shouldn’t lose the log, so the program will not delete the already processed (successfully or not) job, or the active one, only the ones that aren’t started yet.

Since Murphy’s law is a .. law … if something can go wrong, it will πŸ™‚ so … after a few jobs successfully finished, I had an error and all subsequent jobs where aborted. Ergo, I had to delete the remaining 80+ jobs and recreate them, and then restart them to finish them off.

All the time was spent well πŸ™‚

Good learning exercise.

 

PS: You can ignore the first colors of the first column. It was an example of all the colors that the ALV can show.

5 Comments
You must be Logged on to comment or reply to a post.
  • Sorry, I don’t get it… Did you mean to share the ABAP code / Github link or something? Maybe I missed it but what is the connection between the spreadsheet and SM36 here? I’m confused…

    • Hi Jelena, not necessarily, but if enough people want it I can share it someway.

      Excel was used by me to track all the job names that I had to create, all 96 of them, since the names were to easy to confuse and mistake if you write all of them by hand all the time.

  • I don’t remember of a bug which forces to exit SM36 while creating 2 chained jobs.

    Next exercise: show a custom application which creates the program variants in bulk.

    • Sounds good. The only downside is that from what I know now, it can’t be general or dynamical. It depends on your screen elements. But I’ll look into it.

      Thank you for your feedback.

    • I was also confused by that statement because I’ve definitely used SM36 to create multiple jobs in a row. Just checked in our EHP6 system and it looks like you can create a new job without exiting but SM36 simply doesn’t clear some (global, I assume πŸ™‚ ) data, so after you type in the new job name and go to the step definition screen, it shows all the information from the previous job there instead of a blank screen, as I’d expect.

      This could be a bug or a feature as it can actually be handy if a new job is created with the same step(s) but a different variant, for example.

      But otherwise there is nothing preventing one from creating a new job without leaving the transaction, at least in our release.