ABAP CDS ON HANA-(12)ODATA Service

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

1

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

2


@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

3


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

4

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

5

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

7

Select local object and continue.

8

The information appears.

9

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

10

Click on the link: OData-Service

11

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

17.jpg


 

So here the service metadata information appears.

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

15.jpg


 

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.

16.jpg

 

转载于:https://www.cnblogs.com/yjyongil/p/10511201.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值