SAP CDS view自学教程之三:ABAP Development Tool里的CDS view源代码如何传递到ABAP后台-阿里云开发者社区

开发者社区> jerrywangsap> 正文

SAP CDS view自学教程之三:ABAP Development Tool里的CDS view源代码如何传递到ABAP后台

简介: SAP CDS view自学教程之三:ABAP Development Tool里的CDS view源代码如何传递到ABAP后台
+关注继续查看

Let’s review what we have learned so far. Through SQL trace and debugging, we have learned below:


(1) When we click activate button in ABAP development tool ( I call it Eclipse now in this blog ), there are several corresponding ABAP objects generated and table entries inserted. Through debugging we know lots of related logic are implemented in package SDDL.


(2) When we test read & search function against the odata service created on top of the CDS view, the operation is delegated to CL_SQL_STATEMENT~EXECUTE_QUERY.


And now I ask myself, since what we have typed in Eclipse is pure text, how does ABAP backend interpret the text and convert it into ABAP DDIC objects? The only hint we have is the SDDL package. There are more than 10 classes in it. Although an experienced ABAP developer can easily identify which class is responsible for the text->ABAP view conversion just according to the class name and description, whereas ABAP newbies need more time to practice their intuition.


image.png


The tip here is, if you are not sure which class is what you are looking for, then always start with what you have already known. In our case it is CL_SQL_STATEMENT~EXECUTE_QUERY. Set breakpoint on this method and type some more characters in Eclipse, the breakpoint is triggered immediately.


From the callstack, we know that every time after you type something in Eclipse, it will fire Syntax check request to ABAP backend.


image.png


You can observe this via in the bottom part of your Eclipse.


image.png


From the callstack we find a class CL_DD_DDL_HANDLER which implements interface IF_DD_DDL_HANDLER which seems is what we look for. Open this class and there is a method GET_VIEWDEF_FROM_SRC, which indicates the method converts the SouRCe code to ABAP VIEW–DEFinition. Set breakpoint in it and click activate button again in Eclipse.


image.png



This class will parse source code:


image.png



From the code, it is very clear that the parse output, view definition in ABAP format is used to generate ABAP database view.


image.png


There is also another approach which can allow you to get a clearer view:

Open the “ABAP Communication Log” view:


image.png


Switch on Logging:


image.png


Then make some dummy change on your view, then you can observe the following six requests sent to ABAP backend.


The highlighted “abapCheckRun” is just the syntax check we already learned.


image.png


Double click on the request to see request detail. Here the view source code is encoded in Base64 format stored in chkrun:content.


image.png


We can of course see the original text from some decode-encode online conversion website:


image.png


If you could like to debug any request you see in ABAP communication log view, please refer to this document: An example to help you understand how does ADT work.


image.png


When you click activate button in Eclipse, you can know that a syntax check is always performed before the real activation.

image.png


版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

相关文章
微信公众平台开发入门教程
关键字:微信公众平台开发作者:方倍工作室   在这篇微信公众平台开发教程中,我们假定你已经有了PHP语言程序、MySQL数据库、计算机网络通讯、及HTTP/XML/CSS/JS等基础。 我们将使用微信公众账号方倍工作室作为讲解的例子,二维码见左侧。
1359 0
安卓逆向系列教程 4.5 糖果星星达人
4.5 糖果星星达人 作者:飞龙 软件在这里下载:http://www.anzhi.com/soft_2539282.html 第一次进入游戏之后,会弹出来一个“新手礼包”,关掉之后,点击“新游戏”,之后进入“关卡1-1”。
932 0
SAP LSMW 事务代码HUPAST的录屏后台执行报错 : Runtime error
SAP LSMW 事务代码HUPAST的录屏后台执行报错 - Runtime error RAISE_EXCEPTION has occurred - 之分析 因项目上成品库存管理启用了handling unit management功能,所以在库存初始化的时候,在MB1C+561导入库存之后,需要把库存转入923 storage type,然后使用HUPAST产生Handling Unit以打印HU 标签以及上架。
1618 0
Android NFC开发教程(3): Mifare Tag读写示例
前面例子介绍了检测,读写NFC TAG开发的一般步骤,本例针对常用的Mifare Tag 具体说明。 Mifare Tag 可以有1K ,2K, 4K,其内存分区大同小异,下图给出了1K字节容量的Tag的内存分布:   数据分为16个区(Se...
803 0
+关注
2628
文章
0
问答
来源圈子
更多
+ 订阅
文章排行榜
最热
最新
相关电子书
更多
《2021云上架构与运维峰会演讲合集》
立即下载
《零基础CSS入门教程》
立即下载
《零基础HTML入门教程》
立即下载