Understanding SAP Lock Object Mechanism
Lock objects are a mechanism to control as to how the update takes place when more than one user is updating the data in the same table.
To create lock objects you will need two function modules.
This function module is used to generate a lock entry in the table making it only accessible to only one user. Incase, for any reason if the lock object function module is not able to lock the table. It will reflect in the return code.
This function module is used to release the locks.
Now, If you want to end up having different programs trying to update the same database table. To avoid problems code your database updates between 1 & 2.
There are basically two types of lock:
Types of Lock
Shared Lock : Is a read only lock that prevents the data from being changed when another user is reading it.
Exclusive Lock: Is a write lock that prevents data from being changed when another user is updating it.
COPYRIGHT SAP Database : Repository of all the freely available information on SAP.