- Add AG3 or ER9 in your local SAPGUI.
- Open your ABAP Studio:
Select the system where you will work:
Click next:
Once done, you can find your new project:
-
Create your own package in SAPGUI:
And add it to favourite:
- 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的原创文章,请关注公众号"汪子熙":
网友评论