JOINs in CDS View
In ABAP CDS, Join between two data sources is allowed. Allowed joins are:-
- Inner Join/Join
- Left Outer Join
- Right Outer Join
The post shows a simple Inner Join between data sources form SCARR & SPFLI table.
In HANA studio, open ABAP perspective. From Project explorer, right click on the package and choose New->Other ABAP Repository Object
Choose DDL Source & select Next
Provide a name & description & select finish
Provide aSQL View Name & code lines. Save & Activate.
@AbapCatalog.sqlViewName: ‘ZFLIGHT_JOIN’
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: ‘Flight with Inner Join CDS View’
define view Zflight_Join_Vw
as select from spfli
join scarr
on spfli.carrid = scarr.carrid
{
key spfli.carrid,
key scarr.carrname,
key spfli.connid,
spfli.countryfr,
spfli.cityfrom,
spfli.airpfrom,
spfli.countryto,
spfli.cityto,
spfli.airpto
}
Execute it or by right click choose Data Preview.
Output: