Skip to Content
2
Nov 15, 2021 at 03:21 PM

MDK Offline Deep Insert Workaround

707 Views

Dear Experts:


As part of our new project we have to make both Online and Offline Odata calls to backend passing Deep Entities (Header and Position Lines), basically in the backend Odata Header Entityset Create method I will need to have access and process all Position lines associated with this Header.

From what I have investigated and understood (https://answers.sap.com/questions/13058754/mdk-odata-offline-create-entity-for-entity-with-na.htmL), there is limitations on using Deep Insert for Offline operations and options would be using Batch call (which I am not sure will resolve my problem) or use Create Related Entity action as it is described in Tutorial https://developers.sap.com/tutorials/cp-mobile-dev-kit-link-entity.html.

I have been doing some tests with my Trial account (our production platform hopefully will be activated this week) and my questions are:

  1. Example in the tutorial uses CreateRelatedEntity action and calls this action by adding Position lines one by one, which has worked no problems. However, in my case I want to create these Position Lines in the loop from the Rules with dynamic values. I have tried to call the same action but passing parameters with dynamic data, but seems like it doesn´t work. Do you have some example of doing it from the Codes in Rules?
  2. Lets say we have managed to save Offline Header line and Position Lines in 2 separate tables with respective relations between them as in this tutorial, now at the time of Synchronization, how will this behave in the Backend? I mean will I get in the backend both Header and Position lines in the same call (like Deep Entity), also if you have some example of backend Odata codes would appreciate.

As other backup workaround I am also looking of first saving/synching Position lines table in one separarate Offline Service Upload action and then when it is saved in the backend to synch Header table via other Offline Service Upload action, so it can access its Position lines in the backend processing.

Anyway, would really appareciate if anyone could share their experiencce, some examples or ideas for optimal solution for this case.


Many thanks,

Yergali