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

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

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.


image.png


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


image.png


Metadata retrieval test ok:


image.png


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

image.png



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


image.png


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.


image.png


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


image.png


The highlighted callstack frames are essential for odata service generation.


image.png


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.


image.png


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 ).


image.png


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


image.png


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


image.png


image.png


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


image.png


Complete callstack:

image.png

相关文章
|
16天前
|
Web App开发 开发者 存储
介绍一个 webp 格式转 png 格式的软件:XNConvert
介绍一个 webp 格式转 png 格式的软件:XNConvert
21 6
介绍一个 webp 格式转 png 格式的软件:XNConvert
|
16天前
|
数据库 存储 BI
SAP ABAP CDS View 源代码存储的数据库表揭秘和其他相关数据库表介绍试读版
SAP ABAP CDS View 源代码存储的数据库表揭秘和其他相关数据库表介绍试读版
10 0
SAP ABAP CDS View 源代码存储的数据库表揭秘和其他相关数据库表介绍试读版
|
16天前
|
数据库
迈入 SAP CDS View 世界的前置知识 - SAP ABAP 数据库视图介绍试读版
迈入 SAP CDS View 世界的前置知识 - SAP ABAP 数据库视图介绍试读版
9 0
迈入 SAP CDS View 世界的前置知识 - SAP ABAP 数据库视图介绍试读版
|
16天前
|
数据库 SQL 应用服务中间件
SAP ABAP CDS View 和 HANA CDS View 相同点和不同点辨析
SAP ABAP CDS View 和 HANA CDS View 相同点和不同点辨析
17 0
SAP ABAP CDS View 和 HANA CDS View 相同点和不同点辨析
|
6月前
|
数据建模 BI
什么是 SAP S/4HANA 的 VDM Layering Architecture 的 CDS Hierarchy View
什么是 SAP S/4HANA 的 VDM Layering Architecture 的 CDS Hierarchy View
28 0
|
6月前
|
设计模式 SQL 数据建模
SAP Virtual Data Model 和 CDS View 的关联关系
SAP Virtual Data Model 和 CDS View 的关联关系
30 0
|
6月前
|
供应链 搜索推荐 数据建模
什么是 SAP CDS 元数据的分层概念
什么是 SAP CDS 元数据的分层概念
49 0
|
6月前
|
SQL 数据可视化 数据挖掘
什么是 SAP S/4HANA 的 VDM Layering Architecture 的 CDS Analytical Query View
什么是 SAP S/4HANA 的 VDM Layering Architecture 的 CDS Analytical Query View
33 0
|
1月前
|
前端开发 搜索推荐 开发者
SAP UI5 sap.m.Column 控件的 minScreenWidth 属性介绍
SAP UI5 sap.m.Column 控件的 minScreenWidth 属性介绍
27 0
|
1月前
|
JavaScript 前端开发 开发者
SAP UI5 控件 sap.m.ListBase 的 inset 属性的作用介绍
SAP UI5 控件 sap.m.ListBase 的 inset 属性的作用介绍
13 0