CDS ViewsIntermediate•1 min read•Calculating progress…•Aug 12, 2026

Mastering CDS Views: Associations vs Joins Explained with Examples

Learn the architectural difference between Joins and Associations in Core Data Services (CDS), on-demand evaluation, and performance best practices on SAP HANA.

K Sai Bhaskar
K Sai Bhaskar
Consultant
Loading…
Mastering CDS Views: Associations vs Joins Explained with Examples

Mastering CDS Views: Associations vs Joins Explained with Examples

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).

PRO-TIP
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:

abap
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}
// Tags:#CDS Views#SAP HANA#Associations#SQL Joins#Performance
Written by
K Sai Bhaskar

K Sai Bhaskar

Consultant

Passionate SAP Consultant with 4+ years of experience in SAP ABAP, S/4HANA, CDS Views, RAP, and ABAP Cloud, delivering efficient business solutions.

Certifications:
✓ SAP Certified - Backend Developer - ABAP Cloud

Discussion & Feedback0

Ask questions, share SAP insights, and discuss ABAP implementation details.

Moderated & Spam-Protected
Links allowedNo images
0/2000
Loading discussions…

Related Articles & Guides

K Sai Bhaskar

More from K Sai Bhaskar

Consultant • Certified SAP ABAP Specialist

Explore all guides