on 03-13-2017 7:35 AM
Hi,
I'm trying to insert multiple records using create Operation (CREATE_ENTITY) in OData. Is it possible? Please explain with detailed steps
Hi Venkatesh,
It is possible to insert multiple records in one go as mentioned in below ways:
1. If you use deep create funtionality, you can insert multiple child items at a time in single call(pass the data to odata service as an array).
2. Lets say you want to insert multiple header data at a same time, then simple loop on those items and call the odata create, update or delete operations(assuming you are using V2 odata model). Then a batch call will be sent to backend and in the backend if the changeset process is implemented, you can see all the insert records at a time and you can write your db logic there.
you can google or search in scn blogs for Deep create and Change set process and implement the same easily.
Best Regards,
Mahesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As Mahesh said just call oModel.create(); in a loop and if you are using v2 model it will take care of the batch operations automatically. You can also do that explicitly by setting deffered groups and then using oModel.submitBatches();. On the gateway side you have to redefine CHANGESET_BEGIN and CHANGESET_END methods and make sure there is no COMMIT WORK inside your CREATE entity method otherwise it will fail.
Use create deep entity if you want to create a header along with its items (e.g. Purchase order header + Purchase order items in one go)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.