一步步创建ABAP CDS view

作者: _扫地僧_ | 来源:发表于2020-01-01 14:46 被阅读0次
    1. Add AG3 or ER9 in your local SAPGUI.
    1. Open your ABAP Studio:

    Select the system where you will work:


    Click next:


    Once done, you can find your new project:


    1. Create your own package in SAPGUI:


    And add it to favourite:

    1. right click $ZCDS, create new DDL Source via context menu:

    Paste the following source code:

    @AbapCatalog.sqlViewName: 'zjerrySQLView'
     
    @AbapCatalog.compiler.compareFilter: true
     
    @AccessControl.authorizationCheck: #CHECK
     
    @EndUserText.label: 'this is description'
      
    define view Zjerrytest20160309(
     
        id,
     
        carrier,
     
        flight,
     
        departure,
     
        destination
     
      )
     
      as select from spfli
     
        join         scarr on scarr.carrid = spfli.carrid
     
    {
     
      key spfli.carrid,
     
      key scarr.carrname,
     
      key spfli.connid,
     
          spfli.cityfrom,
     
          spfli.cityto
     
    }
    

    Activate your CDS view:

    Test

    or



    Difference between lt_wrong and lt_right is that the former also contains a column with client field, which is not needed in application handling. Always use the approach indicated by lt_right.

    Guideline

    In the above example, the CDS database view zjerrysqlview serves mainly the internal technical purpose to realize the view in the dictionary. You can, but you should not use it in ABAP programs. Instead, you work with the CDS entity, whose name is defined behind DEFINE VIEW. In the example it is zjerrytest20160309. Only the entity carries the full capabilities of the CDS view, like semantical information, client handling, connection to authority checks (planned), and so on. You can use the CDS entity behind TYPE for declaring work areas and in Open SQL in ABAP programs.

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


    相关文章

      网友评论

        本文标题:一步步创建ABAP CDS view

        本文链接:https://www.haomeiwen.com/subject/dpzwoctx.html