How is a child instance created in RAP? What do you declare in the behavior definition, and how do you do it with EML?
Say your answer out loud first.
Practise another way
A child is never created on its own. In the parent's behavior I declare the association with create, which enables create-by-association; the child entity itself has no create operation.
In EML I use CREATE BY backslash and the association, give the parent's key or its %cid_ref, and put the new children in %target, each with its own %cid. The framework locks the lock master and, by default, checks the parent's update authorization.
Declaration
define behavior for ZR_Travel alias Travel
...
{
create; update; delete;
association _Booking { create ( features : instance ); with draft; }
}
define behavior for ZR_Booking alias Booking
...
lock dependent by _Travel
authorization dependent by _Travel
{
update; delete;
field ( readonly ) TravelUUID;
association _Travel { with draft; }
}
association _Booking { create; }on the parent enables create-by-association and read-by-association.- The child lists
update; delete;but nocreate;: a composition child only comes into existence through its parent. - In a draft BO,
with draft;on both directions makes draft parents get draft children. features : instancelets you block adding children dynamically, for example on a cancelled travel.
EML: parent and children in one request
MODIFY ENTITIES OF zr_travel
ENTITY Travel
CREATE FIELDS ( AgencyID CustomerID )
WITH VALUE #( ( %cid = 'T1' AgencyID = '070001' CustomerID = '000594' ) )
CREATE BY \_Booking FIELDS ( FlightDate )
WITH VALUE #( ( %cid_ref = 'T1'
%target = VALUE #( ( %cid = 'B1' FlightDate = '20270315' ) ) ) )
MAPPED DATA(mapped) FAILED DATA(failed) REPORTED DATA(reported).
%cid_refpoints to a parent created earlier in the same request. For an existing parent you pass its key (%tky) instead.%targetholds the new children; each gets its own%cidso later operations in the request can refer to it.MAPPEDreturns the keys of the new instances. Nothing is on the database untilCOMMIT ENTITIES, or until the OData request finishes.
What the framework does
- Locking: in a managed BO, create-by-association locks the lock master, just like update, delete and actions.
- Authorization: for an authorization-dependent child, a create-by-association is checked with the master's update authorization by default. ABAP release 8.16 (ABAP Platform 2025) and cloud release 2508 added the option to define separate authorization for create-by-association on to-child associations.
- Delete: deleting the parent in a managed BO deletes its composition children too.
From the UI. A Fiori elements object page shows the children in a line-item facet. Its Create button triggers the same create-by-association through the OData service. So all of the rules above apply to UI and EML alike.
Explains that children are created only through the parent, shows CREATE BY with %cid_ref and %target, and knows the locking and authorization consequences.
Adds create; to the child or inserts child rows with SQL, and cannot say what %cid_ref is for.
Declaring `create;` on the child entity or inserting child rows with SQL. A composition child must be created through its parent so locking, authorization and draft stay consistent.
- What is the difference between %cid and %cid_ref?
- How would you stop users from adding bookings to a cancelled travel?
- Which authorization is checked for a create-by-association, and can you change that?
4 official pages and 1 prep guide. Confidence: high. Checked 1 Dec 2026.
- Prep guide Gives the question.
- Official page Backs the answer.
- Official page Backs the answer.
- Official page Backs the answer.
- Official page Backs the answer.