RAP_CDS_ODATAbeginner
CDS Associations
Learn ABAP CDS associations as semantic relationships between entities, including ON conditions, cardinality, path expressions, exposed associations and their effect on generated SQL and consumers. Use this topic to model reusable relationships without confusing associations with free performance gains.
Overview
Learn ABAP CDS associations as semantic relationships between entities, including ON conditions, cardinality, path expressions, exposed associations and their effect on generated SQL and consumers. Use this topic to model reusable relationships without confusing associations with free performance gains.
Lessons in this topic
- CDS Associations Part 1: Source, Target, ON Condition and CardinalityDeclare CDS associations correctly: source and target, the ON condition, $projection, cardinality, and exposing the association so consumers can use it.
- CDS Associations Part 2: Path Expressions and How Associations Become JoinsSee exactly how associations turn into SQL: path expressions in views, in ABAP SQL and in OData, the default LEFT OUTER JOIN, filtered paths, and join-type attributes.
- CDS Associations Part 3: To-One vs To-Many — Semantics and PerformanceChoose and use cardinality deliberately: what to-one and to-many mean for results, how to get one row per source when you need it, how to aggregate over to-many data, and how to keep text and time-dependent relations to-one.
- CDS Associations Part 4: Associations vs Compositions in a RAP Business ObjectUnderstand the CDS side of a RAP business object tree: composition vs association, "association to parent", and how projections redirect compositions, parents and normal associations.
- CDS Associations Part 5: Troubleshooting Duplicates, Missing Data and Slow QueriesFix the three typical association problems — too many rows, missing rows and slow queries — with a repeatable method: check cardinality, join type, filters and the generated SQL.
Interview questions covered
- What is a CDS association, how is it declared, and how does it differ from a join?
- A status text association returns duplicate rows in a list. The ON condition is only on the status code. What is wrong and how do you fix it?
- Explain path expressions: what SQL do they generate, how do filtered paths work, and how are they written in ABAP SQL?
- A list of orders must show the number of items and total item value per order. How do you model this in CDS without duplicates?
- How are compositions declared in CDS for a RAP business object, and what must projections do with them?
- What design rules do you follow for associations in an interface view layer?
- A universal sales order view uses inner joins to customer, material and plant, and some orders disappear. How would you redesign it?
- An OData list returns 2,400 rows where the business expects 800. How do you analyze it?
- Users say a CDS-based report 'lost' some records. What are the possible causes related to associations, and how do you tell them apart?
- You inherit a CDS model with many associations. What do you review before extending it?