cancel
Showing results for 
Search instead for 
Did you mean: 

Offline OData entity relationship when offline

Former Member
0 Kudos

Hi,

I'm looking for documentation about setting the relationship between two entities in an offline odata application.

Usually the relationship can be created in the gateway by using associations. When creating LOCAL data in the Offline OData application, linking two entities based on an association will work, but you can only use this association locally AFTER a refresh. This has been documented by SAP (https://help.sap.com/doc/d9c75eebcfa840c8a4aa4b0e6a8136de/3.0.15/en-US/889d29b3fac0456b812d86b5794c6e54.html).


This means while the user is offline, the standard way of loading related data will not work.


In the same documentation it explains I need to use a binding for this. But in the SAP (Offline) OData documentation this binding seems to be undocumented. So what is the way to do this?

I'm using the UWP version of the SMP 3.1 SDK.

Kind regards,

Mike

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Ashwin,

Thanks for your reply.

I'm looking for a way to, in an offline scenario doing everything locally at first, efficiently insert entities with a 1:N relationship, having the possibility to efficiently query the data using the $expand function( before flushing the data to the backend).

At this moment the most efficient way to save the data seems to save it as batch, which means there is no relationship between the entities.

How would I use the content ID in this local offline case? As a way to differently link the entities together?

Kind regards,

Mike

AshwinKatkar
Participant
0 Kudos

Hi Mike,

Deep inserts to entity sets are only supported for 1:1 mapping not 1:N. To address your issue you can try to use content id feature in gateway which will allow you to perform parent child relationship in 1:N scenario.

Regards,
Ashwin

Former Member
0 Kudos

Hi David,

When having entity A and entity B where entity A has a navigation property to B (1:N), I create entity A and B, then create the relationship by adding B as navigation content of this navigation property. When saving this, I get error -10213 Deep inserts to entity sets are not supported.

Without creating the relationship, the newly created entities are created successfully.

david_brandow
Contributor
0 Kudos

There's no explicit bind API all, you would just set the navigation property of the existing entity to link it to the new entity.