cancel
Showing results for 
Search instead for 
Did you mean: 

Associations in custom entities in SAP RAP

Domae
Participant

Hi,

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:

/sap/opu/odata/sap/ZBI_MXF_RUN/ZDD_I_MXF_RUN(vtype='AB02FG',run_id='206')/to_Messages

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 https://answers.sap.com/questions/13631104/abap-rap-complex-logic-for-read.html, but it was no difference.

Did I configured something wrong?

Best Regards

Dominik

View Entire Topic
catalinfeidi
Participant
0 Kudos

Hi,

We just implemented the custom entity on root and child having both classes implemented and they are called sequentially.

If we expand the child, both root and child classes are called. I don't see how you have a different behaviour.

vijay_kamath2
Explorer
0 Kudos
Hi - I am facing this issue of the child entity not getting called. Instead when I click on the line in the list report, I see that the header entity gets called again. Can you share sample of the 2 entities, so that I can check if I have done something wrong.