State-of-the-Art ABAP Development with the ABAP RESTful Application Programming Model (RAP)

The ABAP RESTful Application Programming Model (RAP) is the centerpiece of the ABAP Cloud development model for efficiently building cloud-ready, transactional business apps and extensions on SAP BTP ABAP Environment, SAP S/4HANA Cloud, SAP S/4HANA Cloud ABAP environment, and SAP S/4HANA 1909 and higher.

ABAP for Newbies

Are you familiar with ABAP?

If you're not, don't worry, just check this page before you go ahead: ABAP for Newbies.

Are you familiar with ABAP Cloud?

ABAP Cloud is the ABAP development model for building cloud-ready business apps, services, and extensions that adhere to the principles of clean core extensibility on the SAP Business Technology Platform (SAP BTP) and all SAP S/4HANA editions, in the cloud and on-premise.

If you're not familiar with it yet, don't worry, just read this blog post before you go ahead: ABAP Cloud.

RAP Overview

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.

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 business apps, 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 (blog post) | Modernization with RAP (blog post)

RAP Availability

SAP ProductAvailable as ofRelease Notes & RoadmapDocumentation
SAP BTP, ABAP environment
All releases
SAP S/4HANA Cloud
All releases
SAP S/4HANA and 
SAP S/4HANA Cloud, private edition
≥ 2021 (7.56)

(Limited feature
set available with
1909 and 2020)

💡 Core Concepts in RAP

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

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

Business Service

The ABAP development platform can act in the roles of a service provider and a service 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

💬Implementation Languages

ABAP Core Data Services (CDS)

ABAP 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 CDS Overview (pdf) | Getting Started (blog post) | ABAP Data Models GuideCDS Development Tools Guide  | CDS Keyword Documentation

Modern 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 for cloud-ready development

Entity Manipulation Language (EML)

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: ABAP Development User Guide (Cloud | On-Premise) | Tips and Tricks for ABAP CDS Tools (Cloud | On-Premise) | SAP's Central Update Site for Eclipse-based Tools

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: Ensuring Quality of ABAP Code | RAP Testability Guide

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: Troubleshooting Tools for RAP-based Apps 

🧩 Extensibility

About RAP 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: RAP Extensibility Guide (cloud) | RAP Extensibility Guide (on-premise)

📺 Videos

DescriptionLinks
ABAP Cloud
• Developer Discussion on ABAP Cloud (from 2022-11-29)
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 RessourceDescriptionLinks
RAP Reference Scenario
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.
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.
openSAP Course
Learn the core concepts of RAP at your own space. 

ℹ️ This course is based on the RAP feature set of SAP S/4HANA 2020. Updates can be found in SAP Learning Journeys, tutorials , and workshops such as RAP100 and RAP110. (see below)
Build an SAP Fiori App Using the ABAP RESTful Application Programming Model [RAP100]
Learn how to create a UI service based on a managed RAP BO starting from a database table using the ADT's RAP Generator with RAP100 (Beginner Level).

RAP110 (Intermediate Level) offers a more advanced example with features such as late numbering, virtual elements, side effects, different action types, and business events.
Developer Extensibility: Use ABAP Cloud for building cloud-ready extensions 
Various ABAP Cloud and RAP tutorials and workshops with step-by-step instructions to learn how to build custom ABAP-based extensions and how to extend an existing RAP BO using the ABAP Cloud programming model in SAP S/4HANA and SAP BTP.
SAP Learning Journeys 
Various free learning journeys on ABAP / ABAP Cloud (incl. RAP) can be found in the SAP Learning Journeys Navigator.
SAP Training and Certification opportunities
SAP offers a large training portfolio (e.g., HA400, S4D400, S4D430, and S4D437) and various certification opportunities in the SAP Training Shop and SAP Learning.
Clean ABAP Style Guide 
Clean ABAP Style Guide on GitHub

🏁Try it Now!

Setup your development environment

You can try out the latest and greatest ABAP platform capabilities and features right now; for example, the modern ABAP language syntax, the ABAP RESTful Application Programming Model (RAP), and the Entity Manipulation Language (EML).

You would need:

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

❓FAQs

Frequently Asked Questions