Show TOC

Expose CDS View as an OData ServiceLocate this document in the navigation structure

OData Exposure

With the concept of OData exposure, a new and simple way of creating OData services has been introduced. Here, the OData model definition as well as the OData service runtime is provided generically, based on SADL (Service Adaptation Description Language).

The requirement here is that the annotation @OData.publish:true is specified at the view level.

 @AbapCatalog.sqlViewName: 'SQL_VIEW_SAMPLE'
 ...
 @OData.publish: true
 define view CDS_VIEW_NAME as select from 
           ...
 }
			
Exposure Process

The following figure depicts the main components of the exposure process and refers to the most important activities that are involved:

Starting in ABAP Development Tools, you open the relevant DDL source where the CDS view in question is implemented. After you have added the OData annotation to the CDS view, you can trigger the activation of the entire DDL source. ABAP Development Tools delegates the activation request to SADL framework. SADL generates several SAP Gateway artifacts that are stored in the back end of the application server AS ABAP and are required for OData service activation in the SAP Gateway hub system.

In the next step, you need to launch the transaction /IWFND/MAINT_SERVICE to add the OData service to the service catalog of the SAP Gateway hub. In this way, the actual OData service is created in the SAP Gateway and the back-end system is assigned as a data source using the system alias.

As soon as the OData service is activated in the SAP Gateway hub, it is ready for consumption through an OData client, such as an SAP Fiori app.
Included components and involved activities when exposing CDS view to OData
Figure 1: Included components and involved activities when exposing CDS view to OData
Developer-Relevant Tasks

Task 1: Generate Service Artifacts From a CDS View

As a result of this task, several service artifacts are generated in the back end of the application server.

Task 2: Activate OData Service in the SAP Gateway Hub

As a result of this task, the OData service is added to service catalog of the SAP Gateway hub and is ready for consumption.

Task 3: Test the Activated OData Service