CDS View Association – Part2
In the earlier post- CDS View Association – Part-1 mostly it tells about cardinality [1..1] . Here let’s see with 1 to Many cardinality.
Below CDS view with data source SCARR and association source SPFLI is basically 1 to Many relationship. Expose the association SPFLI.
Make data preview. All records from source are displayed.
Select one record and navigate to the association _spfli.
It displays all matching records from SPFLI data source (association) with key as – AA
Similarly we can select LH and see the association data source details.
Open the SQL console and here we can see the PATH Expression [ ] – to access fields from the association.
The report SQL on CDS view to access records from:
1-> only from source
2-> Both from source and association
3->only from association
4-> only from association with WHERE condition(s).
Below is the CDS with association and ON condition contains multiple JOIN fields with AND condition.
make data preview and navigate to the association .
Data from association.
Now will test a multi level association.
Below is the CDS view with association from SCARR to SPFLI. The association _SFLIGHT is exposed.
Below is the CDS view with association where the source data is a table SCARR and the association data source is the CDS view. The association data source is exposed.
Test the data source of CDS view- ZTEST_CDS_017 . All SCARR records are displayed.
From the the association is another view – ZTEST_CDS_016 . Navigate to the association.
In the association ZTEST_CDS_016 the select list includes fields from SPFLI and it has association SFLIGHt.
It shows the details of SPFLI and it has exposed association to SFLIGHT. Navigate to the association.
Here is SFLIGHT details. So started from SCARR -> Via Association to SPFLI-> Via Association to SFLIGHT.
Below is a cds view where multiple association are linked from the data source.
From source to associations are linked. Navigate to the first association.
Navigate to the second association.
Below CDS view is having multiple association with different cardinality.
From Sales order header to Customer is [1..1] and sales order header to sales order items having[0..*] cardinality.