Introduction
The SAP landscape has evolved significantly, with businesses seeking simpler, more efficient solutions that offer excellent user experiences. Many organizations remain deeply embedded in the SAP ecosystem, primarily focusing on ABAP over other languages. So, is it possible to develop feature-rich applications without other frontend languages? Yes, leveraging ABAP with RAP (ABAP Restful Application Programming) makes it possible.
Restful Application Programming is an ABAP programming model for creating business applications and services in an AS ABAP or BTP ABAP environment. RAP offers a standardized way of developing applications using Core Data Services (CDS), the modernized extended ABAP language, OData protocol, and the concept of business objects and services. RAP applications can only be created through ABAP development tools (ADT) and it’s available in SAP BTP ABAP Environment, SAP S/4 HANA Cloud, and AS ABAP >=7.56.
Before digging deeper into RAP, let’s explore CDS, annotations, and business services. To illustrate these concepts, let’s create a simple read-only list report application.
Developing an OData Service for simple list reporting
An OData service follows the best practices for developing and consuming RESTful APIs. This service can be used in SAP Fiori applications and can also be exposed as Web APIs. Below are the steps for creating a simple list report application:
Let’s explore each step in detail by creating the application.
Sample requirement: Create a read-only list report application which shows purchase order information.
- Create an interface CDS view which takes data from Purchase Order Header (EKKO) and Item (EKPO).
- Create two interface CDS views for showing master data of purchase order type and material details.
- Make an association between the purchase order type CDS view and material details CDS view from the purchase order header/item CDS view. The associated views will act as Search Help in the list report after applying the annotations.
- Create a consumption view on top of the Purchase Order Header/Item interface view (ZI_PURCHASE_ORDER_RVN).
The UI annotations needed for the application are written in the consumption CDS View or Metadata Extensions.
Now, we have the data model and the required annotations to manifest semantics for it. The next step is to create the OData service and binding the service.
To define a service, we first need to create a service definition. In service definition, we specify the CDS entities that need to be exposed. In this example, the gateway client is replaced by the service definition and service binding.
As a last step, create the service binding for service definition.
Set the binding type as OData V2 – UI, since this is an OData V2 service.
After publishing the service, the exposed entity and associated entities will be visible. Click on the entity and click the preview button to see the preview of the application.
Purchasing Doc Type Search Help
Material Search Help
Conclusion
This blog serves as an introduction to developing OData services for simple list reporting using the ABAP Restful Application Programming (RAP) model. By following the steps outlined, you can create a read-only list report application that showcases purchase order information. We have covered the basics of creating CDS views, defining and binding OData services, and incorporating annotations for enhanced functionality.