cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

CAP CDS entity with Generated Column

carlonnheim
Participant
0 Likes
1,301

Hi,

We are trying to use generated columns in our CAP project, but we get errors compiling the cds files.

We are trying the sample from here:

Entity Element Modifiers - SAP Help Portal

like this

entity MyEntity1 {
    key id : Integer;
    a  : Integer;
    b  : Integer;
    c  : Integer generated always as a+b;
};

But this results in

Mismatched ‹Identifier›, expecting ‘.’, ‘:’, ‘;’, ‘(’, ‘@’, ‘=’, DEFAULT, ENUM, NOT, NULL

Can hope for this to be supported in the near future?

Thanks!

//Carl

Accepted Solutions (0)

Answers (1)

Answers (1)

steffen_weinstock
Product and Topic Expert
Product and Topic Expert

Hi Carl,

let me first clarify a potential source of confusion:
the sample you are referring to is related to "SAP HANA Core Data Services", which is an implementation of CDS directly embedded into the HANA database (note that HANA CDS is in "maintenance mode" since a few years, no active development is taking place there any more). This is different from CAP CDS, which is implemented in nodejs and/or Java, completely independent of HANA (but of course you can use HANA as the database for your CAP apps). These two products/implementations have different feature sets. While HANA CDS had some focus on supporting many database features, in CAP CDS we rather support only the most basic DB features.

So for your specific question: "generated always as" is not supported in CAP CDS, and we have no plans supporting it.

If you want to make use of HANA features that are not supported directly by CAP CDS, the way to go is to create a native HANA object (table, view) without CAP, and then put a "facade entity" on top of it to enable using the object in CAP CDS. This approach is described here: capire - Using Native SAP HANA Artifacts (cloud.sap)

Best regards, Steffen