Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Lock Programs

Former Member
0 Likes
1,971

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,804

Thanks for reply. How can I create lock object for the program?

13 REPLIES 13
Read only

matt
Active Contributor
0 Likes
1,804

Yes. Use enqueue/dequeue. Search for locking programs and enqueue dequeue, you'll find the answer on these forums.

matt

Read only

Former Member
0 Likes
1,804

using ENQUEUE we can lock our programs...

wth dequeue we can do unlock..

Read only

Former Member
0 Likes
1,804

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

Read only

ThomasZloch
Active Contributor
0 Likes
1,804

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

Read only

Former Member
0 Likes
1,805

Thanks for reply. How can I create lock object for the program?

Read only

matt
Active Contributor
0 Likes
1,804

SE11

matt

Read only

0 Likes
1,804

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

Read only

0 Likes
1,804

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'

Read only

matt
Active Contributor
0 Likes
1,804

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.

Read only

0 Likes
1,804

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

Read only

0 Likes
1,804

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.

Read only

Former Member
0 Likes
1,804

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