‎2009 Oct 26 2:12 PM
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
‎2009 Oct 26 2:36 PM
I've used lock object ES_PROG for the same purpose in the past.
Thomas
‎2009 Oct 26 2:14 PM
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.
‎2009 Oct 26 2:19 PM
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.
‎2009 Oct 26 2:23 PM
>
> 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
‎2009 Oct 26 4:06 PM
if a report dumps you usually have more trouble than simply delete a table entry manually.
‎2009 Oct 26 5:57 PM
>
> 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
‎2009 Oct 26 2:36 PM
I've used lock object ES_PROG for the same purpose in the past.
Thomas
‎2009 Oct 26 4:17 PM
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...
‎2009 Oct 27 7:26 AM
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
‎2009 Oct 27 7:54 AM
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.
‎2009 Oct 27 4:21 PM
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