09-14-2005 4:14 PM
I'd like to determine if a particular transaction is running and then terminate it.
The functionality I'm looking for is similar to transaction SM04 where you can terminate a transaction by user.
09-14-2005 4:26 PM
Search for function starting with TH* (like TH_DELETE_MODE) but I am not sure if I would trust that every transaction exits gracefully - especially concerning update processes.
Christian
09-14-2005 4:33 PM
Agreed. We'll certainly check for that.
The exact problem that we have is that we don't want a particular transaction to be active/available when a certain batch job is running.
Making the transaction unavailable for start-up seems pretty straight forward. It's finding the active occurances and terminating them that seems to be more difficult.
As of now, I don't know if terminating the transaction will be graceful or not. But, I'd like to try it.
09-14-2005 4:27 PM
09-14-2005 4:47 PM
Look at this thread. I have posted a program there. But please be carefule about the pitfalls in that.
Instead, how about locking the transaction before the batch job and unlocking it after, instead of trying to terminate it? Also, you need to consider other ways that would hinder your job. If the transaction is VA01, even if you stop it from executing, how will you monitor all those other ways that will create a sales order like via EDI or via RFCs or through custom programs etc?
Regards,
Srinivas
09-14-2005 5:03 PM
Thanks. I've discovered how to prevent new startups of the transaction.
What I need to do is end any active sessions before the batch job starts.
09-14-2005 5:08 PM
Instead of ending, may be you should just wait until the transaction is completed and then start the job.
Let us say you have a program that monitors if the transaction is running. If it is running, then it just goes into a loop until the transaction has ended. Since you are stopping any new ones becoming active, you only will wait until the active ones are done. Once done, the execution of this program ends. Your batch job, should have this program as a predecessor step.
Srinivas
09-14-2005 4:52 PM
Hi
You cannot catch a tcode but with Function TH_WPINFO you can catch if a program related to tcode is running.
You can cancel the program . See the code in subroutine
PROG_EXIT in program RSMON000_ALV .
Otherwise you can use tcode SM50.
Cheers
09-14-2005 5:32 PM
Yes, the SM04 transaction seems to use the 'TH_DELETE_USER' function.
Or maybe you could try to directly call the routine <b>DELETE_USER</b> in the RSM04000_ALV ?
09-15-2005 6:07 AM
Hi
Active programs can be cancelled from SM50 Program/Mode -> Program -> Cancel. you can leverage the code here .
If answers were helpful reward and close the thread.
Cheers
09-15-2005 1:02 PM
You could use EXIT_SAPLSABE_010 to avoid that a user can start a report (of type 1). In this exit you could check if your batch program is running.
I am sure there is something similar for modul pools as well.
Christian
09-15-2005 11:39 PM
If these answers helped you, please reward and close the post.
Thanks,
Srinivas