on 07-25-2019 11:33 PM
I have build a native hybrid app with sapui5 along with cordova kapsel plugin. I have implemented deep insert while posting create operation.
I am using header + line item and then posting it.
It is working fine in online mode but in offline mode it is giving error from smp :
[-10213] Deep inserts to entity sets are not supported
I read deep insert is not supported in offline mode.
What is the alternative for it is there any other way for post(create) operation in offline mode other than deep insert.
What are the changes needed for it . I have been trying a lot. How can I post what are changes needed from sapui5 and odata/abap
Please somebody give some suggestion
Hi Arka,
there is a better work-around to the one suggested by sap. It works very well in my last project which contains lots of multi-level deepinsert entities. And in this solution, you can keep your deep model and no need to split it into flat entities. Here is the general idea:
For example, you have several DeepInsert Entity in your GW project. One called ProductSet.
You define an Entity DeepInsertInput that contains a name and body properties (string). In the UI, you encode (e.g. base64) the deepinsert json and post it to this entityset. The reason for encoding is to be enable to pack that json payload inside another json. The payload looks like this:
{
"name": "ProductSet", //name of your DeepInsert Header Entity
"body": "YLKJlXYjx" //encoded string of the JSON payload
}
In the create() method of the gateway, you decode the body and get the json string. And send it to the orignial Entity using it as json payload using HTTP Post request in ABAP. In this example, it will be:
HTTP: Post
URL: http:\\<url GW odata service>\ProductSet
body: decoded json of the deepinsert payload
That mean, you first use this DeepInsertInput Entity just for forwarding the deepinsert payload. Then, the GW send it to himself.
I hope I have explained it clearly.
May be next time I should write a blog about how to implement it in detail, and share some code.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
69 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.