Why does EML work with BDEF derived types and %control instead of a plain database-table row?
Say your answer out loud first.
Practise another way
A table row only carries column values. A RAP request needs more. It needs a content ID to link operations before keys exist, the draft indicator and preliminary IDs in late numbering.
Above all, it needs to know which fields the caller actually supplied. BDEF derived types add those % components and use the CDS field names.
The framework builds them from the BDEF. The %control component flags each field, so an update changes only flagged fields and never blanks the rest with initial values.
Where the types come from. BDEF derived types are generated from the CDS entity and its behavior definition: TYPE TABLE FOR CREATE, TYPE TABLE FOR UPDATE, TYPE STRUCTURE FOR ..., TYPE RESPONSE FOR FAILED/REPORTED/MAPPED, TYPE REQUEST FOR CHANGE for save_modified.
You only get the types the BDEF allows: no delete in the BDEF, no delete type. Some, such as FOR VALIDATION or FOR ... AUTHORIZATION, exist only inside behavior pools.
What a table row cannot express
%cid/%cid_ref: a content ID so a create and a follow-up update or create-by-association in the same request find each other before a key exists.%key,%tky,%pky: key groups.%tkyadds%is_draft, so using it everywhere keeps your code working if the BO later becomes draft-enabled.%pid: preliminary ID, only with late numbering.%target: the child instances in a deep create.%control: one flag per field (typeABP_BEHV_FLAG, valuesif_abap_behv=>mk-on/mk-off).
Why %control matters most. In a table row an initial value is ambiguous: 'set this to blank' or 'I did not send it'. %control removes the ambiguity, so a partial update touches only flagged fields.
" Short form: FIELDS ( ) sets %control-Title for you
MODIFY ENTITIES OF zr_book
ENTITY Book
UPDATE FIELDS ( Title )
WITH VALUE #( ( BookUUID = book_uuid Title = 'Clean ABAP' ) )
FAILED DATA(failed) REPORTED DATA(reported).
" Long form: with FROM you must set %control yourself
MODIFY ENTITIES OF zr_book
ENTITY Book
UPDATE FROM VALUE #( ( BookUUID = book_uuid Title = 'Clean ABAP'
%control-Title = if_abap_behv=>mk-on ) )
FAILED DATA(failed2) REPORTED DATA(reported2).
With FIELDS ( ... ) WITH, a field not in the list is ignored even if the row holds a value. With FROM and no flag set, nothing is taken over.
Field names. Derived types use the CDS (alias) names, not table columns. To move data between the two, use CORRESPONDING with the RAP additions.
MAPPING FROM ENTITY / MAPPING TO ENTITY use the BDEF mapping. USING CONTROL copies only flagged fields. CHANGING CONTROL derives flags from a plain structure.
Tip: press F2 on any handler parameter in ADT to see the exact components; they depend on the BDEF (draft, late numbering, actions).
Explains the supplied-versus-initial problem that %control solves, names %cid, %tky and %is_draft, and shows FIELDS ( ) versus FROM with explicit flags.
Says derived types are 'just structures generated by SAP' and cannot explain why an update with FROM and no flags changes nothing.
A common mistake is to use `UPDATE FROM` without setting `%control`, or to fill a derived type from a plain row with `CHANGING CONTROL`. A field deliberately cleared to initial is then treated as 'not supplied' and is silently not updated.
- What is the difference between %key and %tky, and which do you use?
- What happens if you omit %cid in a create followed by an update in the same request?
- How do you convert a BDEF derived type to a table row in save_modified?
- What does CHANGING CONTROL do with a field that is intentionally initial?
1 official page and 1 prep guide. Confidence: high. Checked 2 Dec 2026.
- Prep guide Gives the question.
- Official page Backs the answer.