SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software
Development resources, articles, tutorials, code samples, tools and downloads for SAP HANA and ABAP, HANA Database, SQLScript, SAP UI5, Screen Personas, Web Dynpro, Workflow

Service is not active OData Exposure from SAP CDS View

It is possible to expose a CDS View as an OData Service using annotation @OData.publish:true in CDS view definition. On SAP HANA Studio or ABAP Development Tools, if you get errors on OData exposure like "Service ... is not active", ABAP developers can solve the problem and activate the service using SAP Activate and Maintain Services transaction

First of all, ABAP programmers should use the ABAP Development Tools for creating the DDL source of the CDS view.
As a second step create the CDS view DDL source and add OData annotation @OData.publish:true in the CDS view definition as follows:

@AbapCatalog.sqlViewName: '/S4/SOM_INFINV'
@OData.publish: true
define view /s4/som_inf_invoice

With the activation of the CDS view the SADL (Service Adaptation Description Language) framework creates the OData model definition and the service runtime automatically.

Recently, when I activated my sample CDS view which has the @OData.publish attribute, I got following warning messages.
Although the CDS view created and activated, the OData was not.

Here is the warning message related with OData publishing directly from CDS view using annotations

Service /../SOM_INF_INVOICE_CDS is not active [OData Exposure]

OData service is not active [OData Exposure]

The solution for this error which prevents consuming of CDS view data by an OData service is as follows:

Using SAP transaction /IWFND/MAINT_SERVICE Activate and Maintain Services transaction, switch to "Add Selected Services" screen using the "Add Service" button add OData Service

In the Backend Services list waiting to be published, you will find the CDS view OData service.

SAP Backend Services list including CDS View OData service

If you click on the technical service name and display details about the OData service, you will realize that some information is missing like the Package Assignment.
Besides package assignment, a second point that I would like to correct at this point is the technical service name and the technical model name missing namespace replaced with "Z" name.

CDS View OData service definition

After package assignment and other modifications are completed, click OK to add the Odata service to the Service Catalog

Now SAP users or ABAP developers can call and test OData service published from CDS View with @OData.publish:true annotation on SAP Gateway Client tool.


Install SAP Free
CRM Companies List
Web Based CRM Software

Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.