Skip to Content
0
Sep 19, 2023 at 05:21 PM

CDS View Association with same table multiple times

174 Views Last edit Sep 20, 2023 at 05:13 AM 3 rev


Hi Team

Building a CDS View on 2 tables Tab1 and Tab2 .

Tab1 as below

image.png

Tab2 as below

image.png

Need to generate a CDS view as below

image.png

Created a CDS View as below
define view ZREPORT as select from tab1 
association [0..1] to  tab2 as _id1
on  _ id1.id = tab1.id1
association [0..1] to  tab2 as _id2
on  _id2.id = tab1.id2
association [0..1] to  tab2 as _id3
on  _id3.id = tab1.id3
association [0..1] to  tab2 as _id4
on  _id4.id = tab1.id4
{
key tab1.colname as colname,
tab1.id1 as id1
_id1.Name as id1Desc
tab1.id2 as id2
_id2.Name as id2Desc
tab1.id3 as id3
_id3.Name as id3Desc
tab1.id4 as id4
_id4.Name as id4Desc
}

Wanted to know is it the only way to get above View because having association to same table multiple times

Regards

Prasad

Attachments

image.png (2.2 kB)
image.png (3.7 kB)
image.png (7.9 kB)