Skip to content

ABAP Keyword Documentation →  ABAP - Dictionary →  ABAP CDS in ABAP Dictionary →  ABAP CDS - Data Definitions →  ABAP CDS - DDL for Data Definitions →  ABAP CDS - DEFINE ABSTRACT ENTITY →  ABAP CDS - DEFINE ABSTRACT ENTITY, element_list →  ABAP CDS - DEFINE ABSTRACT ENTITY, element 

ABAP CDS - DEFINE ABSTRACT ENTITY, association

Other versions: 7.31 | 7.40 | 7.54

Syntax


... ASSOCIATION [ [min..max] ] TO target ON cond_exp 
                [ WITH DEFAULT FILTER cond_exp ] ...

Effect

Defines and publishes a CDS association in the element list of an abstract CDS entity. The CDS association uses an ON condition to associate the current CDS entity with a target data source target. The syntax has basically the same meaning as the addition ASSOCIATION in the SELECT statement of a CDS view with the following exceptions:

  • The addition AS _assoc is not used. The CDS association is declared using the name _assoc, after which the addition ASSOCIATION is specified in the element list.
  • The prefix $projection, used to make reference to an element in the element list, is not supported.

A CDS association defined using the addition ASSOCIATION in the element list of an abstract CDS entity is always published. It cannot, however, be used in any SQL path expressions, either in ABAP CDS or in ABAP SQL.


Note

A CDS association of an abstract CDS entity cannot be used anywhere where it could produce instances of join expressions.


Example

The following DDL source code shows an abstract CDS entity that publishes a CDS association with another abstract CDS entity:

define abstract entity demo_cds_abstract_entity_assoc
  {
    key key_col: abap.char(3);
        _assoc : association [1..1] to demo_cds_abstract_entity on
                   demo_cds_abstract_entity_assoc.key_col = _assoc.col1;
  }