If several users are competing to access the same resource or resources, you need to find a way of synchronizing the access in order to protect the consistency of your data.Example: In a flight booking system, you would need to check whether seats were still free before making a reservation. You also need a guarantee that critical data (the number of free seats in this case) cannot be changed while you are working with the program.Locks are a way of coordinating competing accesses to a resource. Each user requests a lock before accessing critical data.It is important to release the lock as soon as possible, so as not to hinder other users unnecessarily.Whenever you make direct changes to data on the database in a transaction, the database system sets corresponding locks.
The database management system (DBMS) physically locks the table entries that you want to change (INSERT; UPDATE, MODIFY), and those that you read from the database and intend to change (SELECT SINGLE
First, lock the data that you want to edit. Then read the current data from the database. In the next step, process (change) the data in your program and write this to the database. In the final step, release the locks that you set at the beginning.
MySAP technology RFC,BAPI,ALE and IDOC overview
MySAP new generation technologies overview
SAP cost,definition,authorization and architecture