-->

Thursday, October 26, 2023

SAP LOCKS FAQ


What is database locks?

The database lock exists only for the duration of the database LUW, in which the changes made in the SAP system are actually updated. Logical SAP locks must be set in dialog programs to prevent concurrent data accesses because set database locks may be implicitly removed before the changes have been made to the data

Life-Span of SAP Locks or Duration of SAP Locks

Locks remains set until you either call the corresponding DEQUEUE function module, or close the transaction with an implicit DEQUEUE_ALL. Saved locks inherited by the update task are loaded back into the lock table when the system is started up. Lock operations last for a few 100 microseconds in work processes in the lock server.

Where is the lock table stored?                                        

 In the main memory and shared memory of the enqueue server. All work processes in the enqueue server have access to it.

Can locks exist directly after startup?              
Yes, the saved locks, which were inherited by the update task, are reloaded to the lock table during startup.             

 

Are the locks in the lock table also set at the database level?        

Locks are not set on the database. The lock table is stored in the main memory of the enqueue server.

Is a lock table built if an enqueue work process is not started on the enqueue server in the instance profile?           
Yes, because the work processes on the enqueue server use the lock table directly, and not via the enqueue process. The latter is only responsible for lock requests from external application servers.  

How can I find out who is currently holding the ungranted lock? In other words, how can check the program after an ENQUEUE to determine which use is currently holding the lock so that I can let him or her know?                                  
When the ENQUEUE_Name function module is returned, the name of the lock owner is listed in SY-MSGV1.


What is Wild Cards in sap locks?

You can use special characters in your lock argument (especially the ‘at’ sign (@)). The ‘at’ symbol is used as a wildcard in SAP locks (enqueues). In other words, it can stand for any other character during collision checks. In order to prevent the wildcard mechanism from being activated in SAP locks when it is not required, you need to ensure when enqueue function modules are called that key value parameters do not contain any wildcard characters. If key values that you want to use to lock individual entities do contain wildcard characters, you have to replace the wildcards with different characters before the enqueue is called. 

 

Can I use special characters in my lock argument (especially the ‘at’ sign (@))?
The ‘at’ symbol is used as a wildcard in SAP locks (enqueues). In other words, it can stand for any other character during collision checks. For example, the parameter value 12345@ locks the quantities 123450 to 123459, 12345a to 12345z, and 12345A to 12345Z, and all other values with any special character in the 6th character position.               

 

What happens to locks when the enqueue server is restarted?

If they have not been saved to disk in the backup file, they will be lost. The locks that are inherited by the update task when COMMIT WORK is executed after CALL FUNCTION.. IN UPDATE TASK are saved to disk. The locks are saved to disk when the update request becomes valid, that is, with the COMMIT WORK. Each time the enqueue server is restarted, the lock entries saved on the disk are reloaded to the lock table. A lock is saved to disk at the point at which the backup flag is set.     

To get SAP Job Updates

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.