Core Data Services (CDS) represent SAP's code pushdown paradigm. While classical ABAP Open SQL required complex nested SELECT loops, CDS Views push calculation logic directly to the SAP HANA in-memory database engine.
//1. What makes CDS Associations Unique?
An Association defines a cardinality relationship between entity CDS views. Unlike a standard SQL INNER JOIN or LEFT OUTER JOIN, an Association is evaluated LAZILY (on-demand).
If a query selects fields strictly from the source entity, SAP HANA does not execute the JOIN against the associated target table, saving significant CPU and memory bandwidth!
//2. CDS Association Code Example
Here is how to define an association from Flight Schedules to Flight Bookings:
1@AbapCatalog.sqlViewName: 'ZV_FLIGHT_ASSOC'
2@AbapCatalog.compiler.compareFilter: true
3@AccessControl.authorizationCheck: #CHECK
4@EndUserText.label: 'Flight Schedule with Booking Association'
5define view ZI_FlightSchedule
6 as select from spfli
7 association [0..*] to sbook as _Bookings
8 on $projection.carrid = _Bookings.carrid
9 and $projection.connid = _Bookings.connid
10{
11 key carrid as carrid,
12 key connid as connid,
13 countryfr,
14 cityfrom,
15 countryto,
16 cityto,
17
18 /* Exposed Association */
19 _Bookings
20}
Comments & Community Discussion0
Ask questions, share SAP insights, and discuss ABAP implementation details.