Write a managed behavior definition for a Book entity with create, update and delete, one validation and one determination, and explain each line.
Say your answer out loud first.
Practise another way
The header starts with managed, the behavior pool and unique, then strict ( 2 ). For the root entity, it names the persistent table, lock master, authorization master and an etag field.
The body enables create, update and delete, and uses managed UUID numbering for the key. It marks admin fields read-only, adds a validation on save and a determination on modify, and maps CDS field names to table columns. Read works without any declaration.
The behavior definition (ABAP Platform 2023/2025 syntax, also ABAP Cloud):
managed implementation in class zbp_r_book unique;
strict ( 2 );
define behavior for ZR_Book alias Book
persistent table zbook
lock master
authorization master ( instance )
etag master LocalLastChangedAt
{
create;
update;
delete;
field ( numbering : managed, readonly ) BookUUID;
field ( readonly ) LocalLastChangedAt;
field ( mandatory ) Title, PublishedDate;
validation validatePublishedDate on save { create; field PublishedDate; }
determination setDefaultGenre on modify { create; }
mapping for zbook corresponding
{ BookUUID = book_uuid; PublishedDate = published_date;
LocalLastChangedAt = local_last_changed_at; }
}
Line by line
managed: the framework supplies the transactional buffer, create, update, delete and the save. Read needs no keyword.implementation in class ... uniquenames the behavior pool;uniqueis mandatory. The class is only needed because this BO adds a validation, a determination and instance authorization.strict ( 2 ): the latest strict mode, with extra syntax checks.persistent table zbook: where the managed save writes. It must be left out only withwith unmanaged save.lock master: the root locks the whole tree; children would uselock dependent by _Book.authorization master ( instance ): the pool must implement the instance authorization method.etag master: optimistic concurrency for OData clients. Managed BOs fill it when the CDS field has@Semantics.systemDateTime.localInstanceLastChangedAt: trueand autclongor timestamp type.numbering : managed: the framework generates a UUID; the key must be a 16-byte raw field.readonlystops consumers sending a key.mandatory: the field must be filled; you still validate its content.validation ... on save: runs in the early save phase and can reject the save.determination ... on modify: runs right after the triggering change, here to default the genre.mapping: CDS uses camel-case aliases, the table uses snake case;correspondingmaps identical names automatically.
What comes next: a projection BDEF (projection; strict ( 2 ); define behavior for ZC_Book { use create; use update; use delete; }), a service definition and an OData V4 UI service binding.
Then implement the two methods in the local handler class of ZBP_R_BOOK.
Writes a complete header plus entity characteristics (table, lock, authorization, etag), explains why each line exists, and knows read is implicit and the projection BDEF follows.
Writes only a define behavior block with create, update and delete, with no implementation type, table, lock or numbering, and cannot say what the framework does for you.
Copying the snippet many prep sites show (just `define behavior for ... { create; update; delete; }`): with no `managed` header, persistent table, lock master or numbering, it is not a working business object, and interviewers notice.
- What changes if the key is a readable book number instead of a UUID?
- Where exactly does the validation run, and what happens if it fails?
- How would you add a child entity Chapter to this BDEF?
- Why is the mapping needed, and when can you drop it?
2 official pages and 3 prep guides. Confidence: high. Checked 2 Dec 2026.
- Prep guide Gives the question.
- Prep guide Gives the question.
- Prep guide Gives the question.
- Official page Backs the answer.
- Official page Backs the answer.