如何基于SAP CDS view创建OData服务

Prerequisite

you should have a working CDS view. Refer to this link about how to create CDS view.

Steps

Just add one annotation and re-activate your view:

如何基于SAP CDS view创建OData服务
如何基于SAP CDS view创建OData服务

Take my view for example, the following artifacts are automatically generated during activation.

如何基于SAP CDS view创建OData服务

The MPC class:

如何基于SAP CDS view创建OData服务

After activation you can register the created odata service via tcode /IWFND/MAINT_SERVICE.

如何基于SAP CDS view创建OData服务
如何基于SAP CDS view创建OData服务
如何基于SAP CDS view创建OData服务
如何基于SAP CDS view创建OData服务

Once done, you can test the metadata retrieval via gateway client.

Note: this is just a dummy odata service since there is no other OData related annotation except @OData.publish. Please continue to read if you need to define some model node using OData annotation.

如何基于SAP CDS view创建OData服务

本文来自云栖社区合作伙伴“汪子熙”,了解相关信息可以关注微信公众号"汪子熙"。