RAP Authorization, Locking and Concurrency
|
This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production. |
Two questions come up the moment more than one person uses a business application. The first is who is allowed to do what: a clerk may create an expense claim, but only a manager may change a claim that is already submitted. The second is what happens when two people work on the same claim at the same time: without a rule, the person who saves last silently throws away the work of the other. The RESTful Application Programming Model (RAP) answers both questions inside the behavior definition of a business object. This page explains the three tools it offers, authorization control, optimistic concurrency control with an entity tag (ETag) and pessimistic concurrency control with locks, and how to write them for the expense claim of the running example. It is written against ABAP for Cloud Development release 9.20 (2608), where RAP is the standard way to build transactional applications; it applies to ABAP Cloud, and the ABAP platform releases that support RAP use the same concepts. The listings need a RAP framework, a database and ABAP development tools, so each one is labelled as requiring an SAP system and was not run here.
Before you read
-
Behavior Definitions and Implementations: the header lines
lock master,authorization masterandetag master, the behavior pool and the handler class that this page fills with code. -
Managed and Unmanaged Business Objects: who provides locking and ETag handling in each implementation type.
-
Entity Manipulation Language (EML):
READ ENTITIESand the additionIN LOCAL MODE, which the authorization methods use. -
Lock Objects and the SAP Lock Concept: what an enqueue lock is, because RAP locking is built on it.
-
CDS Access Control: how read access is restricted, because RAP authorization control covers only changes.
Key terms
-
Authorization object: a named set of authorization fields that the system checks against the authorizations in the user master record, for example with
AUTHORITY-CHECK OBJECT. -
Global authorization: a check that depends only on the user and the operation, not on a particular claim.
-
Instance authorization: a check that also depends on the data of one instance, for example the status of the claim.
-
Optimistic concurrency control: nobody is blocked; a change is accepted only if the data is still in the state the client has seen, which an ETag proves.
-
ETag: a field whose value changes whenever an instance changes, so that a stale change request can be recognized.
-
Pessimistic concurrency control: the instance is locked while one user changes it, and every other change request is rejected until the lock is gone.
-
Lock master: the entity, always a root, whose instance is locked when any of its dependent entities is locked.
Three separate questions
RAP keeps three concerns apart, and mixing them up is the most common source of confusion.
| Concern | Question it answers | Where it is decided |
|---|---|---|
Read access |
Which claims may this user see? |
CDS access control (DCL) on the view entities, not in the behavior definition. |
Authorization control |
May this user create, change, delete or run an action on this claim? |
The behavior definition declares it, the behavior pool implements it. |
Feature control |
May this operation or field be used right now, given the state of the claim? |
The behavior definition and handler methods of kind |
Concurrency control |
What if another user changes the same claim at the same moment? |
ETag (optimistic) and lock (pessimistic), declared in the behavior definition. |
Source: RAP: Authorization Control
The RAP guide draws the line between authorization and feature control as follows. Authorization is relevant whenever the permission to execute an operation depends on the role of the consumer. Feature control depends on the state of existing instances or on factors outside the business object that do not relate to the user. The two are often combined: the guide’s example is an action that can be run only for instances that are not yet booked (feature control) and only by users who have a specific role (authorization).
The running example
The page builds on the expense claim of the earlier RAP pages: the root view entity ZI_ExpClaim with the composition _Items and the child ZI_ExpItem with the association _Claim. Concurrency control needs a field that changes with every edit, and the claim of the running example does not have one yet: its table ZEXP_CLAIM has an included audit structure with created_by and created_at only. This page therefore extends the claim by one timestamp field, local_last_changed_at, in the table and as the element LocalLastChangedAt in the view entity. That field, the status codes and the rules below belong to the example and are invented for it.
Authorization control
Global and instance authorization
RAP offers two kinds of check. The Keyword Documentation describes them like this:
-
Global authorization limits access to data or the permission to perform an operation for the whole business object, independent of individual instances, for example depending on user roles. It can be specified for create, create by association, update, delete and for actions and functions, static ones included.
-
Instance authorization depends on the state of an entity instance. It can be specified for create by association, update, delete, instance actions and instance functions. It is impossible for a plain create and for static actions, because a check on an instance needs the key of that instance, and those operations have none.
Global authorization is the first check on an incoming request. The RAP guide points out that it can reject a request before the request reaches any other method of the behavior handler classes. A typical global rule is "only users in the claims role may create claims"; a typical instance rule is "a submitted claim can no longer be changed by its owner".
The guide adds one limit that matters for design. The authorization methods run before the actual change and see only the state of the business object before the request, the so-called before image. They cannot check the incoming values. A rule such as "an employee may not file a claim above a given amount" needs a precheck, described further down.
Declaring it in the behavior definition
Every entity of a business object is either an authorization master or authorization dependent. The root entity must be a master. The master names the kind of check in brackets; a child follows its master with authorization dependent by and the association that leads to it.
| Declaration | Meaning |
|---|---|
|
Global checks only. The method |
|
Instance checks only. The method |
|
Both. Instance-based operations pass the global and the instance check, and both methods must be implemented. |
|
No authorization checks for the whole business object; no authorization methods can be implemented. |
|
The child uses the authorization control of its master. Requests are delegated to the master’s implementation. |
For update, delete and create by association on a dependent entity the check for update of the master is used. The default for an operation can be replaced one operation at a time with these additions: authorization:none, authorization:update, authorization:global and authorization:instance. The documentation’s example is a business object whose master is protected by instance checks while one action is protected by a global check, or none at all.
The expense claim now becomes a business object with an ETag and a status-dependent rule. The lines that are new compared with the earlier page are the ETag and lock lines, the timestamp field and authorization master ( global, instance ).
managed implementation in class zbp_i_expclaim unique;
strict ( 2 );
define behavior for ZI_ExpClaim alias Claim
persistent table zexp_claim
lock master
authorization master ( global, instance )
etag master LocalLastChangedAt
{
create;
update;
delete;
association _Items { create; }
field ( readonly : update ) ClaimId;
field ( readonly ) Status, LocalLastChangedAt;
action submit result [1] $self;
}
define behavior for ZI_ExpItem alias Item
persistent table zexp_item
( lock, authorization, etag ) dependent by _Claim
{
update;
delete;
field ( readonly ) ClaimId;
field ( readonly : update ) ItemNo;
association _Claim;
}
Source: Keyword Documentation: RAP - Authorization, Keyword Documentation: RAP - etag, Keyword Documentation: RAP - Locking, Keyword Documentation: RAP - SyntaxShortForm and abap-platform-rap100: travel BDEF with etag master, lock master and authorization master. This listing requires an SAP system; not run here.
Reading it: the header of the claim says that it is the lock master, the authorization master for global and instance checks, and the ETag master with the field LocalLastChangedAt. The item entity uses the syntax short form that the documentation provides: ( lock, authorization, etag ) dependent by _Claim stands for the three separate dependent by declarations, and it is valid because all three masters are the same entity, reached through _Claim. The association _Claim must also exist in the CDS data model. The mapping blocks, the determination and the validation of the earlier page are left out here to keep the lines about authorization and concurrency visible; they stay in the real definition. The field is marked read-only because, as the documentation recommends, the framework maintains it.
The global authorization method
For authorization master ( global ) or ( global, instance ) the behavior pool needs a handler method of kind FOR GLOBAL AUTHORIZATION. Its shape is fixed: an importing parameter REQUEST that says which operations are being asked about, and a RESULT structure to fill in. SAP’s own samples declare it exactly like this, with the entity alias after FOR:
CLASS lhc_claim DEFINITION INHERITING FROM cl_abap_behavior_handler.
PRIVATE SECTION.
METHODS get_global_authorizations FOR GLOBAL AUTHORIZATION
IMPORTING REQUEST requested_authorizations FOR Claim RESULT result.
METHODS get_instance_authorizations FOR INSTANCE AUTHORIZATION
IMPORTING keys REQUEST requested_authorizations FOR Claim RESULT result.
ENDCLASS.
Source: Keyword Documentation: FOR GLOBAL AUTHORIZATION, RAP Handler Method, Keyword Documentation: FOR INSTANCE AUTHORIZATION and abap-cheat-sheets: handler class of the unmanaged BO, methods get_global_authorizations and get_instance_authorizations. This listing requires an SAP system; not run here.
The method name is free; get_global_authorizations is the name the samples use. The Keyword Documentation adds that authorization handler methods should be implemented with AUTHORITY-CHECK OBJECT, the statement that asks whether the current user’s authorizations allow a request. Its result for each operation is one of the constants if_abap_behv=>auth-allowed and if_abap_behv=>auth-unauthorized, which belong to the structured constant IF_ABAP_BEHV=>AUTH that the documentation lists for authorization results.
In the example, the authorization object ZEXP_CLM with the field ZEXP_OP is invented for this page: its values CREATE, CHANGE and DELETE say which operation a role may perform. Real authorization objects mostly use the standard field ACTVT, the activity; the Keyword Documentation’s example for AUTHORITY-CHECK uses the activity code 03, which it explains as the activity display. Creating an authorization object and assigning it to roles is done in the authorization administration of the system and is not a RAP topic.
METHOD get_global_authorizations.
IF requested_authorizations-%create = if_abap_behv=>mk-on.
AUTHORITY-CHECK OBJECT 'ZEXP_CLM' ID 'ZEXP_OP' FIELD 'CREATE'.
result-%create = COND #( WHEN sy-subrc = 0
THEN if_abap_behv=>auth-allowed
ELSE if_abap_behv=>auth-unauthorized ).
ENDIF.
IF requested_authorizations-%update = if_abap_behv=>mk-on.
AUTHORITY-CHECK OBJECT 'ZEXP_CLM' ID 'ZEXP_OP' FIELD 'CHANGE'.
result-%update = COND #( WHEN sy-subrc = 0
THEN if_abap_behv=>auth-allowed
ELSE if_abap_behv=>auth-unauthorized ).
ENDIF.
IF requested_authorizations-%delete = if_abap_behv=>mk-on.
AUTHORITY-CHECK OBJECT 'ZEXP_CLM' ID 'ZEXP_OP' FIELD 'DELETE'.
result-%delete = COND #( WHEN sy-subrc = 0
THEN if_abap_behv=>auth-allowed
ELSE if_abap_behv=>auth-unauthorized ).
ENDIF.
ENDMETHOD.
Source: Keyword Documentation: %global, with the method get_global_authorizations of BP_DEMO_MANAGED_ROOT_REPORTED, Keyword Documentation: AUTHORITY-CHECK OBJECT and Keyword Documentation: Constants for BDEF Derived Type Components. This listing requires an SAP system; not run here.
Reading it: the structure requested_authorizations has a flag per operation, set to if_abap_behv=>mk-on for the operations that the framework wants an answer about. The method checks only those and sets the matching component of result. The documentation’s sample does the same with a variable instead of an authorization object, and also fills reported-%global to attach a message; a message here is optional. sy-subrc = 0 is the success code of AUTHORITY-CHECK OBJECT. An empty method, as in the SAP samples, means that every user is authorized.
The instance authorization method
The instance method receives the keys of the claims in question and returns one line per claim, saying whether update, delete or an action is allowed on that very claim. In the example a claim that has been submitted (status S) can no longer be changed or deleted. The pattern below follows the sample of the cheat sheet, which reads the field it needs and then sets %op for each requested operation.
METHOD get_instance_authorizations.
READ ENTITIES OF ZI_ExpClaim IN LOCAL MODE
ENTITY Claim
FIELDS ( Status )
WITH CORRESPONDING #( keys )
RESULT DATA(claims)
FAILED failed.
CHECK claims IS NOT INITIAL.
LOOP AT claims ASSIGNING FIELD-SYMBOL(<claim>).
IF requested_authorizations-%update = if_abap_behv=>mk-on.
APPEND VALUE #( %tky = <claim>-%tky
%op = VALUE #( %update = COND #( WHEN <claim>-Status = 'S'
THEN if_abap_behv=>auth-unauthorized
ELSE if_abap_behv=>auth-allowed ) )
) TO result.
ENDIF.
IF requested_authorizations-%delete = if_abap_behv=>mk-on.
APPEND VALUE #( %tky = <claim>-%tky
%op = VALUE #( %delete = COND #( WHEN <claim>-Status = 'S'
THEN if_abap_behv=>auth-unauthorized
ELSE if_abap_behv=>auth-allowed ) )
) TO result.
ENDIF.
ENDLOOP.
ENDMETHOD.
Source: abap-cheat-sheets: method get_instance_authorizations of the unmanaged BO and Keyword Documentation: %op. This listing requires an SAP system; not run here.
Reading it: READ ENTITIES ... IN LOCAL MODE reads the status of the requested claims without triggering authorization and feature checks again, which would otherwise call this very method in a loop. %tky is the transactional key that ties each result line to its claim. Instance authorization applies to update and delete here; the BDEF would use authorization:instance to apply it to an action as well, and the Keyword Documentation says it cannot be used for internal or static operations. If an instance should be reported as failed, the method has the implicit parameter failed for it, and the Keyword Documentation’s example for %fail assigns the cause UNAUTHORIZED for that case.
Two further tools complete the picture.
-
IN LOCAL MODE. The Keyword Documentation states that the EML additionIN LOCAL MODEcan be used to skip authorization control. That is why a determination or a validation of the business object itself can change data without being blocked by the checks of the user who triggered it, and why code outside the business object must not use the addition to get around a check. -
GET PERMISSIONS. A consumer can ask in advance what it may do, instead of trying and failing. The statementGET PERMISSIONS ENTITY entity [FROM keys] REQUEST request RESULT result_tabretrieves global and instance authorization as well as feature control; it makes the runtime call the authorization and feature methods of the provider.
Prechecks: checking against incoming values
Because authorization methods see only the data before the change, the RAP guide offers the precheck for rules that depend on what the user typed. A precheck is a handler method of kind FOR PRECHECK for one operation: create, create by association, update, delete or an action. The operation names the precheck in its BDEF line, for example create ( precheck ). With a precheck, values the user may not set never reach the transactional buffer. The method receives the entities to be created or updated and fills failed and reported when a value is not acceptable.
The guide warns that Fiori elements UIs do not fully support the behavior of authorization checks in precheck methods, so a precheck is no substitute for the authorization methods that also drive which buttons are enabled.
Authorization, drafts and projections
-
Draft. In a draft-enabled business object the authorization methods are called for the operations on draft instances and for the draft actions Edit and Resume. They are not called when a draft is activated, so a rule that must stop an activation belongs in a validation. Drafts have a page of their own later in this section.
-
Projection. A projection business object inherits the authorization control of the base object. Actions and functions that are new in a strict projection behavior definition can have their own control, declared individually as
globalorinstance; there is no master and dependent relation between projection definitions, and an action can useauthorization:noneto be excluded. -
Consumer hints. On a Fiori elements user interface the buttons of actions and other instance-based operations are clickable only if the authorization and feature methods allow the operation for the shown claim, so a user usually does not even see a button that would be refused.
Read access
None of the above restricts reading. The Keyword Documentation says that the read operation is provided by CDS and governed by CDS access control, and the RAP guide that it is enough to model access controls for the CDS entities of the business object. They are evaluated automatically for transactional reads of a managed business object (EML reads and reads by association). In an unmanaged business object the transactional read is written by the developer, so the access control has to be honoured in that implementation. The rules for the annotation @AccessControl.authorizationCheck are part of the same topic: #MANDATORY should be used and #CHECK not at all. See CDS Access Control for how to write the role of the claim.
Optimistic concurrency control with an ETag
Imagine two clerks who open the same claim in a browser. Both see the amount 100. The first changes it to 120 and saves. The second, who still sees 100, changes the status and saves. Without a safeguard the second save writes the old amount back. Optimistic concurrency control assumes such collisions are rare, so it does not block anyone; it only makes sure that a change is applied to exactly the version the client has seen.
The mechanism is the ETag, short for entity tag. A field of the instance describes its version, often a timestamp or a hash. The RAP guide describes the protocol: when optimistic concurrency control is on, the OData client must send an ETag value with every modifying operation. The runtime compares the value with the one stored, and accepts the change only if they match. When the instance is changed, the ETag field is updated, so the version moves on. The guide also notes that this is relevant when the business object is consumed over OData, which is why the ETag is also called the OData ETag, and that it is independent of the ABAP session: other clients are not blocked.
Source: RAP: Optimistic Concurrency Control. The diagram is the page’s own sketch of the sequence that the guide describes with its two-client diagram.
Declaring and maintaining the ETag
The BDEF line is etag master LocalLastChangedAt, as in the listing above. The Keyword Documentation gives these rules:
-
An ETag master field is optional. One or more entities can be ETag masters, on any level of the composition tree. The field can have any type that converts to a string.
-
A child entity that has no field of its own is declared
etag dependent by _Assoc. The association must be read-enabled in the behavior definition and exist in the CDS model, and the master must be higher in the composition tree. -
In a managed business object the provider can maintain the ETag with no code, provided it is updated reliably with every change and readable from every entity that uses it. The field must be annotated in the view with
@Semantics.systemDateTime.localInstanceLastChangedAt: trueand be of typeutclong,timestamportimestampl. The field should be read-only. -
In an unmanaged business object the developer must handle the ETag, and the Keyword Documentation recommends doing so during the save sequence. To let the framework read the ETag value, the method
FOR READmust be implemented.
In the view of the example, the field is declared like this.
@Semantics.systemDateTime.localInstanceLastChangedAt: true
local_last_changed_at as LocalLastChangedAt
Source: Keyword Documentation: RAP - etag. This listing is one element of the view entity ZI_ExpClaim and requires an SAP system; not run here.
The total ETag for drafts
A draft-enabled business object needs a second, separate field. The Keyword Documentation calls it the total ETag (total etag TotalEtagField): if a user edits in draft mode and returns after the exclusive lock of the editing session has expired, the total ETag shows whether the persistent data was changed meanwhile. The framework compares the total ETag of the draft with that of the persistent version and resumes the draft only if they match. The field is mandatory for draft-enabled objects, is written directly after the lock master line, and in a managed object can be provided automatically when it carries the annotation @Semantics.systemDateTime.lastChangedAt: true and a timestamp type. While editing a draft, the RAP guide adds, the value of the draft table field that logs the changes of the draft instance (draftentitylastchangedatetime) is compared instead, so a user cannot change the same draft on two screens at once. The Keyword Documentation recommends using both the ETag master and the total ETag in a draft-enabled object. Drafts have a page of their own later in this section.
Pessimistic concurrency control with locks
Pessimistic concurrency control takes the opposite view: it assumes collisions are likely and keeps them from happening by locking. While one user changes a claim, nobody else can. The RAP guide explains that technically this uses the enqueue locks and the global lock table of the SAP lock concept. Before data is changed, the instance gets an entry in the lock table; if a request collides with an existing entry, it is rejected; after a successful change the entry is removed. That is the mechanism of Lock Objects and the SAP Lock Concept, applied automatically.
The lock lives as long as the first of these events: the end of the ABAP session, the end of the RAP LUW with a commit or a rollback, or, in a draft scenario, the life of the draft instance, because there the lock is tied to neither the LUW nor the session.
Source: RAP: Pessimistic Concurrency Control (Locking). The diagram is the page’s own sketch of the sequence that the guide describes with its two-client diagram.
Lock master and lock dependent
Locking covers the whole business object, not one entity. The behavior definition declares lock master on the root and lock dependent by _Assoc on each child; the Keyword Documentation requires every entity to be one or the other and every root to be a master. A lock request on any child instance is delegated to the master. Locking the item 0010 of claim C-0001 therefore locks the claim and all its items, but not the items of claim C-0002. The association to the master must be declared in the behavior definition and exist in the CDS model. The earlier listing shows both forms, the second in its short form.
When locks are set: implicitly, before update, delete, create by association and actions. A plain create does not lock, because there is no instance yet. In a managed business object, the created key values are written to the global lock table, as part of a uniqueness check; an unmanaged business object has to make sure itself that keys are unique. An action can turn locking off with the addition lock : none. The statement SET LOCKS locks instances explicitly.
Managed, unmanaged and the method FOR LOCK
In a managed business object the provider locks and unlocks; the behavior pool contains nothing. If the standard locking is not what is wanted, lock master unmanaged switches to your own implementation, in the same way as in an unmanaged business object. There the handler method FOR LOCK is called automatically before a modify operation, receives the keys to lock, and enters the locks by calling the enqueue method of a lock object. The page on locks and enqueue shows a complete method with the lock object EZEXP_CLAIM. The sample of the ABAP cheat sheets reports a lock that another user holds by writing the key and the cause locked into the response structure failed, which is how the framework learns that the lock request was refused.
CLASS lhc_claim DEFINITION INHERITING FROM cl_abap_behavior_handler.
PRIVATE SECTION.
METHODS lock FOR LOCK
IMPORTING keys FOR LOCK Claim.
ENDCLASS.
CLASS lhc_claim IMPLEMENTATION.
METHOD lock.
" ... one enqueue per requested key, see the page on xref:programming-languages/abap/locks-and-enqueue.adoc[locks and enqueue]
" when a lock is held by another user:
" APPEND VALUE #( %key = CORRESPONDING #( key )
" %fail-cause = if_abap_behv=>cause-locked )
" TO failed-claim.
ENDMETHOD.
ENDCLASS.
Source: Keyword Documentation: FOR LOCK, RAP Handler Method and abap-cheat-sheets: method lock of the unmanaged BO with a lock object. This listing is an outline, not a complete method, and requires an SAP system; not run here.
During the save sequence the lock is removed in the cleanup method after the data has been saved successfully, as the RAP guide states.
Locks and drafts
In a draft scenario locking is more important. As soon as a draft is created for an existing active instance, the active instance gets an exclusive lock that stays for a determined time, even if the ABAP session ends. After that time an optimistic phase begins, in which the draft can still be resumed as long as the active instance does not change. The draft ends when its owner discards it, when it is not touched for a certain time (28 days by default, the guide says), when the active instance is changed directly during the optimistic phase, or when a second draft is created for the same active instance; resuming the draft sets a new exclusive lock. That is where the total ETag of the previous section comes in: it is the check that decides whether a returning user may resume. The Keyword Documentation says the lock duration can be configured. In collaborative draft handling every participant on the user list can modify, activate, resume or discard the draft.
Which tool for which problem
| Optimistic (ETag) | Pessimistic (lock) | |
|---|---|---|
Idea |
Check at the moment of the change that the data is still the version the client saw. |
Prevent the second change by holding an exclusive lock on the data. |
Blocks other users? |
No. The ETag is independent of the ABAP session. |
Yes, until the LUW ends, the session ends or the draft expires. |
Relevant for |
Consumers that use OData: the client sends the ETag with each modifying request. |
Every change in a business object that has a lock master. |
Typical failure |
A change request on an outdated version is rejected. |
A change request on a locked instance is rejected. |
Managed business object |
Automatic when the field is annotated and the ETag is declared. |
Automatic with |
Unmanaged business object |
You maintain the field and implement |
You implement |
The two tools complement each other and are often used together: with drafts the lock protects a user who edits, and the ETag protects the moment a draft meets the changed persistent data. In older material, from before RAP, locks are set by explicit calls of generated enqueue function modules, as shown in the page on locks and enqueue. In RAP the behavior definition declares the lock, the ETag and the kind of authorization once, and the framework calls the checks at the right place; the page on authorization checks later in this guide covers the classic statement itself.
Common mistakes
-
Implementing only the global method although the master says
( global, instance ). The documentation states that both methods must be implemented for that declaration. -
Expecting an authorization method to inspect new values. The methods see only the before image. Use a precheck, or a validation, for rules that depend on the value being entered.
-
Relying on an authorization method to stop a draft from being activated. The methods are not called on activation. Put the check in a validation.
-
Using
IN LOCAL MODEto get past a check from outside the business object. The addition skips authorization control and belongs in the code of the business object itself. -
Declaring an ETag on a field that does not change reliably. A managed business object can handle the ETag itself only if the field is updated with every change and every entity that uses it can read it.
-
Forgetting that a plain create is not locked. Two users can still try to create the same key; the managed provider checks uniqueness, an unmanaged implementation has to.
-
Writing the association to the lock or ETag master only in the behavior definition. The Keyword Documentation requires it in the CDS data model too.
Summary
-
RAP separates read access (CDS access control), authorization control (global and instance checks for changes and actions), feature control (state-dependent availability) and concurrency control.
-
Every entity is an authorization master or authorization dependent; a master declares
global,instance, both ornone, and the matching handler methodsFOR GLOBAL AUTHORIZATIONandFOR INSTANCE AUTHORIZATIONreturnif_abap_behv=>auth-allowedorif_abap_behv=>auth-unauthorizedper operation. -
Authorization methods see only the data before the change; checks on incoming values use a precheck, and a rule that must stop a draft activation uses a validation.
-
etag mastermakes a change succeed only on the version the client saw, with no blocking; in a managed business object a timestamp field with the right annotation is enough, and drafts add a total ETag. -
lock masterandlock dependent bylock the whole business object while one user changes it; managed objects do it automatically, unmanaged ones implementFOR LOCKwith a lock object.