Technology Blogs 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: 
Omkar_Ghadashi
Explorer
0 Kudos

Hi All,

This Blog is regarding the exposing the SAP CAP service as V2 or V4 OData Service as per the requirment.

As you know, Smart Controls are only compatible with OData V2 [Reference].In order to use Smart Controls, the OData metadata document needs to contain a few key elements such as the "sap:" annotations. So for such requirements we can use the OData V2 Adapter for cds.

1) Create the SAP CAP Project using template.

oghadashi_0-1711543367400.png

2) Add the Service and Data definition in SRV and DB folder respectively

oghadashi_2-1711543469712.png

 

oghadashi_1-1711543446378.png

or you can select the Minimal sample to add the sample content for your project

oghadashi_3-1711543557356.png

3) install the adapter package to your project "npm add @cap-js-community/odata-v2-adapter"

oghadashi_0-1711543659928.png

4) Add the Plugin to package.json

oghadashi_1-1711544011674.png

5) execute the project and you will find the service being exposed in V2 and V4.

oghadashi_2-1711544212692.pngoghadashi_3-1711544235204.pngoghadashi_4-1711544253494.png

Hope this is helpful for you !!

Reference:

1) Serving OData APIs | CAPire (cloud.sap)

2) @cap-js-community/odata-v2-adapter - npm (npmjs.com)

Thanks,

Omkar

Labels in this area