on 12-24-2018 4:10 PM
Hello Experts,
In my SAPUI5 application, I have one like below format:
For the above mentioned data, I have created my ODATA entity set with association. My primary entity is EMP. My dependent entities are ASSIGNMENT, EMPINFO, EMPEX where ASSIGNMENT is kind of array.
I have redefined the method CREATE_DEEP_ENTITY. Its working fine. Now my question is:
I would like to update the data which is created through the method CREATE_DEEP_ENTITY.
To do so, need guide or suggestion. What is the best way to achieve this? Please help me on this.
If any doubt in my requirement, please ask me.
Thanks,
Arindam.
Simply, next time send the data using the deep format only but check in that method if the key is passed, then it is update else if no key is passed then it is create.
But the best way would be to call the individual create or update method via the batch(if it is odata v2 model by default it groups all the create,update and delete operation). Then in the backend instead of create deep, use the changeset process methods where you will get all the individual create, update and delete requests in seperate rows and from there you can write the save logic. there are couple of blogs out there regarding the changeset process, one such link below:
https://blogs.sap.com/2018/05/06/batch-request-in-sap-gateway/
BR,
Mahesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It's simple, you need to use odata v2 model, which by default batches the data. On click of save, call the create method of odata v2 model multiple times in a loop or in your way for multiple entitysets. Then by default the requests are batched and sent in one request.
So in the backend, you will use the changeset process method to get all the rows.
But like I said, if you dont want to rewrite the whole process, simple use the create deep entity only but differentiate the data in the createdeep entity method based on the key. if it is filled it is update else it is create. key means, like if you are updating sales order, it is sales order number
BR,
Mahesh
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.