You can release SAP locks by deleting the corresponding entry in the lock table.
When you set an SAP lock using the ENQUEUE function module, the value transferred to the _SCOPE entry parameter determines the lock duration. Depending on the formal parameter _SCOPE, you can release an SAP lock as follows:
- If _SCOPE is set to 1, the lock is not linked to the current SAP LUW. You can release the lock either by calling the DEQUEUE function module whose formal parameter _SCOPE can have any value, or by terminating the program.
- If _SCOPE is set to 2, the lock is linked to the current SAP LUW. In case CALL FUNCTION … FOR UPDATE TASK has registered at least one update function module, the statement COMMIT WORK or ROLLBACK WORK releases the lock upon completion of the SAP LUW. When using COMMIT WORK, the update function releases the lock after processing the update function modules. This type of lock may persist beyond the end of a program until the update procedure has been completed.
- If _SCOPE is set to 3, both the update function and the program must release the lock. The update function releases the lock as if _SCOPE had a value of 2. The program releases the lock as if _SCOPE had a value of 1. The entire release procedure is specified by the last user who released the lock.
If you want to release an SAP lock using the DEQUEUE function module independent of the update function, you must transfer a value to the formal parameter _SCOPE that is greater than or equal to the value transferred to the parameter of the same name for the ENQUEUE function module.
Besides the _SCOPE parameter, the entry parameters of a DEQUEUE function module correspond to those of the ENQUEUE function module. You can then use the additional parameter _SYNCHRON to specify whether the release of the lock should be delayed until the program processing continues.
No comments:
Post a Comment