on 05-02-2014 1:11 PM
Hello SCN,
I have the following problem. I have a program that should start when an event is raised. For that I created a periodic job waiting for the event (start condition is after event). I thought that when I then raise the event using cl_batch_event=>raise, this job that was parked in SM37 would switch to "Active". That is sort of happening. But...
My program should always run in maximum one instance. Either one instance or parking off in SM37. Unfortunately when I call cl_batch_event=>raise, it creates a new instance of the job with status "Released" and activates the previous job into status "Active". Even if no job for that event is defined, it creates this job for me. This means the job is replicating itself over time and eating system resources, causing problems with concurrent access to the DB etc.
I understand I have no control over the kernel functionality in cl_batch_event=>raise, but is there anything I can do about this? I have coding in place that should prevent all of these problems (and I would swear it worked until recently), but cl_batch_event=>raise creating a job is for me surprising and suspicious. Is there either a way how to control this or has anyone else experienced that before?
Cheers Otto
It may help if you post the parameters used under the cl_batch_event
Regards, JP
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi JP
CALL METHOD cl_batch_event=>raise(
EXPORTING
i_eventid = 'Z_MYEVENT'
i_eventparm = lv_param
Z_MYEVENT of course exists in SM64.
Not sure if that helps but the system has two application servers. On the other hand the two servers were there during the period when I would have said it worked just fine.
Cheers Otto
Something definitely stinks here. I have been testing it now and the last execution of the program it started three copies of the job (although there was no job sitting there waiting for the event). My primary concern is how is this possible that jobs land in my SM37 out of thin air.
If this was some dead wood from the past it would be spawning itself all the time, not only when I raise my event, right? If I now go and cancel + delete all the instances to start over, nothing would move in the system until I raise my event again. Never heard about it before.
cheers Otto
So what I've done:
a) I've configured SM62 and can see when my event is being raised
b) I cleared everything in SM37 for my event, which means there are no scheduled, released, ready or active jobs related to my event.
c) I went to SE24 for cl_batch_event=>raise and using F8 single tested my event. I got a line in SM62 where the details say:
Number of Jobs 1
Event Status New
Processing Status OK
My question is: I have no job waiting for the event. SM62 says there is one. When I then go and check SM37, I can see a job with name = program in the job, status = "Released"which is not doing anything. Is this correct? Can this be explained? (In case I didn't get the documentation right).
cheers Otto
Ok,,, this is a simple example of how it should work.,
Scheduling background job by triggering an event - ABAP Development - SCN Wiki
Maybe the problem is that you have made the job periodic....
Regards, JP
I went through that wiki a couple of times already. As well as numerous SCN threads and help.sap.com pages. Also through the OSS notes on cl_batch_event or notes that you advised others to read. Again: I have killed every possible thing linked to my event, nothing is active. When I go to SM62 and trigger the event from there by clicking on a History line and then button "Trigger event", I get a new job in SM37 in status "Released". Is that known or documented that triggering an event creates a job?
I appreciate your help, JP, really. I am only afraid that the info sources around only deal with the ideal case when things work. I haven't found anything deep for troubleshooting or for explanation how this works on the inside.
cheers Otto
Evening JP.
Thanks for your help today!
We found out what it was. It was a crow's nest of job programs submitting more jobs and I missed an instance. It had a different program name in the job step (a copy of the productive code for experiments) which was sitting there the whole time adding instances "out of thin air". My fault.
Thanks again.
cheers Otto
p.s.: Lesson learnt: If it is a development problem, blame the developer
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.