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

Restrict a user to execute multiple instances of a program simultaneously

Former Member
0 Likes
1,532

Hi ABAP Experts,

I want to restrict a user from executing more than 1 instance of a particular transaction (attached to a program) at the same time.

i.e. i need to check if the same user already has an instance of this program running then i need to restrict him/her from executing another instance untill 1st instance get completed.

Can i tbe done ? If yes please let me know the way to do it.

Waiting for helpful suggestions.

Thanks in advance,

Akah

Hi ABAP Experts,

I want to restrict a user from executing more than 1 instance of a particular transaction (attached to a program) at the same time.

i.e. i need to check if the same user already has an instance of this program running then i need to restrict him/her from executing another instance untill 1st instance get completed.

Can i tbe done ? If yes please let me know the way to do it.

Waiting for helpful suggestions.

Thanks in advance,

Akah

4 REPLIES 4
Read only

Former Member
0 Likes
1,017

U can do it using enqueue fm

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,017

Dear Jansi,

Can you please explain how we can achieve this using "ENQUEUE" FM?

BR,

Suhas

Read only

andrea_galluccio2
Contributor
0 Likes
1,017

Hi,

you can use IMPORT/EXPORT parameter id.

When your program start make an "import parameter from memory id". If it has a value, stop the program with a message, otherwise make an "export parameter to memory id" (so the memory will be set with a value and the next import instruction will return a value that will stop the program run. At the end of the program, make a "free parameter id" to clear memory area.

For more techical information about use import/export instructions, please referr to abap help.

If import/export instruction doesen't work very well, you could use a lock file. Create it when the application start and delete when it ends. At the very beginning of your program check if the file exists. If it exists, exit the program otherwise create it. Don't forget to delete it where the program ends.

Regards

Andrea

Read only

Former Member
0 Likes
1,017

Please look at transaction code (SM04) program name : RSM04000_ALV ..

In the perform build_list U get users and tcodes currently logged on in the system into internal table

usr_tabl .

Make use of this code in your program and check if the user is executing a partcular transaction more

than once ... If so write an Error message (Write this coding in Initialization)