ABAP CDS ON HANA-(12)ODATA Service

Create a CDS view and we have the view type as ‘BASIC’ view

ABAP CDS ON HANA-(12)ODATA Service

To publish this as oData, add the annotation as: @OData.publish: true

ABAP CDS ON HANA-(12)ODATA Service


@AbapCatalog.sqlViewName: ‘ZFLIGHT_VW’
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: ‘Flight View CDS’
@VDM.viewType: #BASIC
@OData.publish: true
define view Zflight_View 
as select from sflight
{ 
key sflight.carrid, 
key sflight.connid, 
key sflight.fldate, 
sflight.price, 
sflight.currency, 
sflight.planetype, 
sflight.seatsmax, 
sflight.seatsocc
}

  


Activate the view. Then a symbol would appear at the line: @OData.publish: true, whihc tells that a service ‘ZFLIGHT_VIEW_CDS’ created and we have to add this service on Tx- /IWFND/MAINT_SERVICE

ABAP CDS ON HANA-(12)ODATA Service


Go to the Tx- /IWFND/MAINT_SERVICE, click on Add Service button

ABAP CDS ON HANA-(12)ODATA Service

Provide the alias name, and the service name and hit enter key.

ABAP CDS ON HANA-(12)ODATA Service

The created service will appear in the list. Select the service and click on Add Selected Service.

ABAP CDS ON HANA-(12)ODATA Service

Select local object and continue.

ABAP CDS ON HANA-(12)ODATA Service

The information appears.

ABAP CDS ON HANA-(12)ODATA Service

In the hana studio, activate the the view and a new symbol appears at the line’@OData.publish: true’ . Put the cursor on the mark

ABAP CDS ON HANA-(12)ODATA Service

Click on the link: OData-Service

ABAP CDS ON HANA-(12)ODATA Service

Here is the service. Now change the url and put ‘$metadata’

ABAP CDS ON HANA-(12)ODATA Service


 

So here the service metadata information appears.

sap/opu/odata/sap/ZFLIGHT_VIEW_CDS/$metadata

ABAP CDS ON HANA-(12)ODATA Service


 

To execute the view and get the details, change the url sap/opu/odata/sap/ZFLIGHT_VIEW_CDS/Zflight_View

It returns all the entries.

ABAP CDS ON HANA-(12)ODATA Service

 

上一篇:django的model字段在保存的时候做预处理怎么办?


下一篇:2019.09.24学习整理 数据库的字段操作、多表关系、外键