cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Cloud Application Programming Model : Generate local key for Entity

former_member182048
Active Contributor

in XSOData we can generate a local ID for a key like

key generate local "ID";

In ABAP CDS we can do something similar in a couple of ways, one is to add a @Default Aggregation to a property and not nominate a key

How do we generate a local ID key for an Entity in a .CDS service?

The use case is the HANA view i am projecting has many fields, collectively all fields make up the key

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member182048
Active Contributor
0 Kudos

phew found it

if you add

 @Aggregation.ApplySupported.PropertyRestrictions 

to the top of your view or entity then a generated key "ID__" magically appears 🙂

former_member182048
Active Contributor
0 Kudos

too bad it didn't work with $expand on OData V2, complained "ID__" was blank