SAP Training Blog by Michael Management

Getting started with RESTful ABAP programming

Written by Ronak Hingorani | Mar 18, 2021

Introduction

The programming language for SAP, ABAP (Advanced Business Application Programming), is as old as SAP software, and it has been growing and evolving with each SAP release. SAP re-evaluated their processes with the advancement of SAP S/4HANA and decided to take their existing ERP solution to make it cloud-ready instead of completely reinventing the wheel for the Cloud. Also, showing a commitment to ABAP, SAP chose to build S/4HANA in ABAP. 

SAP regularly updated ABAP with inline declarations, chained method calls, string templates, functions, and constructor expressions; however, those had limited functionalities. Then there was an advancement of the ABAP Programming Model for SAP Fiori, and currently, SAP has come up with an advanced version of ABAP with the RESTful Programming Model.

With ABAP 7.4, SAP introduced CDS for data modeling and data access to optimize the ABAP platform for its in-memory HANA database. Additionally, gateway and BOPF (Business Object Processing Framework) became an integral part of all ABAP applications. 

Combining these concepts, SAP decided to support a RESTful communication between backend and frontend to enable efficient and standardized development of web-based applications and Web APIs. This RESTful ABAP is available to customers and partners within SAP Cloud Platform ABAP Environment, starting with release 1908. 

 

New to SAP ABAP Development?
Don't know what the ABAP Dictionary is, SAP Netweaver, how to use function modules or the SAP GUI?

Then take a look at these ABAP courses to get started.

 

RESTful ABAP Programming Model (RAP)

SAP has recently announced the ABAP RESTful Programming Model (RAP), which introduces a new behavior concept that is implemented directly in the ABAP language with the corresponding new syntax. ABAP RESTful Application Programming Model is available on SAP Cloud Platform ABAP environment and SAP S/4HANA. 

It allows the reuse of existing ABAP skills and software assets. The key pillars in the ABAP RESTful Programming Model are ABAP Developments Tools in Eclipse, CDS, and powerful frameworks. Let us understand these pillars in detail:

 

Tools: The approach to integrate all implementation tasks in one development environment optimizes the development flow and offers an end-to-end experience in one tool environment. New development artifacts support the application developer to develop in a standardized way.

Language: The ABAP language has been aligned and extended to support the development with the ABAP RESTful Programming Model, together with CDS. The application developer uses typed APIs for standard implementation tasks and benefits from auto-completion, element information, and static code checks.

Frameworks: Powerful frameworks represent another essential pillar of the ABAP RESTful Programming Model. They assume standard implementation tasks with options for the application developer to use dedicated code exits for application-specific business logic. Form an application developer perspective, ABAP Development Tool (ADT) and Language (ABAP and CDS) is something that we need to learn and upskill.

 

ABAP Programming Model Architecture

The ABAP RESTful Application Programming Model (RAP) defines the architecture for efficient end-to-end development of SAP HANA-optimized OData services in SAP Cloud Platform ABAP Environment or Application Server ABAP. 

The architecture shows the three main layers for RAP, i.e., Data Modeling and Behavior, Business Service Provisioning, and Service Consumption. Let us simplify this with example and assume we are creating a FIORI application to create/read/update/delete a Sales Order.  

 

Data Modeling and Behavior – Business object models and query definitions are specified in this layer, along with the definition of transactional behavior. In reference to our example, we would create a database table here using ADT (Eclipse) and use CDS (Core Data Services) to expose this data. Additionally, the table behavior will be defined here as soon as the CDS is defined as a root entity. 

Business Service Provisioning – Here, the OData exposure of the backend data occurs in two steps: first, the protocol service scope definition where the relevant data model entities are specified, and second, the proper binding to the OData protocol.  

In our example, assume we have 100 CDS views for sales-related objects, and we need to expose just one sales order to the outside world, Business Service Provisioning can achieve this. To get started with OData and building your first web service, we highly recommend this training course: Create, Test, Debug & Analyze Your First SAP OData Service

Service Consumption – This layer is where scenario-dependent consumption occurs. For example, consumption can be used for UI services using SAP Fiori Elements or can be used for other non-SAP Web APIs. 

 

What are the changes for SAP ABAP developers? 

SAP is progressively changing, and a lot of us are confused about how ABAP programming is going to change in the future. First, we all know that Core Data Services (CDS) is the primary language for development and modeling in the future. Thus it is highly recommended for ABAP developers to learning more about Core Data Services and implement it in their current environment. Please have a look at Core Data Services to understand more about CDS and its implementation. 

Second, using Eclipse as ADT for all development tasks is the best way to get familiar with it. With ADT, the significant change is that developers do not need to remember complex transaction names.

All transaction codes are now integrated as options in ADT and logical places in the menu for user selection (for instance, creation of the table, creation of CDS, creation of service definition, and binding). Also, developers who are already working on cutting-edge ABAP programming model for FIORI have a scope of integration with RESTful ABAP programming model in the future. 

Overall, you should now have a high-level understanding of how and why SAP came up with this new RESTful programming model, ABAP RESTful Programming Model architecture. Additionally, you should be familiar with behavior definition, service definition and binding, Core Data Service Model, and how, as an ABAP developer, you can be ready for change. 

 

Familiarize yourself with the new emerging Cloud ABAP on which developers can build and run ABAP code in the Cloud using ABAP on SAP HANA Cloud Trial Platform. This will give you a head start with registering for an ABAP trial on the SAP HANA Cloud Platform, learning the difference between ABAP versus ABAP Cloud, and creating your first SAP application ABAP cloud project with ADT tools.