What does ROOT mean in DEFINE ROOT VIEW ENTITY? Can an entity that is a child in one business object also be the root of another one?
Say your answer out loud first.
Practise another way
ROOT marks the top node of a business object's composition tree. The behavior definition must define behavior for it, and it carries lock master, authorization master and, with draft, the total ETag.
A child depends on its parent and points up with an association to parent, so one CDS entity cannot be both root and child.
If items need their own life cycle, the solution is a separate root view entity on the item table as a second business object, linked by a plain association.
What ROOT does
- A RAP business object is a tree of CDS entities.
define root view entitymarks the top node; every other node hangs below it through compositions. - You must define behavior for the root entity; behavior for children is optional. The BDEF usually has the root's name.
- Concurrency and security are anchored at the root:
lock masterandauthorization mastermust be on the root. Children arelock dependent byan association to the root (for direct children, the to-parent association). For authorization they are usuallyauthorization dependent byit, but since cloud release 2405 and release 8.16 a child can also be its ownauthorization master. With draft,total etagis mandatory and followslock master. - A root has no parent. A child is the target of the parent's
compositionand points back withassociation to parent.
define root view entity ZR_SalesOrder
as select from zsalesorder
composition [0..*] of ZR_SalesOrderItem as _Item
{
key order_uuid as OrderUUID,
_Item
}
define view entity ZR_SalesOrderItem
as select from zsalesorder_item
association to parent ZR_SalesOrder as _Order
on $projection.OrderUUID = _Order.OrderUUID
{
key item_uuid as ItemUUID,
order_uuid as OrderUUID,
_Order
}
Can the item also be a root? Not the same CDS entity: an entity is either the top of its own tree or a node under a parent. Your options:
- Build a second root view entity on the same table with its own BDEF. That is a separate business object with its own locks, authorization and save.
- Link two independent BOs with a plain association, not a composition. Deleting a sales order then does not delete anything in the other BO; in a managed BO only composition children are deleted with their parent.
Why it is usually a smell. Two BOs writing the same table have two lock masters, and changes through one never run the other's validations.
If you only need a different screen or API, keep one BO and add a second projection with its own service. Its root must be a CDS projection view of the base root.
Two roots in one service are normal: a service definition can expose several BOs, for example sales orders plus a business partner BO for value helps.
Rule of thumb for the interview: if the child makes no business sense without its parent, it is a composition child. If it does, it is probably its own root.
Explains ROOT as the top of the composition tree that anchors locking, authorization and the total ETag, and gives the real options (separate BO, association, second projection) with their trade-offs.
Says root 'is the main table' and that any entity can be made a root whenever it needs its own screen.
Making every entity a root so it can be edited on its own. You get separate transactions and lock masters on data that belongs together, and parent deletes no longer cascade.
- What is the difference between a composition and an association in RAP?
- Where do lock master and total etag go, and why there?
- When do you add a second projection instead of a second business object?
3 official pages and 4 prep guides. Confidence: high. Checked 3 Dec 2026.
- Prep guide Gives the question.
- Prep guide Describes the round.
- Prep guide Gives the question.
- Prep guide Gives the question.
- Official page Backs the answer.
- Official page Backs the answer.
- Official page Backs the answer.