Database Lock(Open SQL Statement ) Vs. SAP Lock (Enqueue & Dequeue FM)


  Generally there are two lock categories offered by SAP ABAP.

1. DataBase Lock

2. SAP Lock

When any record is selected in update mode, an implicit lock is requested and if it is granted ( if no previous lock is there) then the same lock can be released by a DB LUW ( commit work / rollback work) or by a specific time interval out.

As most of the SAP GUI transaction consists a lot of screen navigation which may take more time which is subsequently grater than the time interval allowed for an implicit lock leading to data inconsistencies. So SAP Lock mechanism Enqueue and Dequeue FM can be a another choice  to maintain the data consistencies.


Step1. Create two programs as shown below: Put the debug points at specific points and execute the two report one after another from left and then right.

Step2. The left side program selects the record  in update mode which puts an implicit database lock on the record. Halt the left side program at the specific debug point so that the lock will be remain there and we can test any other program update query on the same record. Run the second program and the right side program reads the same record as of the left side program and when the update query will run by the right side program on the same record, the update query execution will be in the processing mode until unless the left side program remove the implicit lock by a commit work or rollback work or time out interval.


Step3. In this case also the two programs tries to select the record in update mode, if any program is executed first and puts a implicit DB lock on the record, the other programs select in update mode will be delayed until the lock is released by the first one.


 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s