4.1Bloom · AnNot started

The RAP scaffold

Reading depth

What you'll learn

A managed RAP business object is five artefacts: a table, an interface CDS root view, a projection view, behavior definitions for both, and a service definition plus binding.

  • Five artefacts: persistence table, interface CDS root view entity, projection view, behavior definitions (interface + projection), service definition + binding.
  • The interface view is the model; the projection view is the per-service contract (provider contract transactional_query).
  • Behavior is layered too: the interface BDEF declares operations; the projection BDEF re-exposes them with `use`.

Every transactional app in ABAP Cloud is a RAP business object, and a managed BO is assembled from five mandatory artefacts. The persistence is a DDIC table (or a CDS table function over a custom table); on top of it sits an interface CDS root view entity — `define root view entity` — that carries the model and its annotations. That interface view is the stable, technical layer.

The projection CDS view exposes a tailored subset of the interface entity to one service, declared with `provider contract transactional_query`; this is the contract a UI or API actually consumes, so it can hide fields and add consumption annotations without disturbing the interface layer. Behavior is split the same way: a behavior definition for the interface entity (declaring create/update/delete, fields, validations, determinations) and a thin projection behavior definition that re-exposes the operations the service offers via `use create/update/delete`.

Finally a service definition (`define service`) lists which projection entities to expose, and a service binding turns that definition into a concrete protocol endpoint — OData V4 UI being the default for Fiori. The reason for the two-layer split (interface vs projection, BDEF vs projection BDEF) is decoupling: SAP and you can evolve the underlying model while each service keeps a narrow, versionable contract, which is exactly the Clean Core promise applied inside your own code.

Key points

  • Five artefacts: persistence table, interface CDS root view entity, projection view, behavior definitions (interface + projection), service definition + binding.
  • The interface view is the model; the projection view is the per-service contract (provider contract transactional_query).
  • Behavior is layered too: the interface BDEF declares operations; the projection BDEF re-exposes them with `use`.
  • The service binding fixes the protocol — OData V4 UI for Fiori transactional apps.
  • The two-layer split decouples model evolution from the consumed contract.

Examples

Interface root view entity

The persistence-facing model layer: a root view entity over the custom table, carrying keys, fields, and the etag-bearing change timestamp.

ABAP@accesscontrol.authorizationcheck: #check
@endusertext.label: 'Order Header'
define root view entity zi_orderheader
  as select from zorder_hdr
{
  key orderid,
      customerid,
      orderdate,
      total,
      currency,
      locallastchangedat
}
Behavior definition (interface)

Managed implementation, strict(2), with create/update/delete plus a validation and a determination on save — the declarative half of the BO.

ABAPmanaged implementation in class zbp_i_orderheader unique;
strict ( 2 );

define behavior for zi_orderheader alias orderheader
persistent table zorder_hdr
lock master
authorization master ( instance )
etag master locallastchangedat
{
  create;
  update;
  delete;
  field ( readonly ) orderid;
  field ( mandatory ) customerid, orderdate;
  validation validatecustomer on save { create; field customerid; }
  determination calculatetotal on save { create; update; }
}

Source notes: clean-core-curriculum §4.1

Ask Claude

Build a prompt from this lesson + your question and open a fresh Claude chat with it pre-filled — handy for adapting a before/after pattern to your own object.