RAP (RESTful ABAP Programming Model)
Guide for building transactional applications using the ABAP RESTful Application Programming Model (RAP) in ABAP Cloud.
Workflow
Determine the user's goal:
- Creating a new RAP BO from scratch
- Adding behavior (actions, validations, determinations) to an existing BO
- Writing EML statements to consume a RAP BO
- Troubleshooting RAP-related issues
- Understanding RAP concepts
Identify the scenario:
- Managed (greenfield) vs. unmanaged (brownfield)
- Draft-enabled or not
- Numbering concept: early/late, internal/external/managed
- Single entity or composition tree (root + children)
Guide implementation following the RAP layered architecture:
- Data modeling (database tables → CDS view entities)
- Behavior definition (BDEF using BDL)
- Behavior implementation (ABAP behavior pool)
- Business service exposure (service definition → service binding)
Provide code examples using correct BDL and EML syntax
RAP Architecture Layers
| Layer |
Artifacts |
Purpose |
| Data Modeling |
Database tables, CDS root/child view entities |
Data persistence and semantic data model |
| Behavior Definition |
BDEF (.bdef) |
Declares transactional behavior (operations, characteristics) using BDL |
| Behavior Implementation |
ABAP behavior pool (BP_*) |
Implements business logic in handler/saver classes |
| Projection |
CDS projection views, projection BDEF |
Adapts BO for specific service consumers |
| Business Service |
Service definition, service binding |
Exposes BO as OData service |
Implementation Types
Managed (Greenfield)
- Framework handles transactional buffer and standard CRUD operations automatically
- Only need custom code for non-standard operations (actions, validations, determinations)
- Automatic save handling (can be enhanced with
additional save or replaced with unmanaged save)
managed implementation in class zbp_r_entity unique;
strict ( 2 );
Unmanaged (Brownfield)
- Developer provides transactional buffer and implements all operations
- Used when existing business logic needs to be embedded in RAP
unmanaged implementation in class zbp_r_entity unique;
strict ( 2 );
Behavior Definition (BDL) Quick Reference
Complete BDEF Structure
managed implementation in class zbp_r_root unique;
strict ( 2 );
with draft;
define behavior for ZR_Root alias Root
persistent table zroot_tab
draft table zroot_d
etag master LocalLastChangedAt
lock master
total etag LastChangedAt
authorization master ( global )
late numbering
{
// Field characteristics
field ( readonly ) RootUUID, CreatedBy, CreatedAt, LastChangedBy, LastChangedAt;
field ( mandatory ) Description;
field ( numbering : managed ) RootUUID;
// Standard operations
create;
update;
delete;
// Association to child entity
association _Child { create; }
// Actions
action doSomething result [1] $self;
static action createFromTemplate parameter ZD_CreateParam result [1] $self;
internal action recalculate;
// Validations
validation validateDescription on save { create; field Description; }
// Determinations
determination setDefaults on modify { create; }
determination calcTotal on modify { field Quantity, Price; }
// Draft actions
draft action Resume;
draft action Edit;
draft action Activate optimized;
draft action Discard;
draft determine action Prepare
{
validation validateDescription;
}
// Side effects
side effects
{
field Quantity affects field TotalAmount;
field Price affects field TotalAmount;
determine action Prepare executed on field Description affects messages;
}
// Events
event created;
event deleted parameter ZD_DeletedEvent;
// Mapping
mapping for zroot_tab corresponding
{
RootUUID = root_uuid;
Description = description;
}
}
define behavior for ZR_Child alias Child
persistent table zchild_tab
draft table zchild_d
etag master LocalLastChangedAt
lock dependent by _Root
authorization dependent by _Root
{
field ( readonly ) ChildUUID, RootUUID;
field ( numbering : managed ) ChildUUID;
update;
delete;
association _Root;
mapping for zchild_tab corresponding
{
ChildUUID = child_uuid;
RootUUID = root_uuid;
}
}
Projection BDEF
projection;
strict ( 2 );
use draft;
define behavior for ZC_Root alias Root
{
use create;
use update;
use delete;
use action doSomething;
use association _Child { create; }
}
define behavior for ZC_Child alias Child
{
use update;
use delete;
use association _Root;
}
Key BDL Elements
| Element |
Syntax |
Purpose |
| Managed numbering |
field ( numbering : managed ) KeyField; |
Framework assigns UUID keys automatically |
| Early numbering |
early numbering |
Custom key assignment in interaction phase via FOR NUMBERING handler |
| Late numbering |
late numbering |
Key assignment in save sequence via adjust_numbers saver method |
| Lock master |
lock master |
Root entity controls pessimistic locking |
| Lock dependent |
lock dependent by _Assoc |
Child entity delegates locking to parent |
| ETag |
etag master FieldName |
Optimistic concurrency control |
| Total ETag |
total etag FieldName |
Required for draft-enabled BOs |
| Draft |
with draft; |
Enables draft handling for entire BO |
| Collaborative draft |
with collaborative draft; |
Multi-user draft editing |
| Strict mode |
strict ( 2 ); |
Enables additional BDL syntax checks (use latest version) |
ABAP Behavior Pool (ABP)
Handler Class
CLASS lhc_root DEFINITION INHERITING FROM cl_abap_behavior_handler.
PRIVATE SECTION.
" Standard operations (unmanaged only)
METHODS create FOR MODIFY
IMPORTING entities FOR CREATE Root.
" Action implementation
METHODS doSomething FOR MODIFY
IMPORTING keys FOR ACTION Root~doSomething RESULT result.
" Validation
METHODS validateDescription FOR VALIDATE ON SAVE
IMPORTING keys FOR Root~validateDescription.
" Determination
METHODS setDefaults FOR DETERMINE ON MODIFY
IMPORTING keys FOR Root~setDefaults.
" Instance feature control
METHODS get_instance_features FOR INSTANCE FEATURES
IMPORTING keys REQUEST requested_features FOR Root RESULT result.
" Instance authorization
METHODS get_instance_authorizations FOR INSTANCE AUTHORIZATION
IMPORTING keys REQUEST requested_authorizations FOR Root RESULT result.
ENDCLASS.
CLASS lhc_root IMPLEMENTATION.
METHOD doSomething.
" Read current instance data
READ ENTITIES OF zr_root IN LOCAL MODE
ENTITY Root
ALL FIELDS WITH CORRESPONDING #( keys )
RESULT DATA(entities)
FAILED failed.
" Modify instances
MODIFY ENTITIES OF zr_root IN LOCAL MODE
ENTITY Root
UPDATE FIELDS ( Status )
WITH VALUE #( FOR entity IN entities
( %tky = entity-%tky
Status = 'DONE'
%control-Status = if_abap_behv=>mk-on ) )
FAILED failed
REPORTED reported.
" Fill result
result = VALUE #( FOR entity IN entities
( %tky = entity-%tky
%param = entity ) ).
ENDMETHOD.
METHOD validateDescription.
READ ENTITIES OF zr_root IN LOCAL MODE
ENTITY Root
FIELDS ( Description ) WITH CORRESPONDING #( keys )
RESULT DATA(entities).
LOOP AT entities INTO DATA(entity).
IF entity-Description IS INITIAL.
APPEND VALUE #( %tky = entity-%tky ) TO failed-root.
APPEND VALUE #( %tky = entity-%tky
%msg = new_message_with_text(
severity = if_abap_behv_message=>severity-error
text = 'Description must not be empty' )
%element-Description = if_abap_behv=>mk-on
) TO reported-root.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD setDefaults.
READ ENTITIES OF zr_root IN LOCAL MODE
ENTITY Root
ALL FIELDS WITH CORRESPONDING #( keys )
RESULT DATA(entities).
MODIFY ENTITIES OF zr_root IN LOCAL MODE
ENTITY Root
UPDATE FIELDS ( Status CreatedAt )
WITH VALUE #( FOR entity IN entities
( %tky = entity-%tky
Status = 'NEW'
%control-Status = if_abap_behv=>mk-on ) )
REPORTED reported.
ENDMETHOD.
ENDCLASS.
Saver Class
CLASS lsc_root DEFINITION INHERITING FROM cl_abap_behavior_saver.
PROTECTED SECTION.
METHODS finalize REDEFINITION.
METHODS check_before_save REDEFINITION.
METHODS save_modified REDEFINITION.
METHODS cleanup REDEFINITION.
METHODS cleanup_finalize REDEFINITION.
ENDCLASS.
CLASS lsc_root IMPLEMENTATION.
METHOD finalize.
" Final calculations before save
ENDMETHOD.
METHOD check_before_save.
" Final consistency checks
ENDMETHOD.
METHOD save_modified.
" Only needed for 'with additional save' or 'with unmanaged save'
" Raise business events here
IF create-root IS NOT INITIAL.
RAISE ENTITY EVENT zr_root~created
FROM VALUE #( FOR <cr> IN create-root
( %key = VALUE #( RootUUID = <cr>-RootUUID ) ) ).
ENDIF.
ENDMETHOD.
METHOD cleanup.
" Clear transactional buffer
ENDMETHOD.
METHOD cleanup_finalize.
" Rollback finalize changes on failure
ENDMETHOD.
ENDCLASS.
EML (Entity Manipulation Language) Quick Reference
EML is the ABAP language for programmatically interacting with RAP BOs. Key operations: MODIFY ENTITY (create/update/delete/execute action), READ ENTITIES, COMMIT ENTITIES, ROLLBACK ENTITIES.
- Create:
MODIFY ENTITY ... CREATE FIELDS ( ... ) WITH VALUE #( ( %cid = '...' ... ) )
- Read:
READ ENTITIES OF ... ALL FIELDS WITH VALUE #( ( key = val ) ) RESULT DATA(result)
- Update:
MODIFY ENTITY ... UPDATE FIELDS ( ... ) WITH VALUE #( ( %tky = ... ) )
- Delete:
MODIFY ENTITY ... DELETE FROM VALUE #( ( %tky = ... ) )
- Execute Action:
MODIFY ENTITY ... EXECUTE actionName FROM VALUE #( ( %tky = ... ) )
- Deep Create: Use
CREATE BY \_Assoc with %cid_ref and %target
For full EML syntax with code examples, read references/eml-quick-reference.md.
Draft Handling
- Enabled via
with draft; in BDEF header
- Requires separate
draft table for each entity
- Draft table must include
"%admin": include sych_bdl_draft_admin_inc;
- Draft actions (
Edit, Activate, Discard, Resume, Prepare) are implicitly provided
- Use
%is_draft component (or %tky which includes it) to distinguish draft vs. active instances
RAP Save Sequence
| Phase |
Methods Called |
Purpose |
| Early Save |
finalize → check_before_save → (on failure: cleanup_finalize) |
Ensure data consistency |
| Late Save |
adjust_numbers → save / save_modified → cleanup |
Persist data to database |
- Early save failures (sy-subrc = 4) return to interaction phase
- Late save is point of no return — either commit succeeds or runtime error
Key BDEF Derived Type Components
| Component |
Purpose |
%cid |
Content ID — unique preliminary identifier for new instances |
%cid_ref |
Reference to a %cid in the same EML request |
%key |
Primary key fields |
%tky |
Transactional key (%key + %is_draft + %pid) — recommended |
%data |
All key and data fields |
%control |
Flags indicating which fields are provided/requested |
%is_draft |
Draft indicator (draft-enabled BOs only) |
%pid |
Preliminary ID (late numbering only) |
%target |
Target instances for create-by-association |
%param |
Action/function parameter values |
Best Practices
- Always use
strict ( 2 ); for new BOs
- Prefer
%tky over %key for future-proof code (handles draft/late numbering transitions)
- Always fill
%cid in create operations even if not referenced later
- Use
IN LOCAL MODE in handler methods to bypass feature controls and authorization checks
- Implement validations for data consistency checks, determinations for calculated fields
- Keep handler methods focused; use ABP auxiliary classes for shared logic
- For managed BOs, only implement handler methods for non-standard operations
References
1---2name: rap3description: Help with RAP (RESTful ABAP Programming Model) development including behavior definitions, EML statements, managed and unmanaged BOs, draft handling, actions, validations, determinations, side effects, and business events. Use when users ask about RAP, BDEF, BDL, EML, behavior definitions, behavior pools, managed BO, unmanaged BO, draft-enabled BO, RAP actions, RAP validations, RAP determinations, RAP side effects, RAP business events, create/read/update/delete in RAP, or building transactional Fiori apps with ABAP Cloud. Triggers include "create a RAP BO", "write a behavior definition", "EML syntax", "managed vs unmanaged", "enable draft", "add an action", "add a validation", "RAP handler method", or "RAP saver class".4---56# RAP (RESTful ABAP Programming Model)78Guide for building transactional applications using the ABAP RESTful Application Programming Model (RAP) in ABAP Cloud.910## Workflow11121. **Determine the user's goal**:13 - Creating a new RAP BO from scratch14 - Adding behavior (actions, validations, determinations) to an existing BO15 - Writing EML statements to consume a RAP BO16 - Troubleshooting RAP-related issues17 - Understanding RAP concepts18192. **Identify the scenario**:20 - Managed (greenfield) vs. unmanaged (brownfield)21 - Draft-enabled or not22 - Numbering concept: early/late, internal/external/managed23 - Single entity or composition tree (root + children)24253. **Guide implementation** following the RAP layered architecture:26 - Data modeling (database tables → CDS view entities)27 - Behavior definition (BDEF using BDL)28 - Behavior implementation (ABAP behavior pool)29 - Business service exposure (service definition → service binding)30314. **Provide code examples** using correct BDL and EML syntax3233## RAP Architecture Layers3435| Layer | Artifacts | Purpose |36| --------------------------- | --------------------------------------------- | ----------------------------------------------------------------------- |37| **Data Modeling** | Database tables, CDS root/child view entities | Data persistence and semantic data model |38| **Behavior Definition** | BDEF (`.bdef`) | Declares transactional behavior (operations, characteristics) using BDL |39| **Behavior Implementation** | ABAP behavior pool (`BP_*`) | Implements business logic in handler/saver classes |40| **Projection** | CDS projection views, projection BDEF | Adapts BO for specific service consumers |41| **Business Service** | Service definition, service binding | Exposes BO as OData service |4243## Implementation Types4445### Managed (Greenfield)4647- Framework handles transactional buffer and standard CRUD operations automatically48- Only need custom code for non-standard operations (actions, validations, determinations)49- Automatic save handling (can be enhanced with `additional save` or replaced with `unmanaged save`)5051```52managed implementation in class zbp_r_entity unique;53strict ( 2 );54```5556### Unmanaged (Brownfield)5758- Developer provides transactional buffer and implements all operations59- Used when existing business logic needs to be embedded in RAP6061```62unmanaged implementation in class zbp_r_entity unique;63strict ( 2 );64```6566## Behavior Definition (BDL) Quick Reference6768### Complete BDEF Structure6970```71managed implementation in class zbp_r_root unique;72strict ( 2 );73with draft;7475define behavior for ZR_Root alias Root76persistent table zroot_tab77draft table zroot_d78etag master LocalLastChangedAt79lock master80total etag LastChangedAt81authorization master ( global )82late numbering83{84 // Field characteristics85 field ( readonly ) RootUUID, CreatedBy, CreatedAt, LastChangedBy, LastChangedAt;86 field ( mandatory ) Description;87 field ( numbering : managed ) RootUUID;8889 // Standard operations90 create;91 update;92 delete;9394 // Association to child entity95 association _Child { create; }9697 // Actions98 action doSomething result [1] $self;99 static action createFromTemplate parameter ZD_CreateParam result [1] $self;100 internal action recalculate;101102 // Validations103 validation validateDescription on save { create; field Description; }104105 // Determinations106 determination setDefaults on modify { create; }107 determination calcTotal on modify { field Quantity, Price; }108109 // Draft actions110 draft action Resume;111 draft action Edit;112 draft action Activate optimized;113 draft action Discard;114 draft determine action Prepare115 {116 validation validateDescription;117 }118119 // Side effects120 side effects121 {122 field Quantity affects field TotalAmount;123 field Price affects field TotalAmount;124 determine action Prepare executed on field Description affects messages;125 }126127 // Events128 event created;129 event deleted parameter ZD_DeletedEvent;130131 // Mapping132 mapping for zroot_tab corresponding133 {134 RootUUID = root_uuid;135 Description = description;136 }137}138139define behavior for ZR_Child alias Child140persistent table zchild_tab141draft table zchild_d142etag master LocalLastChangedAt143lock dependent by _Root144authorization dependent by _Root145{146 field ( readonly ) ChildUUID, RootUUID;147 field ( numbering : managed ) ChildUUID;148149 update;150 delete;151152 association _Root;153154 mapping for zchild_tab corresponding155 {156 ChildUUID = child_uuid;157 RootUUID = root_uuid;158 }159}160```161162### Projection BDEF163164```165projection;166strict ( 2 );167use draft;168169define behavior for ZC_Root alias Root170{171 use create;172 use update;173 use delete;174175 use action doSomething;176177 use association _Child { create; }178}179180define behavior for ZC_Child alias Child181{182 use update;183 use delete;184185 use association _Root;186}187```188189### Key BDL Elements190191| Element | Syntax | Purpose |192| ----------------------- | ----------------------------------------- | ---------------------------------------------------------------------- |193| **Managed numbering** | `field ( numbering : managed ) KeyField;` | Framework assigns UUID keys automatically |194| **Early numbering** | `early numbering` | Custom key assignment in interaction phase via `FOR NUMBERING` handler |195| **Late numbering** | `late numbering` | Key assignment in save sequence via `adjust_numbers` saver method |196| **Lock master** | `lock master` | Root entity controls pessimistic locking |197| **Lock dependent** | `lock dependent by _Assoc` | Child entity delegates locking to parent |198| **ETag** | `etag master FieldName` | Optimistic concurrency control |199| **Total ETag** | `total etag FieldName` | Required for draft-enabled BOs |200| **Draft** | `with draft;` | Enables draft handling for entire BO |201| **Collaborative draft** | `with collaborative draft;` | Multi-user draft editing |202| **Strict mode** | `strict ( 2 );` | Enables additional BDL syntax checks (use latest version) |203204## ABAP Behavior Pool (ABP)205206### Handler Class207208```abap209CLASS lhc_root DEFINITION INHERITING FROM cl_abap_behavior_handler.210 PRIVATE SECTION.211212 " Standard operations (unmanaged only)213 METHODS create FOR MODIFY214 IMPORTING entities FOR CREATE Root.215216 " Action implementation217 METHODS doSomething FOR MODIFY218 IMPORTING keys FOR ACTION Root~doSomething RESULT result.219220 " Validation221 METHODS validateDescription FOR VALIDATE ON SAVE222 IMPORTING keys FOR Root~validateDescription.223224 " Determination225 METHODS setDefaults FOR DETERMINE ON MODIFY226 IMPORTING keys FOR Root~setDefaults.227228 " Instance feature control229 METHODS get_instance_features FOR INSTANCE FEATURES230 IMPORTING keys REQUEST requested_features FOR Root RESULT result.231232 " Instance authorization233 METHODS get_instance_authorizations FOR INSTANCE AUTHORIZATION234 IMPORTING keys REQUEST requested_authorizations FOR Root RESULT result.235236ENDCLASS.237238CLASS lhc_root IMPLEMENTATION.239240 METHOD doSomething.241 " Read current instance data242 READ ENTITIES OF zr_root IN LOCAL MODE243 ENTITY Root244 ALL FIELDS WITH CORRESPONDING #( keys )245 RESULT DATA(entities)246 FAILED failed.247248 " Modify instances249 MODIFY ENTITIES OF zr_root IN LOCAL MODE250 ENTITY Root251 UPDATE FIELDS ( Status )252 WITH VALUE #( FOR entity IN entities253 ( %tky = entity-%tky254 Status = 'DONE'255 %control-Status = if_abap_behv=>mk-on ) )256 FAILED failed257 REPORTED reported.258259 " Fill result260 result = VALUE #( FOR entity IN entities261 ( %tky = entity-%tky262 %param = entity ) ).263 ENDMETHOD.264265 METHOD validateDescription.266 READ ENTITIES OF zr_root IN LOCAL MODE267 ENTITY Root268 FIELDS ( Description ) WITH CORRESPONDING #( keys )269 RESULT DATA(entities).270271 LOOP AT entities INTO DATA(entity).272 IF entity-Description IS INITIAL.273 APPEND VALUE #( %tky = entity-%tky ) TO failed-root.274 APPEND VALUE #( %tky = entity-%tky275 %msg = new_message_with_text(276 severity = if_abap_behv_message=>severity-error277 text = 'Description must not be empty' )278 %element-Description = if_abap_behv=>mk-on279 ) TO reported-root.280 ENDIF.281 ENDLOOP.282 ENDMETHOD.283284 METHOD setDefaults.285 READ ENTITIES OF zr_root IN LOCAL MODE286 ENTITY Root287 ALL FIELDS WITH CORRESPONDING #( keys )288 RESULT DATA(entities).289290 MODIFY ENTITIES OF zr_root IN LOCAL MODE291 ENTITY Root292 UPDATE FIELDS ( Status CreatedAt )293 WITH VALUE #( FOR entity IN entities294 ( %tky = entity-%tky295 Status = 'NEW'296 %control-Status = if_abap_behv=>mk-on ) )297 REPORTED reported.298 ENDMETHOD.299300ENDCLASS.301```302303### Saver Class304305```abap306CLASS lsc_root DEFINITION INHERITING FROM cl_abap_behavior_saver.307 PROTECTED SECTION.308 METHODS finalize REDEFINITION.309 METHODS check_before_save REDEFINITION.310 METHODS save_modified REDEFINITION.311 METHODS cleanup REDEFINITION.312 METHODS cleanup_finalize REDEFINITION.313ENDCLASS.314315CLASS lsc_root IMPLEMENTATION.316 METHOD finalize.317 " Final calculations before save318 ENDMETHOD.319320 METHOD check_before_save.321 " Final consistency checks322 ENDMETHOD.323324 METHOD save_modified.325 " Only needed for 'with additional save' or 'with unmanaged save'326 " Raise business events here327 IF create-root IS NOT INITIAL.328 RAISE ENTITY EVENT zr_root~created329 FROM VALUE #( FOR <cr> IN create-root330 ( %key = VALUE #( RootUUID = <cr>-RootUUID ) ) ).331 ENDIF.332 ENDMETHOD.333334 METHOD cleanup.335 " Clear transactional buffer336 ENDMETHOD.337338 METHOD cleanup_finalize.339 " Rollback finalize changes on failure340 ENDMETHOD.341ENDCLASS.342```343344## EML (Entity Manipulation Language) Quick Reference345346EML is the ABAP language for programmatically interacting with RAP BOs. Key operations: `MODIFY ENTITY` (create/update/delete/execute action), `READ ENTITIES`, `COMMIT ENTITIES`, `ROLLBACK ENTITIES`.347348- **Create**: `MODIFY ENTITY ... CREATE FIELDS ( ... ) WITH VALUE #( ( %cid = '...' ... ) )`349- **Read**: `READ ENTITIES OF ... ALL FIELDS WITH VALUE #( ( key = val ) ) RESULT DATA(result)`350- **Update**: `MODIFY ENTITY ... UPDATE FIELDS ( ... ) WITH VALUE #( ( %tky = ... ) )`351- **Delete**: `MODIFY ENTITY ... DELETE FROM VALUE #( ( %tky = ... ) )`352- **Execute Action**: `MODIFY ENTITY ... EXECUTE actionName FROM VALUE #( ( %tky = ... ) )`353- **Deep Create**: Use `CREATE BY \_Assoc` with `%cid_ref` and `%target`354355> For full EML syntax with code examples, read [references/eml-quick-reference.md](references/eml-quick-reference.md).356357## Draft Handling358359- Enabled via `with draft;` in BDEF header360- Requires separate `draft table` for each entity361- Draft table must include `"%admin": include sych_bdl_draft_admin_inc;`362- Draft actions (`Edit`, `Activate`, `Discard`, `Resume`, `Prepare`) are implicitly provided363- Use `%is_draft` component (or `%tky` which includes it) to distinguish draft vs. active instances364365## RAP Save Sequence366367| Phase | Methods Called | Purpose |368| -------------- | ------------------------------------------------------------------- | ------------------------ |369| **Early Save** | `finalize` → `check_before_save` → (on failure: `cleanup_finalize`) | Ensure data consistency |370| **Late Save** | `adjust_numbers` → `save` / `save_modified` → `cleanup` | Persist data to database |371372- Early save failures (sy-subrc = 4) return to interaction phase373- Late save is point of no return — either commit succeeds or runtime error374375## Key BDEF Derived Type Components376377| Component | Purpose |378| ----------- | ------------------------------------------------------------------- |379| `%cid` | Content ID — unique preliminary identifier for new instances |380| `%cid_ref` | Reference to a `%cid` in the same EML request |381| `%key` | Primary key fields |382| `%tky` | Transactional key (`%key` + `%is_draft` + `%pid`) — **recommended** |383| `%data` | All key and data fields |384| `%control` | Flags indicating which fields are provided/requested |385| `%is_draft` | Draft indicator (draft-enabled BOs only) |386| `%pid` | Preliminary ID (late numbering only) |387| `%target` | Target instances for create-by-association |388| `%param` | Action/function parameter values |389390## Best Practices391392- Always use `strict ( 2 );` for new BOs393- Prefer `%tky` over `%key` for future-proof code (handles draft/late numbering transitions)394- Always fill `%cid` in create operations even if not referenced later395- Use `IN LOCAL MODE` in handler methods to bypass feature controls and authorization checks396- Implement validations for data consistency checks, determinations for calculated fields397- Keep handler methods focused; use ABP auxiliary classes for shared logic398- For managed BOs, only implement handler methods for non-standard operations399400## References401402- [SAP ABAP Cheat Sheets — RAP BDL](https://github.com/SAP-samples/abap-cheat-sheets/blob/main/36_RAP_Behavior_Definition_Language.md)403- [SAP ABAP Cheat Sheets — EML](https://github.com/SAP-samples/abap-cheat-sheets/blob/main/08_EML_ABAP_for_RAP.md)404- [SAP Help — RAP Development Guide](https://help.sap.com/docs/abap-cloud/abap-rap/abap-restful-application-programming-model)405- [SAP Help — BDL Reference](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/ABENBDL.html)406- [ABAP Flight Reference Scenario](https://github.com/SAP-samples/abap-platform-refscen-flight)