2011 Feb 08 7:25 PM
Hi ABAPers.
I've created a Lock Object over a Z table. I want to know whether it's possible to check (querying at any table) if there's a lock entry and an open session of a certain user.That is, I want to know which tables I should access to know such info.
Kind Regards.
Santiago.
2011 Feb 08 7:37 PM
You can determine this yourself by running transaction ST05 in parallel with the transaction you are interested in.
Rob
2011 Feb 08 7:37 PM
You can determine this yourself by running transaction ST05 in parallel with the transaction you are interested in.
Rob
2011 Feb 08 8:09 PM
Hello Santiago
A more straightforward approach is to look at transaction SM12 which lists current locks and allows to delete them.
Regards
Uwe
2011 Feb 08 11:18 PM
Hi Santiago,
You can use function ENQUEUE_READ to determine if your custom table is locked.
Call the function as follows:
call function 'ENQUEUE_READ'
exporting
gclient = <client_id>
guname = RSTABLE
gname =
garg =
importing
subrc = subrc
tables
enq = enq
exceptions
others = 1.
Read the table ENQ to determine if there is an entry in the field GTARG with your custom table. The field GUNAME will hold the user whom has it locked.
Good luck,
Robert
2011 Feb 09 9:43 AM
Thanks for the info, Robert.
Would it possible to know info about a open session (without using FM) via SAP Tables? I cannot use such function modules 'cause no permissions for session management has been assigned.
Kind Regards.
Santiago.
2011 Feb 09 11:16 AM
Hello Santiago,
I don't think that the lock data is stored in some database table, it is held in shared memory at runtime as long as the application server is running. I am not sure if SAP provides a ready-made solution for that, but you can definitely create a custom ABAP program where you can use the FM provided by SAP to read the lock data
Go to this link in the SAP Documentation. It contains the detailed and easy-to-understand explanation of the SAP Lock Concept. It also tells you why some of the most common problems with locks occur and how they can be tackled.
http://help.sap.com/saphelp_erp2004/helpdata/en/37/a2e3ae344411d3acb00000e83539c3/frameset.htm
2011 Feb 09 4:27 PM
Hi Santiago,
I checked transaction VA42 and locked it myself in one session and opened it in another. It shows my name in the message as the user having it locked after it was unable to lock the contract using ENQUEUE_EVVBAKE.
The documentation confirms this:
"To determine in a program which user is currently holding a lock, use the ENQUEUE_ function module. This function module puts the name of the owner into SY-MSGV1. "
So create your own lock object for the custom table and add it the ENQUEUE_<custom table> to your program.
Kind regards,
Robert
2011 Feb 11 7:18 PM
Hi,
.But it uses VIEW_ENQUEUE to check the locks.
So SAP does tracks locks by sessions.
or
SM12 gives a list of all LOCKS at an instant for each user and session names also.
and use fm ENQUEUE_READ. it is giving all locked entries including current sesstion.