‎2008 Jul 16 10:03 AM
Hi,
What is the best way to lock a program? I have two program say progA & progB. If progA is executing then i should not allow progB from executing.
Is there is any way apart from maintaining a flag in table.
Thanks,
V
‎2008 Jul 16 10:21 AM
Thanks for reply. How can I create lock object for the program?
‎2008 Jul 16 10:05 AM
Yes. Use enqueue/dequeue. Search for locking programs and enqueue dequeue, you'll find the answer on these forums.
matt
‎2008 Jul 16 10:06 AM
using ENQUEUE we can lock our programs...
wth dequeue we can do unlock..
‎2008 Jul 16 10:08 AM
‎2008 Jul 16 10:09 AM
Hi
Go through the link given below :
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/lock%2band%2bunlock%2bprogram
or
a) Use R3trans and tp utilities with tp unlck and tp lock at the operating system.
b) Use transaction sm01 to find the transaction and lock/unlock it.
c) Run report rslocktrans from se38 and enter the variant value for the desired transaction and the lock/unlock checkbox.
d) Always use the ABAP workbench to lock transactions.
With Regards
Nikunj Shah
‎2008 Jul 16 10:10 AM
You could use lock objects ES_PROG or EPROG for dequeue/enqueue. Program A locks its own name, program B checks for an existing lock on program A.
These dependencies are hard coded though, maybe a custom table holding the dependencies is not such a bad idea after all.
Thomas
‎2008 Jul 16 10:21 AM
Thanks for reply. How can I create lock object for the program?
‎2008 Jul 16 10:26 AM
‎2008 Jul 16 10:29 AM
The lock objects exist already, in your programs you would just set and remove locks using those objects.
How do that exactly I will leave to your own spirit of research.
Thomas
‎2008 Jul 16 10:30 AM
I guess SE11 is only for lock database tables not for program.
Also I am looking to lock program while running not by 'Editor Lock'
‎2008 Jul 16 10:34 AM
I do understand what you are trying to achieve and this has been answered many times in the past. What I've attempted to do is give you hints, to help you find the answer yourself.
There is a lock object existing.
Use the enqueue/dequeue function modules for this lock object to lock/unlock your programs.
‎2008 Jul 16 10:37 AM
Thanks thomas .. I could achive with ENQUEUE_ES_PROG by passing the prgram name. But not sure why I am always getting sy-subrc = 1 (FOREIGN_LOCK) even though no other programs are running. any suggestions
‎2008 Jul 16 10:41 AM
It just dawned on me that while building this in DEV system, you will probably run into your own editor lock. Switch to display mode first or try the other object EPROG instead. As last resort you could create your own Z-Object as a copy of ES_PROG via SE11.
Thomas
Edit: don't forget to DEQUEUE at the end of the program.
‎2008 Jul 16 10:26 AM
Hi
To create lock object for program
if u goto-> attributes->edit lock it will lock ur program
but then also we can open the program by using sm12 T.code and press list click on the program that u want to unlock and press delete buttom than u can edit the program that all ready using
With Regards
Nikunj shah