Technology Blog Posts by Members
cancel
Showing results for 
Search instead for 
Did you mean: 

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
Jelena_Perfiljeva
Active Contributor

There are very many posts (this is just one example), tutorials, and other learning materials on ABAP RAP subject. Countless articles and videos outside of sap.com domain as well. Sorry but this post just adds nothing of value at this point.

It starts with misleading statements, such as: "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". ABAP RAP is a model for developing back-end services. It has nothing to do with front end. You still need to use something, like Fiori Elements or former AppGyver to create a front end for the OData service. Sure, those don't require any special language knowledge either but they're not part of ABAP RAP. Let's be clear about it.

And then "use EKKO and EKPO tables" - just why? It goes against Clean Core principles and common sense. If you want to create a custom service on top of purchasing data, at least use standard CDS views instead of tables directly. And maybe do OData V4 service instead of V2? Or at least mention such possibility?

And the thing like RAP Generator also exists, so we don't even need to write boilerplate code.

If you'd like to write on a subject that's been written about a lot before, it'd make sense at least to add more details and some personal experience. Otherwise what's the point. ¯\_(ツ)_/¯

mohit_johri1
Explorer

Excellent blog for someone new to the topic. Keep posting.  

Labels in this area