前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >SAP CDS view自学教程之四:SAP CDS view注解@OData.publish的奥妙

SAP CDS view自学教程之四:SAP CDS view注解@OData.publish的奥妙

作者头像
Jerry Wang
发布2020-08-14 09:47:24
7730
发布2020-08-14 09:47:24
举报

In part1 of this tutorial, the old way to create OData service on top of CDS view is introduced. In SAP Help Generate Service Artifacts From a CDS View a new annotation is described:

@OData.publish: true

Just add this annotation to your CDS view and the odata service is automatically created, no need for you to go to code SEGW any more.

Once activated, the odata service with naming convention “_CDS” is available for registration in tcode /IWFND/MAINT_SERVICE:

Metadata retrieval test ok:

So the question here is: How does this annotation work? How can we research the service generation process through debugging?

Here below is how I figure it out. First check what objects have been generated: three additional artifacts are highlighted below.

(1) IWMO: SAP Gateway Business Suite Enablement – Model (2) IWSV: SAP Gateway Business Suite Enablement – Service (3) CLAS: provider class ZCL_ZJERRYTEST20160311 is generated

If I remove the annotation, or change the annotation to @OData.publish: false, and the two are gone:

So it means the annotation @OData.publish: true will trigger table entry insertion for type IWMO, IWSV and CLAS during view activation. Then again I switch on ST05 trace and easily find the ABAP code where the table insertion is done.

Set breakpoint on the code and observe the callstack in the runtime.

The highlighted callstack frames are essential for odata service generation.

Let’s have a deep look at stack frame 21: CL_WB_DDLS_SECOBJ_HNDLR_SINGLE->IF_DDIC_WB_DDLS_SECOBJ_HANDLER~ON_ACTIVATION It will first identify which objects must be created based on delta state.

For example, if I add @OData.publish: true to an existing CDS view and activate it, the corresponding entry will have flag N ( New ) while other existing annotation has type “U” ( Unchanged ).

Inside this method, if annotation ODATA.PUBLISH is found,

and the annotation value is true, then it is considered that the odata service must be created.

The odata service creation is implemented in CL_SADL_GTK_ODATA_SERVICE_GEN~CREATE_VIA_EXPOSURE below.

Complete callstack:

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2020-08-13 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • @OData.publish: true
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档