Locking and Unlocking Services in
CAF
You must lock and unlock services to prevent modification of data either during data or delta loading on the CAF Core side. You prevent the change of data by declaring service locking or unlocking at the SAP BW end.
You use a functional module at the SAP BW end and a stateless session bean from the J2EE engine end to initiate the lock and unlock process. You invoke locking and unlocking of services remotely with a remote function call (RFC) destination pointed at the J2EE server. The RFC in return provides its implementation parameters.
You define the signature of the functional module RSCAF_TABLE_REMOTE_LOCK for remote invocation of the J2EE server in scope of the SAP BW process chain. The functional module is used to import the lists of CAF Core interfaces.
CAF Core services and persistency tables outside of these interfaces will be locked or unlocked depending on the I_LOCK_FLAG import parameter value. The following table lists the parameter values of the functional module RSCAF_TABLE_REMOTE_LOCK:
Parameter |
Type |
Associated Types |
I_BEI_LIST |
Importing |
RSCAF_BEI_TABLE |
I_LOCK_FLAG |
Importing |
RSCAF_LOCK_FLAG |
For ABAP types, RSCAF_BEI_TABLE is type table with RSCAF_BEI as type line. The following table lists the structure of the transparent table RSCAF_BEI.
Field Name |
Type |
Length |
Description |
E_VENDOR |
Char |
30 |
Application vendor name for the entity service |
E_APPLICTION |
Char |
30 |
Application name, which contains the entity service |
E_NAME |
Char |
30 |
Entity service name. |
The RSCAF_LOCK_FLAG has a character (CHAR) length of 1. Use the values listed in the table below to define lock status.
Table Value |
Status |
Table Interface |
0 |
Locked |
RSCAF_BEI_TABLE |
1 |
Unlocked |
RSCAF_BEI_TABLE |
CAF and SAP BW integration uses a stateless session bean that is registered under the JNDI name of CAF_TABLE_REMOTE_LOCK on the J2EE engine. The RSCAF_TABLE_REMOTE_LOCK bean is then declared and implemented with a process function method:

void processFunction (com.sap.mw.jco.JCO.Function func )
This method receives the RFC invocation for locking or unlocking database tables and CAF Core services. The list of tables is calculated based on the list of CAF Core services provided by the I_INTERFACE_LIST input table and metamodel repository (MMR) metadata.
A lock on the enqueue server has the transaction lifecycle of RSCAF_TABLE_REMOTE_LOCK which sends a JMS message with sufficient information for lock creation. A message drive bean (MDB) should be prompted by such a message.

After receiving a lock message, the MDB creates a lock for specified tables via locking APIs and creating a logical lock for CAF Core services. It then sends either a confirmation or fail message to the requestor and waits for the unlocking message trigger.
When an RFC for unlocking is entered into the RSCAF_TABLE_REMOTE_LOCK bean, a JMS message to unlock the service is sent to the MDB. The MDB in turn unlocks the specified table, makes logical unlocks for CAF services and sends a confirmation message.
Setting Up Locking and
Unlocking (CAF Core Configuration Guide)