The first decision in every RAP project
Before you write a line of RAP code, you answer one question: managed or unmanaged? It determines who implements the standard CRUD operations — the framework, or you.
Get this wrong and you either fight the framework for weeks or hand-write boilerplate the framework would have generated for free. Here's how to choose.
Managed: the framework does the heavy lifting
In the managed scenario, you declare the behavior and RAP implements create, update, and delete for you. You only write the business logic that makes your object special: validations, determinations, actions.
managed implementation in class zbp_i_salesorder_tp unique;
define behavior for ZI_SalesOrder_TP
persistent table zsalesorder
draft table zdraft_order
lock master
{
create;
update;
delete;
validation checkTotals on save { field NetAmount; }
determination setStatus on modify { field Status; }
action approveOrder result [1] $self;
}
Notice what's missing: there's no code for create, update, or delete. The framework handles persistence, locking, draft tables, and ETags. You declare; it executes.
Default to managed. If your data lives in standard transparent tables that RAP can access directly, managed is almost always the right call.
Unmanaged: you own everything
In the unmanaged scenario, the framework implements nothing. Every operation — create, update, delete, and even the draft actions if you want draft — gets a method in your behavior implementation class that you write by hand.
unmanaged implementation in class zbp_i_legacy_order_tp unique;
define behavior for ZI_LegacyOrder_TP
{
create;
update;
delete;
}
Behind that short declaration sits a lot of code: reading existing data, applying changes, handling locks, managing the draft cycle. It's real work, and you should only take it on for a good reason.
When unmanaged is actually justified
- Non-standard persistence. Data lives behind a remote API, a legacy table structure RAP can't map, or a function module you can't bypass.
- Reuse of proven logic. A battle-tested legacy implementation (BAPIs, existing classes) that you want to wrap rather than rewrite.
- Exotic transaction behavior. Save sequences the managed runtime can't express.
Even then, consider the middle path: a managed behavior where only specific operations are delegated to custom implementations. You don't have to go fully unmanaged to customize one awkward operation.
The decision, as a rule of thumb
Ask one question: can the framework reach my tables directly? If yes — managed. The draft handling, locking, and ETag management you get for free are worth more than the control you give up.
Teams that default to unmanaged "for flexibility" usually end up re-implementing the managed runtime badly. Flexibility you don't use is just maintenance burden.
If yes-but-complicated — say, one operation needs special handling — stay managed and implement just that operation yourself. Reserve fully unmanaged for the genuinely exotic cases.
Which scenario did your last RAP object use — and would you choose differently now? Drop it in the comments.