zoukankan      html  css  js  c++  java
  • 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.

    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.

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

    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.


    This class will parse source code:


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

    There is also another approach which can allow you to get a clearer view:
    Open the “ABAP Communication Log” view:

    Switch on Logging:

    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.

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

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

    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.

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

    要获取更多Jerry的原创文章,请关注公众号"汪子熙":

  • 相关阅读:
    在IIS上启用Gzip压缩(HTTP压缩)
    跨数据库服务器查询和跨表更新
    GOOGLE高级搜索的秘籍
    NET中的规范标准注释(二) -- 创建帮助文档入门篇
    NET中的规范标准注释(一) -- XML注释标签讲解
    如何取出word文档里的图片
    System帐户!我使用你登陆
    横竖两个数字塔的效果BAT批处理怎么写?
    用批处理修改日期,然后在改回来
    根据日期计算星期几----蔡勒(Zeller)公式推导
  • 原文地址:https://www.cnblogs.com/sap-jerry/p/13639041.html
Copyright © 2011-2022 走看看