It is a file (with .behavior extension) that specifies the business behavior of an entity (CDS view), and it controls:
- Which operations are allowed
- Which fields are modifiable
- Which validations or determinations are triggered
- Custom logic, like actions
Key Purposes of Behavior Definition
| Function | Description |
|---|---|
| Enable CRUD operations | Define if create, update, delete are allowed |
| Locking | Prevent data conflicts in multi-user scenarios |
| Draft Support | Support for draft-enabled objects (save without activation) |
| Field Control | Mark fields as read-only, mandatory, etc. |
| Validation/Determination | Attach logic to auto-fill or validate fields |
| Actions | Define custom operations like Submit, Approve, etc. |
unmanaged implementation in class ZBP_SalesOrder unique;
define behavior for ZI_SalesOrder
persistent table zsalesorder
lock master
{
create;
update;
delete;
field ( readonly ) CreatedBy, CreatedAt;
field ( mandatory ) CustomerID;
action SubmitOrder result [1] $self;
}
Types of Implementation
| Type | Description |
|---|---|
| Managed | SAP manages most logic automatically |
| Unmanaged | You write full logic in ABAP classes |