Skip to Content
0

Hana XSA CDS: View Join

Dec 15, 2016 at 08:20 AM

211

avatar image

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
};
}
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Florian Pfeffer
Dec 17, 2016 at 07:38 PM
1

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
 };
Share
10 |10000 characters needed characters left characters exceeded
Rutika Bodas
Apr 05, 2017 at 06:08 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded
Rutika Bodas
Apr 05, 2017 at 08:27 AM
0

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/60b2d45a8a964efea2e88e29140dbda6.html#loio60b2d45a8a964efea2e88e29140dbda6__section_kkq_gyv_3v

Regards,

Rutika

Share
10 |10000 characters needed characters left characters exceeded