2010 May 27 10:26 AM
Hi,
I have a table T and two programs P1 and P2. P1 sets a lock on table T and P2 has a simple MODIFY statement to insert/update data in T (no locking).
I executed P1 till the call to the enqueue function module and then had the program wait in debug mode. In another session, I executed P2. What I saw was that P2 had updated T inspite of the lock issued by P1.
On the other hand, when I tried to issue a lock on T from within P2, it failed (since P1 had already locked the table).
Is this normal behaviour?
2010 May 28 9:24 AM
Assuming that you called some ENQUEUE* function module the answer is, yes, this is normal behavior. I strongly recommend reading up on the [SAP lock concept|http://help.sap.com/saphelp_nw70ehp2/helpdata/en/41/7af4c5a79e11d1950f0000e82de14a/frameset.htm] (that's the short version for ABAP programmers, but I'd also recommend the long version of [SAP lock concepts|http://help.sap.com/saphelp_nw70ehp2/helpdata/en/47/df116e6abf296fe10000000a42189b/frameset.htm]). SAP locks are logical locks and as such rely on the application that a lock is set.
2010 May 27 10:44 AM
Hi,
There is table T having p1 and p2 2 lock object.
When any one of ther put lock for modification other should not modify data but he can read data using that lock object.
I think your program you should check before modify table check it is locked or not .
Generally you create one lock object per table table .
Rgds
Ravi Lanjewar
2010 May 27 10:51 AM
I might be completely wrong here... But it could also be that being in debug mode allows the update. Sometimes in debug mode things work, that don't work when not debugging... Try it with a wait (for 600 seconds) in the first program. And see if program 2 still updates the table.
It could also be the extent of the locking. Do you lock the complete table or the record that will be modified (or is it a new record)? If the complete table is locked, then an update/insert/modify should not be possible.
2010 May 28 9:24 AM
Assuming that you called some ENQUEUE* function module the answer is, yes, this is normal behavior. I strongly recommend reading up on the [SAP lock concept|http://help.sap.com/saphelp_nw70ehp2/helpdata/en/41/7af4c5a79e11d1950f0000e82de14a/frameset.htm] (that's the short version for ABAP programmers, but I'd also recommend the long version of [SAP lock concepts|http://help.sap.com/saphelp_nw70ehp2/helpdata/en/47/df116e6abf296fe10000000a42189b/frameset.htm]). SAP locks are logical locks and as such rely on the application that a lock is set.
2010 May 28 9:42 AM
What Harald said. You have to check in P2 with an ENQUEUE call, whether a lock has been set or not.