Skip to Content

ABAP CDS: Inner Join vs Association

Hi Experts

What is the difference between Inner join and Association in ABAP CDS ??

When we go for association in ABAP CDS and benefits of associations than inner join ??



Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jul 21, 2016 at 08:05 AM

    Hi Naveen,

    In association , both of inner join and left outer join can be defined by specifying association name in path expressions.

    Refer the link below to differentiate association with inner join.


    Defines an association of the name assoc in a SELECT statement of a CDS view in ABAP CDS. An association joins the first elementary data source entity specified as the initial data source (after FROM using the ON condition cond_exp) with the data source entityspecified as the target data source (in the definition of the association). A data source entity can be a database table defined in ABAP Dictionary or a view. In the latter case, the view can be an external view or another CDS view.

    An association of a SELECT statement can be accessed - in the same statement at all places where this is documented - by specifying the association name in path expressions. When a CDS view is activated with path expressions, the specified associations are converted to join expressions. The initial data source is shown on the left side and the target data source is shown on the right side. The ON condition of the association is added to the ON condition of the join. By default, the category of the join is determined by where the path expression is used:

    • After FROM, it is an inner join.
    • In all other locations, it is a left outer join.

    This setting can be overwritten when specifying the association in a path expression using an attribute.When specifying the ON condition, the following special rules apply:

    • Fields of the initial data source, which are specified in the ON condition, must also be listed in the SELECT list of the currentSELECT statement. This ensures that a join expression can be built from the association (when used in a path expression). In theON condition, the field name should be prefixed by $projection and not by the name of initial data source.
    • The fields of the target data source must be prefixed in the ON condition by the name of the association (prefix assoc. separated by a period).


    • The syntax for defining and using associations is a high-value wrapping of the syntax for joins. Using associations instead of directly programming joins makes it easier to read the definition of a CDS view.
    • If an association is listed as a special case of a path expression in the SELECT list of the current SELECT statement, other CDS views can be used in the path expressions - provided that the current CDS view is used as the data source. Associations not listed in the SELECT list can only be used in path expressions of the current SELECT statement.
    • When a CDS view is activated, a join defined by an association is built for every use in a path expression and not for the definition of the association. No joins are constructed for associations that are not used in their CDS views.
    • Associations and join expressions can be used in a SELECT statement of a CDS view.


    Kala L.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.