Modern ABAP Development with the ABAP RESTful Application Programming Model (RAP)

The ABAP RESTful Application Programming Model (RAP) is the new ABAP programming model for efficiently building cloud-ready enterprise apps and upgrade-stable 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 not, no problem, check out this page before you go ahead: ABAP for Newbies.

Why Learning the ABAP RESTful Application Programming Model (RAP)

Why 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) consists of a set of concepts, tools, languages, and powerful frameworks which help developers both to build innovative, cloud-ready, enterprise applications of different domains, such as transactional and analytical apps; 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 and local APIs can be developed 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
  • InA1-based, analytical services for building analytical apps
  • Services for the SQL-based read access to data from ODBC2-based clients
  • Lifecycle-stable and upgrade-safe local APIs can be provided via released business objects, aka business objects interfaces

(1 SAP Information Access Protocol | 2 ODBC: Open Database Connectivity)

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 RAP to build new and modernize existing standard applications and recommends its customers and partners to use it for their custom developments. 

Learn more: Modernization with RAP (blog)

Availability

Roadmap

The RAP feature scope is enhanced on a quarterly, bi-yearly, and yearly basis on SAP BTP, SAP S/4HANA Cloud, and SAP S/4HANA respectively.

More information about the current roadmap can be found in the interactive SAP Road Map Explorer.

Core Concepts in RAP

Query

Connecting interface for read-only access to the database in services. It is used, for example, to build simple and analytical queries for Fiori list reports, Fiori analytical reports, or SAP Analytics Cloud stories to process data. 

As the non-transactional counterpart of a business object, it consists of a data model defined with Core Data Services (CDS), generic and modeled query capabilities, and a runtime.

Learn more

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

Business Service

The ABAP platform can act as a service provider and/or a service consumer, such as the SAP Fiori UI client. 

In the context of RAP, 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

Tools

ABAP Development Tools in 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. It is the successor of the ABAP Workbench (SE80) and is available starting with ABAP release 7.31.

ADT offers a modern development toolset with many goodies such as:

  • syntax highlighting
  • code completion
  • code templates
  • advanced search and navigation
  • quick fixes to increase developer productivity
  • various eclipse-based editors, views, and features, such as the Relation Explorer, used to explore the structure and capabilities of development objects such as RAP BOs

Alongside the classic ABAP development, ADT provides full support for development with ABAP Core Data Services (CDS), ABAP Managed Database Procedures (AMDP), and the ABAP RESTful Application Programming Model (RAP).

ADT offers the wizard Generate ABAP Repository Objects to generate all required RAP artefacts for an OData service based on a database table.

In addition to classical documentation options for development objects, developers can document their source code inline using ABAP Doc Comments or development objects using Knowledge Transfer Documents. 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 – which is used for troubleshooting the business logic implement in the backend.
  • ABAP Cross Trace – which allows a semantic end-to-end analysis of OData-based services or business objects built with RAP. 
  • ABAP Profiling – which is used for analyzing the runtime behavior of an ABAP program.
  • Several CDS tools which help in defining and analyzing CDS-based data models.

Learn more: Troubleshooting Tools for RAP-based Apps 

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) | CDS Development User 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

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 Keyword Documentation

Extensibility

About the RAP Extensibility

RAP offers extensibility options to develop lifecycle-stable and upgrade-safe extensions for RAP business objects on each layer of the RAP development stack. These options enable the development of full-fledge, upgrade-stable extensions on SAP S/4HANA Cloud where so far only limited key user extensibility options were available. Built-in extensibility options for data models, behaviors, and nodes of RAP BOs are provided.

The illustration below shows the extensibility options for RAP business objects. An extensibility option for service definition objects is planned and will be delivered at a later time (refer to the roadmap).

Learn more: RAP Extensibility Guide

Sample Implementations

ABAP Flight Reference Scenario

The ABAP Flight Reference Scenario is a simple and easy to use data model intended for demo purposes, which is used in the SAP documentation and training courses – mainly in the context of RAP. It offers several examples that can serve as reference implementations of the various capabilities provided by RAP. The different implementations are explained in the RAP development guide on the SAP Help portal.

The reference scenario (package /DMO/FLIGHT) is not an integral part of the ABAP platform but must be imported from GitHub into the respective ABAP systems before use.

Learn more: Cloud Flavor | On-Premise Flavor

Other Sample Implementations

You can find more ABAP and RAP sample implementations here.

SAP Education

Free materials

SAP Training and Certification opportunities

Go to training.sap.com and search – e.g., HA400, S4D400, S4D430, and S4D437

    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 syntax, the ABAP RESTful Application Programming Model (RAP), and the Entity Manipulation Language (EML).

    All you need are:

    1. The access to an appropriate ABAP system – e.g., SAP BTP ABAP Environment Trial
    2. The latest ADT plugin on the latest Eclipse platform (see tutorial)

    FAQs

    Frequently Asked Questions