Technology Blog Posts by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Rijul_VN
Explorer
12,543

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:

Rijul_Haridasan_0-1719405864152.png

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).

         Rijul_Haridasan_2-1719405962814.png

         

Rijul_Haridasan_5-1719406138616.png

       

Rijul_Haridasan_6-1719406201461.png

  

  • Create two interface CDS views for showing master data of purchase order type and material details.

Rijul_Haridasan_7-1719406268505.png

Rijul_Haridasan_8-1719406312400.png

 

 

  • 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.Rijul_Haridasan_9-1719406407548.png

     

    • 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.

     

    Rijul_Haridasan_10-1719406543553.pngRijul_Haridasan_11-1719406620405.png

     

    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.

     

    Rijul_Haridasan_13-1719406801073.png

     

    Rijul_Haridasan_14-1719406869451.png

     

    Rijul_Haridasan_1-1719407201734.png

    As a last step, create the service binding for service definition.

    Rijul_Haridasan_2-1719407258464.png

     

    Rijul_Haridasan_4-1719407352780.png

    Set the binding type as OData V2 – UI, since this is an OData V2 service.

     

    Rijul_Haridasan_8-1719407475099.png

    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.

    Rijul_Haridasan_9-1719407529639.png

     

    Purchasing Doc Type Search Help

    Rijul_Haridasan_10-1719407587236.png

     

        Material Search Help

Rijul_Haridasan_11-1719407636266.png

 

Rijul_Haridasan_12-1719407740867.png

 

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.

This is just the beginning of what you can achieve with RAP. As you explore further, you will discover more advanced features and capabilities that can help you build robust, scalable, and user-friendly applications within the SAP ecosystem.

Happy Learning and exploring the vast possibilities with RAP!

 

References

https://help.sap.com/docs/abap-cloud/abap-rap/abap-restful-application-programming-model

https://help.sap.com/docs/abap-cloud/abap-rap/cds-annotations

 

 

 

2 Comments
Labels in this area