cancel
Showing results for 
Search instead for 
Did you mean: 

SAP CAP - Associations automatically created key field

Cristian
Participant
0 Kudos
567

Hi experts,

I have a SAP CAP based service built on top of a 1 to N relationship. The entities are defined as follows:

When I expand the Patterns entity I get something as follows:

Questions:

- Is it possible to rename the automatically created field style_ID ?

- Is it possible to do not show it in reading operations? In the end you can get it with the expand.

Many thanks!

C.

Accepted Solutions (1)

Accepted Solutions (1)

david_kunz2
Product and Topic Expert
Product and Topic Expert

Hi,

The Node.js runtime now offers native support for structured elements in OData. Entities modelled as structured in CDS can now be queried with OData without using the ‘underscore notation’ and the result returned will be a structured object instead of the previously flattened result. To enable structured mode the odata.flavor = x4 flag needs to be set.

Best regards,
David

Cristian
Participant
0 Kudos

Many thanks. Do you know where this configuration is done? I cannot open the link you mentioned as it is saying that the site is under construction :).

Thanks!

C.

david_kunz2
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

You can add a `.env` file and write it there:

odata.flavor = x4
Cristian
Participant
0 Kudos

david.kunz2 , that worked, many thanks. I added the environment variable in the package.json

 "cds": {
 "hana": {
 "deploy-format": "hdbtable",
 "syntax": "hdi"
 },
 "requires": {
 "db": {
 "kind": "hana"
 }
 },
 "odata": {
 "flavor": "x4"
 }
 }

An now working perfectly fine.

 "style": {
 "ID": "f154954a-d5f5-499c-8ce6-3e66fa47bf46"
 }

Regards y many thanks.

C.

Answers (0)