Skip to Content
Jul 12, 2022 at 12:03 PM

Associations in custom entities in SAP RAP



I have a simple RAP based OData Service with two custom entities which are associated one to another like so:

Root entity "RUN"


Root entity "MESSAGE"


So when I call all or a single "run" entity/ies, everything works fine.

Now I want to call the navigation property "to_Messages" of a single "run" entity, to display the results in a lineitem annotation like so:


I thought that as soon as I call the association, the RAP framework would call the if_rap_query_provider~select method of the class, which I defined in the child(associated) entity, like ZCL_CE_MXF_MESSAGE but instead, the framework calls the select method of the "run" entity in the ZCL_CE_MXF_RUN class.

If this works as intended how can I distinguish, which association was called? In the debugger it seems that it is a normal getEntity call of the "Run" entity with no additional information about the association or anything else, that could help me.


When I call the "Message" entity itself, the corresponding select method in the "Message" class is called. But not when I call it as an association of the "Run" Entity. I configured the relation between the two entities as composition in the first place, like in the answer of Andre Fischer in the question, but it was no difference.

Did I configured something wrong?

Best Regards