ABAP RESTful Application Programming Model (RAP)

The ABAP RESTful Application Programming Model (RAP) allows developers to efficiently build cloud-ready, transactional business apps, services, and extensions on SAP BTP ABAP Environment, SAP S/4HANA Cloud Public Edition, SAP S/4HANA Cloud Private Edition, and SAP S/4HANA 1909 and higher. It is at the heart of the ABAP Cloud development model for transactional development scenarios.

Why learn RAP?

Why learn RAP?

The requirements for SAP business applications and their associated technologies have evolved significantly over the past years. Besides increasing requirements for embedded analytics and artificial intelligence, the main drivers of this evolution are:

SAP HANA – the high-performance in-memory database for real-time transactional and analytical processing.

SAP Fiori – the chosen, modern, intuitive, and cross-device UX design for the Intelligent Enterprise.

Cloud – with the increasing business needs for cloud operation support, ranging from hybrid, i.e., cloud and on-premise, to exclusively cloud operation models.

End users expect enhanced product qualities such as continuous and collaborative work – e.g., to start working at home, continue during commuting, and finalize the task at the company, or to accomplish tasks on different device types or collaboratively.

Product qualities - such as scalability, testability, supportability, extensibility, verticalization, and documentability - must be available out-of-the-box.

To meet these various requirements on the ABAP platform, SAP offers the ABAP RESTful Application Programming Model (RAP) on SAP BTP ABAP Environment and SAP S/4HANA, on-premise as well as in the cloud.

Basics

What is RAP?

The ABAP RESTful Application Programming Model (RAP) is an essential element of ABAP Cloud, the ABAP development model for building clean core compliant, cloud-ready business apps, services, and extensions on SAP BTP, SAP S/4HANA Cloud, and SAP S/4HANA. RAP is the heart of ABAP Cloud for building transactional SAP Fiori apps, OData-based services, and extensions.

RAP consists of a set of concepts, tools, languages, and powerful frameworks that help developers to build innovative, cloud-ready SAP Fiori applications, local and Web APIs; and to easily extend SAP standard applications on the ABAP platform, in the cloud as well as on-premise.

RAP offers a standardized development flow based on Core Data Services (CDS), the ABAP language, and business services in the modern, Eclipse-based ABAP Development Tools (ADT).

Different types of services, local APIs, and business events can be developed and modeled with RAP:

  • OData-based services for UI development to build delightful, role-based, responsive, and draft-enabled SAP Fiori apps
  • OData-based services for exposure as Web APIs
  • Lifecycle-stable and upgrade-safe local APIs can be provided via released RAP business objects interfaces
  • Business events that can be used for asynchronous communication to notify a consumer that a RAP BO has changed

Built-in options for testability, supportability, documentability, and extensibility such as ABAP unit tests, the ABAP cross trace tool, and knowledge transfer documents are provided along the RAP development stack.

A seamless integration of reuse components such as business events and change documents in the RAP framework is offered to lower the total cost of development. Developers can for instance easily enable the exposure of business events and allow the creation of change documents within RAP based applications.

SAP uses ABAP RAP to build new standard business applications and to modernize existing ones, and recommends it to its customers and partners for their own custom developments. 

Learn more: Evolution of the ABAP Programming | Modernization with RAP 

What is a business object?

Common term to represent a real-world business entity – such as ProductTravel, or SalesOrder – in enterprise application development. 

On a conceptual level, a business object (BO) consists of a data model, aka composition model, and its transactional behavior. In general, a business object contains:

  • several nodes, for example, the root node SalesOrder and the child nodes SalesOrderItems and ScheduleLine
  • standard transactional operations for creating, updating, and deleting business data
  • non-standard, application-specific transactional operations 

RAP offers different runtime implementation types for the implementation of the transactional business objects' behavior. The main ones are the managed BO runtime implementations and the unmanaged BO runtime implementations – typically used for greenfield and brownfield implementations respectively.

Learn more

What is a query?

A query is the connecting interface for read-only access to the database in OData services. It is used for list reports or analytical reports to process data.

As the non-transactional counterpart of a business object, it consists of a data model, generic and modeled query capabilities and a runtime. This threefold division is known from the BO concept. However, a query provides only read access to the database. Its runtime never modifies data, but only executes structured data retrieval, for example for filtering.

Learn more

What is a business service?

The ABAP development platform can act in the roles of aservice providerand aservice consumer(such as SAP Fiori UI client).

In the context of the ABAP RESTful application programming model, a business service is a RESTful service which can be called by a consumer. It is defined by exposing its data model together with the associated behavior. It consists of a service definition and a service binding. 

Learn more

What is a business event?

RAP natively supports event-driven architecture. RAP business events provide the solution to natively incorporate asynchronous communication into the RAP architecture. They allow developers to trigger follow-up processes for significant changes to a RAP business object.

Business events are defined and can be consumed with a RAP BO: As event provider, a developer defines an event in the behavior definition and raises it in the behavior implementation. The raised event can then be consumed locally in the same system using a local event handler class or remotely in another system using the SAP Event Mesh on SAP BTP. The latter consumption scenario requiring the creation of an event binding that maps the event to a namespace, a business object, and a business object operation. A RAP BO can consume such released events with an event consumption model that establishes the design-time consumption of an event from the SAP Event Mesh.

Learn more

Data modeling

ABAP Core Data Services (CDS) offers a data modelling infrastructure for defining semantically rich data models and easy access to advanced SAP HANA libraries and features using CDS table functions. The data definition language of ABAP CDS has been enhanced to natively support the definition of composition and behavior models of RAP BOs.

Learn more 

ABAP language

ABAP LANGUAGE

The ABAP language has gone through various evolutions since its inception. Its recent modernization – with a focus on simplification – has turned it into a more declarative and expression-oriented language, which allows developers to write more simple and concise ABAP code using language features such as inline declarations with type inference, new operation constructors, and filtering, grouping and virtual sorting operations for internal tables. The ABAP language has also been extended with the Entity Manipulation Language (EML), which is used to control the transactional behavior of RAP BOs.

Learn more: ABAP Keyword Documentation | Clean ABAP

ENTITY MANIPULATION LANGUAGE

EML offers an SQL-like syntax that allows developers to implement the transactional behavior of RAP business objects. It also offers a type-safe, API-based access to RAP BOs within and outside the RAP context. 

Learn more: EML@RAP Development Guide | EML@ABAP Keyword Documentation

Tools

ABAP DEVELOPMENT TOOLS FOR ECLIPSE

The ABAP Development Tools (ADT) is the integrated development environment on the well-known Eclipse platform for all standard ABAP development, quality assurance, and supportability tasks, both on on-premise and on cloud ABAP systems.

ADT offers a modern development toolset with many goodies such as syntax highlighting, code completion, code templates, advanced search and navigation, and quick fixes to increase developer productivity. Various eclipse-based editors, views, and features are provided. For instance, the Relation Explorer view is provided to explore the structure and capabilities of development objects such as RAP BOs. The ADT wizard Generate ABAP Repository Objects can be used to generate all required RAP artefacts for an OData service with managed implementation type based on a database table.

Moreover, powerful options and tools for testability and troubleshooting are provided in ADT.

Learn more

TESTABILITY

As an application developer, you want to verify the behavior of an application as a whole by writing and executing unit, scenario, and integration tests.

The ABAP platform and ADT provide powerful frameworks and tools to ensure high quality applications throughout the software development lifecycle. These include the ABAP Test Cockpit for performing static checks, the ABAP Unit test framework for testing, various Test Doubles Frameworks – e.g., for ABAP, SQL, CDS, and RAP business objects – for isolating the code under test, and the local OData client proxy for the API-based testing of OData services. 

Learn more

TROUBLESHOOTING

As an application developer, you want to be able to search for the origin of occurring semantic, functional, and performance issues and fix them.

ADT supports you in this by offer several advanced analysis and troubleshooting options and tools in the form of ADT views, for instance:

  • ABAP Debugger – used for troubleshooting the business logic implement in the backend.
  • ABAP Cross Trace – used for a semantic end-to-end analysis of OData-based services or business objects built with RAP. 
  • ABAP Profiling – used for analyzing the runtime behavior of an ABAP program.
  • Various ABAP CDS Tools – used to define and analyze CDS-based data models.

Learn more

Extensibility

RAP provides built-in, modification-free extensibility options for data models, behaviors, and nodes of RAP BOs as well as for service definitions.

Based on these RAP extensibility options, full-fledged and upgrade-stable extensions can be built on SAP S/4HANA Cloud using developer extensibility, where previously only limited key user extensibility options were available.

Learn more

Big Picture

Big Picture

Availability & Documentation

SAP ProductAvailable as ofLinks
SAP BTP ABAP Environment

All releases
SAP S/4HANA Cloud Public Edition
All releases
SAP S/4HANA and
SAP S/4HANA Cloud Private Edition
≥ 2021 (7.56)
(Limited feature
set available with
1909 and 2020)

Videos

DescriptionLinks
ABAP Cloud
Understand the purpose of RAP 
RAP at SAP TechEd events
RAP feature teaser videos 
Find videos on various ABAP Cloud features, incl. RAP
• ABAP Cloud playlist @SAP Developers channel
RAP at SAP's Devtoberfest 

Learn & Develop

Getting Started RessourceDescription & Links
ABAP Flight Reference Scenario for RAP
Check out end-to-end scenario implementations built with RAP or build your own app based on the sample data. All provided reference examples are explained in detail in the RAP Developer Guide. 
ABAP Flight Reference Scenario
SAP Fiori elements Feature Showcase App for RAP and ABAP CDS
Learn how to build SAP Fiori elements based UIs for your data model using RAP features and UI-specific ABAP CDS annotations.
Showcase App Overview (blog post)
SAP Fiori elements Feature Showcase App (GitHub)
Build RAP BOs and SAP Fiori elements Apps with RAP 
[Beginner Leve] Learn how to create a UI service based on a managed RAP BO starting from a database table using the ADT's RAP Generator:
• RAP100 Tutorials Mission

[Intermediate Level] RAP110 offers a more advanced example with features such as late numbering, virtual elements, side effects, different action types, and business events: 
• RAP110 workshop (GitHub)

Find more tutorials in the SAP Developer Center: 
• Tutorial Navigator
Developer Extensibility: Use ABAP Cloud for building cloud-ready services, apps, and extensions 
Various hands-on exercises with step-by-step instructions to learn how to build custom ABAP-based extensions, integrate them with standard SAP applications, and how to extend an existing RAP BO using the ABAP Cloud (incl. RAP) in S/4HANA Cloud, SAP S/4HANA, and SAP BTP.

[Beginner Level | RAP610] Exercises on how to build a new clean core compliant application and integrate it with a standard SAP SAP S/4HANA app:
RAP610 workshop (GitHub)

[Intermediate Level | RAP630] Exercises on how to extend a RAP BO that is extension-enabled in a the modification-free way:
• RAP630 workshop (GitHub)

[Intermediate Level] Exercises on how to integrate an existing API built with the classic ABAP development model into an application built with ABAP Cloud:
Mitigation of missing released SAP APIs in the 3-tier Extensibility Model
SAP learning and certification offerings
SAP offers a wide range of ABAP training courses  - including, e.g., HA400, S4D400, S4D430, and S4D437 - as well as various certification options:
SAP Training Catalog
SAP Certified Associate - Back-End Developer - ABAP Cloud
• More in the SAP Training Shop and SAP Learning

Free learning journeys on ABAP Cloud (incl. RAP): 
Learning the Basics of ABAP Programming
Acquiring Core ABAP Skills
Practicing Clean Core Extensibility For SAP S/4HANA Cloud  
• More in the SAP Learning Journeys Navigator
Clean ABAP Style Guide 
The Clean ABAP Style Guide on GitHub is is an adoption of Robert C. Martin's Clean Code for ABAP:
Clean ABAP Style Guide
Try it Now!

Try it Now!

You can explore the latest and greatest ABAP capabilities and features, such as the modern ABAP language syntax, ABAP Core Data Services (CDS), and the ABAP RESTful Application Programming Model (RAP). Several tutorials are available in the SAP Developer Center. All you need is:

  1. Access to a suitable ABAP system – e.g., the free SAP BTP, ABAP environment Trial (see tutorial)
  2. The latest ABAP Developer Tools (ADT) plugin on the latest Eclipse platform (see tutorial)

Deep Dives

Unmanaged BO implementation type

The BO implementation types provide different options for creating your development scenario with RAP. There are two main implementation types for RAP BOs, managed and unmanaged.

This section provide in-depth information on the unmanaged implementation type, which is typically used to reuse existing business logic, APIs, and application components in the RAP application infrastructure.

Reuse Services and Libraries

Reuse Services and Libraries

Reuse services and libraries help developers to save time when developing apps and services. They provide out-of-the-box generic functionalities to support domain-specific implementation and reduce boilerplate code in the development process. They come with the respective product environment, usually at no additional cost - but there may be exceptions - and can be used across all development scenarios. They are integrated with the programming models such as RAP.

Learn more