Skip to Content
-2

Creating a background job that runs once per execution and cancel previous ones if needed

Dec 06, 2016 at 11:40 PM

102

avatar image
Former Member

Hi everyone:

I have a performance issue with SAP ECC in my company. My leader states that there's a way to enforce that a background job can run once and, if there's any running instances running at the time the new program starts, they'll cancelled.

I talked with my BASIS guy and told me that there's no such option in SAP ECC. Also investigated inside the application

Can you help me giving some light regarding this feature? I read several documentation regarding the background jobs creation and didn't found something helpful.

My current version is SAP ECC 6.0 SP 29. If you need more information please let me know.

I appreciate you help in advance. Warm regards

Lorenzo Martín Olmos

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Matthew Billingham
Dec 07, 2016 at 06:17 AM
3

Your Basis guy is right. There is no built in way of doing this, you have to do it programmatically. If your leader says there's a way, to why not asking him what the way is?

This is, in fact, a FAQ. You should search on how to ensure only one instance of a program runs at a time. The usual way is to check if another instance is running, and then abort - rather than start a new instance. You seem to want to do it the other way - at the start of the program, cancel any other running instances. That can also be done using similar techniques, but is a bit more unusual. It depends what the program actually does.

The clue in reaching an answer is to think about how you would like, logically, such a program to work. The figure out mechanisms that will allow this. Hint: in SM37, you can cancel jobs, so it must be possible programmatically...

Share
10 |10000 characters needed characters left characters exceeded
Phillip Morgan Dec 07, 2016 at 04:34 PM
1

Hi,

More than looking at the "SM37 mechanism", check out the function modules that create, launch and delete jobs.

...And how do you make sure that only one user is modifying a record? A lock. Put a lock when the job (or program) is running. Test it everytime. If there is already a lock, don't run. I think there is even a lock object for this. Else just create one...

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Dec 07, 2016 at 03:27 PM
-1

Hi Matthew and thanks for you comments

I asked my leader about this before, but didn't know how to accomplish that. The functionality was made by another programmer, but he doesn't work here anymore.

You're right, my approach is to ensure one instance of a program before the start of the program.

Let me dive a little about the SM37 mechanism to cancel jobs. I'll update as soon as I have any updates.

Thanks again for your comments.

Lorenzo Martin Olmos

Show 2 Share
10 |10000 characters needed characters left characters exceeded

So since that person left no one has access to the programs anymore? How are they maintained then? This story has so many holes...

+1 to Matthew and Philip. Before "diving" just stop for a second and understand what you are trying to achieve and what is the logic. It is a very, very, very bad idea to design a process with forcing a job to be cancelled. As Matthew correctly noted, if some job can only have one instance then it is enforced by not starting new instances, not by cancelling an existing one.

Also - is no one looking at the root cause of the performance issue? This seems like a band-aid to me. Maybe instead look into what is actually causing the issue.

1
Former Member
Jelena Perfiljeva

Well said :)

0