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 program access

Former Member
0 Likes
1,215

Hi Experts,

Is there is any way to assign the memory id for any custom program?

My req. is if user A executes ZABC program & at the same time if user B trying to execute the same program then user B will get an error message that "Currently user A is executing the program."

Can anybody will suggest me how to do that?

Regards,

Neha

1 ACCEPTED SOLUTION
Read only

ThomasZloch
Active Contributor
0 Likes
1,167

I've used lock object ES_PROG for the same purpose in the past.

Thomas

10 REPLIES 10
Read only

Former Member
0 Likes
1,167

Read up on locking mechanism for database records and then be creative to apply something like that on porgrams.

Or.... search SDN. I'm pretty sure this question was asked many times before.

Read only

former_member226519
Active Contributor
0 Likes
1,167

create a simple table with fields REPORT and UNAME

when the report starts read this table first.

if there is an entry for your report stop running the report.

if there is no entry write report and user name to that table.

at the end of your report delet the table entry.

Read only

0 Likes
1,167

>

> create a simple table with fields REPORT and UNAME

> when the report starts read this table first.

> if there is an entry for your report stop running the report.

> if there is no entry write report and user name to that table.

> at the end of your report delet the table entry.

What does the user do if the program terminates abnormally (dumps) without deleting the entry?

Rob

Read only

0 Likes
1,167

if a report dumps you usually have more trouble than simply delete a table entry manually.

Read only

0 Likes
1,167

>

> if a report dumps you usually have more trouble than simply delete a table entry manually.

Not necessarily - anyway, an entry in a custom table is the wrong way to approach this. SAP has a locking concept and I don't know of a better way to do this.

Rob

Read only

ThomasZloch
Active Contributor
0 Likes
1,168

I've used lock object ES_PROG for the same purpose in the past.

Thomas

Read only

Former Member
0 Likes
1,167

if its about background processing its very easy to find out. (from tables like tbtco,tbtcp, v_op).

but if its foreground execution that also depends upon its an active session or not.. if active session then i have already explained in your other thread:

==>you have not closed that thread yet or the thread

if its about running at random cases .. then you need to store some flag in some z table or pass some value to some unused parameter values...

Read only

0 Likes
1,167

Hi Prakash,

Actually that earlier thread still not solving my purpose. My req. is if A user executes the program then at the same time user B won't be able to execute the program.

User B will get message that "Currently program ZABC is used by user XYZ".

Thanks,

Neha

Read only

0 Likes
1,167

Hi,

1. Try with SAP Standard function modules to lock and unlock the program.

2. If you want to maintain custom table, set a flag and update if the execution is successful. Otherwise rollback the updates.

Regards,

Shiva.

Read only

0 Likes
1,167

neha,

that is what exactly i gave in the thread

the last write statement will happen if the tcode is running by some other user.. in place of that write statement you can put a error message or info message and exit the program