ABAP RESTful Application Programming (RAP) is a modern programming model introduced by SAP for developing Fiori applications and OData services efficiently. It simplifies the development of SAP Fiori apps by providing a standardized way to create business objects, services, and UIs.
RAP is built on top of CDS (Core Data Services) and OData, leveraging the power of ABAP on the SAP BTP (Business Technology Platform) and S/4HANA.

Key Concepts of ABAP RAP
1. Business Object (BO)
A Business Object in RAP represents an entity (like a Sales Order, Customer, or Product) and consists of:
- Behavior Definition: Defines CRUD operations (Create, Read, Update, Delete) and validations.
- Behavior Implementation: Contains the actual ABAP logic for the operations.
- CDS Entity: Defines the data model using Core Data Services.
2. Behavior Definition (BDEF)
The Behavior Definition specifies the operations allowed on a Business Object. Example:
define behavior for ZI_SALESORDER alias SalesOrder
{
create;
update;
delete;
association _Items { create; }
}
3. Behavior Implementation (BIMP)
This is where the actual logic for Create, Read, Update, and Delete (CRUD) is implemented. Example:
CLASS lhc_salesorder DEFINITION INHERITING FROM cl_abap_behavior_handler.
PRIVATE SECTION.
METHODS validateCustomer FOR VALIDATE ON SAVE
IMPORTING keys FOR SalesOrder~validateCustomer.
ENDCLASS.
CLASS lhc_salesorder IMPLEMENTATION.
METHOD validateCustomer.
" Logic to validate customer
ENDMETHOD.
ENDCLASS.
4. CDS Views (Data Model)
CDS (Core Data Services) defines the data structure. Example:
@AbapCatalog.sqlViewName: 'ZSALESORDER'
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Sales Order Header'
define view ZI_SalesOrder as select from vbak {
key vbeln as SalesOrder,
erdat as OrderDate,
kunnr as Customer
}
5. Service Definition & Binding
- Service Definition: Exposes the CDS entities as OData services.
@EndUserText.label: 'Sales Order Service'
define service Z_SALESORDER_SERVICE {
expose ZI_SalesOrder as SalesOrders;
}
Service Binding: Maps the service to a protocol (OData V2/V4).
Steps to Create a RAP Application
1. Create a CDS Entity
Define the data model using CDS.
2. Define Behavior
Specify CRUD operations in the Behavior Definition.
3. Implement Behavior
Write ABAP logic in the Behavior Implementation.
4. Expose as a Service
Define a Service Definition and bind it to OData.
5. Test in Fiori Elements App Preview
Use the Service Binding to preview the Fiori app.
Advantages of ABAP RAP
Standardized Development: Follows SAP best practices.
Efficient UI Generation: Fiori Elements apps are auto-generated.
Reusability: Business Objects can be reused across apps.
Cloud & On-Premise Support: Works on S/4HANA and SAP BTP.
ABAP RAP simplifies SAP Fiori app development by providing a structured and efficient way to define business objects, behaviors, and services. Beginners should start with basic CRUD operations and gradually explore advanced features like validations, determinations, and side effects.
By mastering RAP, developers can build modern, scalable, and maintainable SAP applications efficiently.