Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Setting up a "is a" relation in a CDS file

Hi folks

i am struggling with setting up some parts of my ER Modell and setting up valid Constraints, that work out in usual SQL.

I have an "is a" relationship where my subtype is disjunct and partial. So my relations in CDS look like the following:

entity component{

key component_id : types.key;

leaf_id : Association[1] to core.component_is_a_leaf {leaf_id};

};

entity component_is_a_leaf{

key leaf_id : types.key;

subtypes : types.code; // e.g. component_leaf

};

entity component_leaf{

key component_leaf_id : Association[1] to core.component {component_id};

};

Following i have a relation that connects two tables of which one should be the component_leaf:

entity progress_recording{

key rec_id : Association[1] to .....; // Primary Key, Foreign Key rec_id

KEY COMPONENT_LEAF_ID : ASSOCIATION[1] TO COMPONENT_LEAF {COMPONENT_LEAF_ID}; // Primary Key, Foreign Key component_leaf_id

percentage :  Integer; //NOT NULL, CHECK THAT SCALE IS >=0 AND <=100, DEFAULT 0

};

When i try to check or activate the CDS i get the warning that:

"component_leaf_id is not allowed as a foreign key type" and i do not have any idea how to solve this problem.

Is there anybody out there who can help?

Thanks from Berlin

Jo

p.s.: some eventually relevant system information

i am running a hana development system revision 80 in an aws environment

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question