We are hiring and constantly growing! Have a look through our vacancies to find the right role for you!
SET LOCKS OF bdef
ENTITY bdef1 FROM inst1
$[ENTITY bdef2 FROM inst2$]
The long form of the SET LOCKS statement is used to exclusively lock instances of multiple RAP BO entities.
bdef must be a root entity followed by a list of locks grouped by individual entities. bdef1, bdef2, and so on, must be entities contained in the composition tree of the root entity bdef. The root entity itself can also be inserted in the position of bdef1, for example. Each part of the list specified after SET LOCKS OF bdef has the same syntax as the short form. At least one entry (ENTITY bdef1 FROM inst) must be specified. The root entity name in the position of the first statement, SET LOCKS OF bdef, must be the full entity name. bdef1, and so on, should be the entity alias names if provided in the BDEF. Using the full entity name will cause a warning. If the root entity is used in the list of operations, its alias name, if defined in the BDEF, should be used as well.
inst1, inst2, and so on, are internal tables specifying the instances that are to be locked. The tables must be typed with the
type TYPE TABLE FOR KEY OF. They can be constructed in an operand position using
constructor expressions, for example with the
value operator (VALUE) and other
constructor operators to fill the internal tables with instances as input parameters after the keyword FROM.
The program DEMO_RAP_EML_SET_LOCKS covers all forms of the SET LOCKS statement. It accesses a RAP BO using EML and creates several BO instances. A SET LOCKS statement follows that exclusively locks instances via the keys. The following SET LOCKS statement (long form) is used in the middle of the example:
The following image shows the global lock table (transaction SM12) during the transaction, before the ROLLBACK ENTITIES statement is executed. The newly created instances are locked. After the ROLLBACK ENTITIES statement is executed, the entries are automatically deleted from the lock table.IMAGE @@ABDOC_SET_LOCKS_2.png@@698@@62@@