βš™οΈSAPTools
πŸ“š

SAP RAP Quick Reference

ABAPNew

Complete quick reference for SAP Restful ABAP Programming (RAP). Covers behavior definitions, projections, determinations, validations, actions, and draft handling with code examples.

RAP Architecture Layers

RAP (RESTful Application Programming Model) is built on three layers: CDS data model, behavior definition, and service projection.

" Layer 1: CDS Interface View (I_)
define root view entity ZI_SalesOrder
  as select from zsales_order
  ...

" Layer 2: Behavior Definition (BDEF)
managed implementation in class zbp_i_salesorder unique;
  ...

" Layer 3: Service Definition + Binding
define service ZUI_SalesOrder_O2 {
  expose ZC_SalesOrder as SalesOrder;
}

Behavior Definition Types

Choose the right behavior type based on where business logic lives.

" Managed: SAP handles CRUD automatically
managed implementation in class zbp_i_salesorder unique;

" Unmanaged: You implement all CRUD in your class
unmanaged implementation in class zbp_i_salesorder unique;

" Abstract: For reuse scenarios (no direct transactional use)
abstract;

" Projection: Restricts a managed behavior for a UI scenario
projection;

Advertisement

Frequently Asked Questions

What is SAP RAP?

SAP Restful ABAP Programming (RAP) is the modern framework for building SAP Fiori apps and OData services on SAP S/4HANA and BTP ABAP Environment. It replaces the legacy CDS + Gateway approach with a unified, annotation-driven model with built-in draft handling.

What are the main layers of a RAP business object?

A RAP BO has: (1) Base CDS views (data model), (2) Behavior Definition (BDEF) defining create/update/delete capabilities and custom actions, (3) Behavior Implementation class (ABAP class with handler methods), and (4) Projection CDS views + Projection BDEF for the service exposure.

What is RAP draft handling?

Draft handling allows users to save incomplete data temporarily without activating it. RAP generates draft tables automatically when you add "with draft;" to the BDEF. Users can resume editing later, and the Fiori UI shows draft indicators. It is controlled by @Draft.enabled: true annotations.