cancel
Showing results for 
Search instead for 
Did you mean: 

Hana XSA CDS: View Join

draschke
Active Contributor
0 Kudos

Hi,

I found this difficult sample code for an join of different entities.

Please, could somebody show me, if I would only join E and G by "id", how this should look like. I don't get it to work.

Thanks!

entity E {
  key id : Integer;
  a : Integer;
};
entity F {
  key id : Integer;
  b : Integer;
};
entity G {
  key id : Integer;
  c : Integer;
};
view V_join as select from E join (F as X full outer join G on X.id = G.id) on E.id = c {
  a, b, c
};
}

Accepted Solutions (1)

Accepted Solutions (1)

pfefferf
Active Contributor

What issues do you get?

Joining E and G with an inner join via the ID would look for instance like following:

view vTest as
 select from E inner join G on E.id = G.id
 {
   E.id as eid,
   G.id as gid,
   E.a,
   G.c
 };

Answers (2)

Answers (2)

rutika_bodas
Participant
0 Kudos

Additionally, you can use the CDS Graphical Editor for your CDS modelling if you are using SAP Web IDE for SAP HANA. It is available from HANA 1.0 SPS11 onwards with baisc features like CDS Entitites, contexts, associations etc. From the release HANA2.0 SPS00, the graphical editor supports CDS View modelling as well.

With the graphical editor, you can easily create, associate, and model your CDS artifacts with a simple drag and drop paradigm and you will not have to write all this CDS script anymore.

Here is a documentation for the same:

https://help.sap.com/viewer/4505d0bdaf4948449b7f7379d24d0f0d/2.0.00/en-US/60b2d45a8a964efea2e88e2914...

Regards,

Rutika

rutika_bodas
Participant
0 Kudos

Hello Dirk,

The join of E and G by id will look like what Florian has answered.

The complex view definition in your question though, is a join of E with (a join of F and G).

Regards,

Rutika