
Stopping Cross-System Locks
Simple cross-system locks always terminate implicitly when the SAP LUW of the application terminates that requested the CSL. A CSL can also be stopped for multiple LUWs. To do this, the application program in the LUW generates a reference to the cross-system lock (a reference to the token), which is then transferred to an application program in another LUW. The CSL recognizes at the end of the update that there are still references to the token and rejects all requests from other applications that do not have a reference.
The LUW where the first CSL is requested is also called an initial LUW. The LUWs that receive the references are also called dependent LUWs since they are dependent on the initial LUW due to the business process. References are requested using the function module CSLEO_ADDREF.
A prerequisite for a cross-transaction lock is a lock request by the initial LUW (function module CSLEO_ENQUEUE) with PSCOPE=2 (standard lock duration until the update).
Using References
When a reference is assigned to a token, the CSL increases the counter for the token by one and sets the status of the token to REFD. The reference is assigned to the LUW of the application that requested the lock. The CSL recognizes from the counter at the end of the update that there are still references to the token. If the reference counter is larger than 0, the CSL remains.
That is why the cross-transaction lock is also called a reference counter mechanism.
To reset the counter, the assigned references have to be used. The application that created a reference must transfer it to another application (by RFC or as part of an IDoc message, for example). First, the application program has to transfer the reference to the CSL in the dependent LUW ( CSLEO_USEREF module). The reference then has authorization to lock the token using the CSLEO_ENQUEUE module. The dependent LUW can then request additional references, which it can transfer to other LUWs. The concept can be cascaded.
The CSL cannot remember the sequence in which the references were requested. This means that the references can be used in any sequence by dependent LUWs.