Domain Model - OData entities

0
Hello, in my scenario I’m working with the SAP OData connector. Want to use the below entities (OData services) to load data from the source system to Mendix app and back: API_MKT_CONTACT_SRV → Contact API_MKT_INTERACTION_SRV → Interaction = Transactional data like sales order, product view, event registration, etc.   Both entities having an own domain model with sub-entities associated. Domain model of interaction: Since working with multiple instances of an entity, e.g. interaction, I assumed that it would be good to create an own domain model with generalization in the app. Following scenario I would like to achieve: Sales Order (Interaction) with sub-entity Product (InteractionProduct) Event Registration (Interaction) with sub-entity Event (InteractionEvent) Created the below model with generalization to “API_MKT_INTERACTION_SRV”. When retrieving data from SAP to Mendix with GET_LIST of OData Adapter (with entity from API_MKT_INTERACTION_SRV), it’s working to get an interaction + interaction.product / interaction + interaction.event.  Also when sending data from Mendix to SAP. However, if I use the above defined domain model from “MyFirstModule” (so entity EventRegistration or SalesOrder), only the entity itself (so interaction) can be retrieved/posted. The sub-entities interaction.product / interaction.event are not considered. Is this a restriction in the OData Adapter or do I have to handle it differently? Thanks & Best regards, Jan  
asked
2 answers
0

Hi Jan,

Issue is accessing navigation properties of entity Interaction. This is because when you generalize an entity its associations are not not available to new entity be default. You will not see any associations in the new entity. 

Can you please add associations similar to Interaction entity to new Entity RegisterEvent and SalesOrder and give a try.

Thanks!

answered
0

Hi Gaurav,

thanks for your response :)
Tried it out with the associations to the Entity RegisterEvent.
It works fine, if the name of the associated entity is like in the OData, so in my example below, it has to be “InteractionEvent”. If I would name it for example “EventRegistrationEvent”, then I got an error and the mapping can not be done. So my originally idea was to create an own entity with association for each interaction so “EventRegistration” & “SalesOrder”, but this can’t be modeled.

Thinking I go with the below approach then, that should work fine:

 

When posting data back from Mendix to SAP I still facing the issue with the sub-entity.
Doing the following steps. First I create the entity “EventRegistration”, then the entity “InteractionEvent” of my own data model. Then I associate the objects and post it to SAP:

Query: @API_MKT_INTERACTION_SRV.API_MKT_INTERACTION_SRV + '/' + toString(API_MKT_INTERACTION_SRV.EntitySetNames.Interactions)

 

In SAP only the EventRegistration is posted, without InteractionEvent.
Trying out with the above steps with the OData model from SAP directly, InteractionEvent is posted correctly.

Thanks & Best regards,

Jan

answered