cancel
Showing results for 
Search instead for 
Did you mean: 

SAP RAP Custom entity referential constraint error with composition and @OData.property.name

0 Kudos
240

 

Hi Community,

I'm currently working on an SAP RAP unmanaged scenario using Custom Entities in ABAP Cloud, and I’ve run into an issue when trying to expose metadata.

Scenario:

I have two custom entities defined as follows:


Root Entity:

 
@EndUserText.label: 'Custom Root entity for Parent'
define root custom entity ZParent {
  @OData.property.name: 'SessionId'
  key SESSION_ID : abap.int1;

  _Child : composition [1..1] of ZChild;
}

Child Entity:

 

 
@EndUserText.label: 'Custom entity for Child'
define custom entity ZChild {
  @OData.property.name: 'SessionId'
  key SESSION_ID : abap.int1;

  _Parent : association to parent ZParent on _Parent.SESSION_ID = $projection.SESSION_ID;
}

Issue:

When I try to access the $metadata of the service, I receive the following error:

Code: SY/530  
Message: Association assoc_0FCF7701A629F6O035FFE9E6E21380F1: referential constraint property not found in entity ZChildType.

Interestingly, the error does not occur when the @odata.property.name annotation is removed.


Question:

Does the RAP framework not automatically handle property name mapping when using @odata.property.name?

Is there an annotation or recommended approach to handle referential constraints in this case?


Any insights or guidance would be greatly appreciated!

Thanks & Regards,
Aftab

View Entire Topic
lbreddemann
Active Contributor
0 Kudos

There is no global "read only mode" switch for application users.

One option I can think off is to create a roles-model that differentiates between reading and writing.

To disable writing you could then revoke the data change privileges from the writing role(s).