Skip to Content

What exactly is associations in CDS view? And its benefit over JOIN?


What exactly is the benefit of using associations in CDS view instead JOIN?

I read Associations are metadatas about joining connections. Actual join is created when the association is used in a path expression. Refer to

But what is path expressions? Can anybody help me with this?

Also I Googles for associations cardinality information but did not found a proper documentation.

Can anybody please help me?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jan 05, 2018 at 03:42 AM

    Thanks James.

    Hey Ankur,

    You use a Join when you want to combine data in the same read from the database. For example, if I am displaying a list of Sales Orders I might want to get the vendor name along with the vendor id in the one read which I use to display a list of Sales Order headers, because that's information I always need to show.

    You use an association when you want to NAVIGATE from one entity to another in a UI. I don't always need to drill down to every sales order. I can delay reading the Sales Order Items unless and until the user drills down to them. So I want an association from my Sales Order header joined view to my Sales Order Item view. That sets up an easy navigation but also that navigation won't be used unless the user needs it. So the overall UI will perform better because it only reads the data it needs to.

    SAP uses the standard and recommended OData approach for path expressions.

    The path expressions are used when navigating from one entity to another. You can see this explained in more detail in where they talk about addressing entities. In other words the path expression defines how you move from e.g. the Sales Order header to the Sales Order items using the OData association.



    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Jocelyn,

      Thanks for this excellent answer.

      I still have a doubt how associations are useful in analytic scenarios (its benefits over join).

      If you include an association in select list in analytic cds views, the association cannot be accessed in reporting tool (unlike OData). Element list of association needs to be explicitly specified so that reporting tools like Bex are able to access the association elements.

      The moment you include explicit list of elements in the view - you are no longer requesting fields "on demand". In that case, how would association benefit over join?



  • avatar image
    Former Member
    Jan 03, 2018 at 04:57 PM

    A bit late but it may help someone's search.

    I am no expert on CDS yet but learning. I had been just using joins in my CDS views but I am getting ready to use associations because they let me set up navigation between two CDS views so that in my Fiori App, I can go from header table to detail item table.

    I will create One CDS view as the HEADER table with association to the ITEM table.

    I will create another CDS view as the ITEM table with association to the HEADER table.

    I will create a third table known as a "consumption view", It will expose the fields from both the HEADER and the ITEM and will be used to publish an OData Service that I can then use in a Fiori app.

    There is a great blog about this here: My CDS view self study tutorial – Part 5

    Add comment
    10|10000 characters needed characters exceeded