一步步创建ABAP CDS view

你。 提交于 2020-01-01 17:29:10
  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的原创文章,请关注公众号"汪子熙":

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!