SAP ABAP RESTful Programming Model (RAP)

11 Aug SAP ABAP RESTful Programming Model (RAP)

Curt Timmerman

As user experiences have evolved from interactions with SAP GUI applications to applications built on SAP Fiori and other web-based applications which consume OData Services, SAP has released an evolutionary change in its programming model. SAP has created the ABAP RESTful Programming Model to support a new user experience as well as the optimization of HANA environments by pushing workloads down to the HANA. SAP has assigned the abbreviation RAP to the full name RESTful ABAP programming model. RAP is the most efficient method to build OData services for Fiori and other Web APIs based on OData services.

The benefit to users is the interaction with applications that behave naturally on all devices and applications which adapt to the footprint of each device. The benefit for developers is they have a toolset that allows them to streamline the development of these applications while taking advantage of the pushdown capabilities of HANA. RAP can be used to develop new applications as well as integrate them into existing applications based on OData services.

The ABAP RESTful Programming is available in the SAP BTP ABAP Environment which was previously named the SAP Cloud Platform as well as in S/4 HANA. It has also been available in S/4 HANA since release version 1909.

The architecture of the RAP model is

I learned about the ABAP RESTful Programming Model by enrolling in a free course offered by SAP on open.sap.com. Besides SAP offering instruction on the new technology, they have also provided a practice system “The SAP Business Technology Platform” which is a shared Cloud System. SAP has provided access free for one year after signup. The system comes pre-loaded with the typical Flight booking tables. Each developer can create their own packages and development objects, but as it is a practice system, their objects are not private. All development is done in Eclipse with the ABAP Development Tools add-in. For those of us that have grown up in the ABAP Workbench accessed via the SAPGUI, this course is a nice transition in the Eclipse Environment.  SAP has been moving towards this access for the last several years.

The RAP programming model has an implementation type of managed or unmanaged. The managed implementation provides out-of-the-box support for transactional data standard operations of Create, Update and Delete. In an unmanaged implementation, the developer is responsible for implementing these operations. A managed implementation can also provide draft capabilities that save data in an interim draft state in a draft table. It can be started on any device and dropped and picked up on other devices. A managed solution simplifies a greenfield implementation, but an unmanaged implementation makes a bridge to integrating legacy applications into a new OData solution.

The following steps are necessary to build a managed implementation.

Define Base Structures

  • Create your table in the ABAP dictionary.
  • Create CDS “Core Data Service” Interface view. CDS views define the transactional data relationships and the master data associations. CDS views are the SAP’s next generation of data modeling, and it is the cornerstone of RAP development.

 

Specify Business View

  • Create the CDS Projection view. The projection view represents a hierarchy consumption view of a business object and exposes only the elements needed for a business service. It also specifies value helps and search helps. SAP also provides a template for this step, “Define Projection View”
  • Create Meta Data Extension. Use template Annotate View. This defines properties of the Fiori App such as Header Information, facets of the view, and position of elements within the view as well as defining the filters for the view.

 

Implement Business Behaviors

  • Create the Behavior Definition. This object defines all the actions for a Business Object. Beyond the Create, Update, and Delete which is provided by the managed solution. It will define additional actions, determinations, and validations. An example of an additional action may be Accept or Reject. Determinations are fields that are calculated from the data and validations are defined to ensure data is correct. This is also specifying whether draft handling is enabled.
  • Implement the behavior definition. The ABAP code implements actions beyond Create, Update, and Delete, as well as the code for the determinations and validations. In an unmanaged implementation, it would also have the code for the Create, Update and Delete. It makes use of Entity Manipulation Language (EML) to interact with the business object for functions such as reading and updating data. It also has a failed structure to records that do not pass the validation logic.
  • Define the Behavior Projections. This defines which actions will be exposed to the business service. As an example, Delete may be defined but not used in a specific business scenario.

 

Publish Business Scenario

  • Define the Service Definition. This defines the scope of a business service, which entities are being exposed but does not specify an OData protocol
  • Define Service Binding. This binds a Service Definition to a specific OData protocol such as OData V2

CDS views have been part of NetWeaver since 7.4, but developers previously had to manually implement the Gateway Services. The RAP model is built on top of the data model defined by the CDS views. As SAP Fiori is the preferred User Interface for the future, the RAP model enables an easier method of releasing Gateway Services to be consumed by Fiori as well as other web services.

RAP supports integrated debugging between a browser Fiori application and the backend code in Eclipse as well as access to the Gateway error log. The Eclipse environment also provides tools to analyze issues in the CDS data model.

Much of the work within RAP can be performed with very little coding by relying on such features as annotations to control the behavior of Fiori applications.

The RAP model supports a consistent user experience within SAP Fiori as well as enabling the same services to be consumed by external Web APIs and is built on top of CDS views, it allows for efficient applications as work is pushed to the database allowing for application scalability. The RAP model has many wizards and prompts.  The Eclipse environment guides a developer through much of the development process allowing the developer to create the background for modern Fiori applications or web-based services.

1Comment
  • Troy N Timmerman
    Posted at 21:29h, 12 August Reply

    Thanks for the overview on using Restful interfaces with SAP

Post A Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Become A Partner

If you have a strong SAP background and a
“Whatever it takes” attitude , submit your resume.