cancel
Showing results for 
Search instead for 
Did you mean: 

ODATA Deep Insert Vs Change set End - Processing multiple entries at once

babu_kilari4
Active Contributor
0 Kudos

Hello Experts,

I do understand that the topic of processing multiple payload entries at one ago during thee POST operation of OData has been discussed here multiple times. But, I would like to understand a bit more.

I am using NW GWFND 7.4 and I am thinking of two options.

1) Deep Insert option where it allows us to process the records in an iteration with a wrapper entity set encapsulating the child entity set.

2) Buffering the records in the Create Entity set and collect the buffered entries in Change Set End method to execute the necessary operations.

I am trying to understand the Pros/Cons of the above two options and at the same time would like to know if there would also be a change in the way UI5 layer should process the data depending on how we build ?

While I read the old posts and came across the above two options; I would like your opinion in terms of suggesting the best practice here to handle this situation.

Also - why did SAP not provide an option "CREATE ENTITYSET" ? Could this be linked to the HTTP Timeout parameters ? If yes - isn't it the same with Deep Insert option as well ?

Please share your thoughts !

Accepted Solutions (0)

Answers (1)

Answers (1)

maheshpalavalli
Active Contributor
0 Kudos

Hi Babu,

Yes there are two options available.

1. Deep Create

You can use this for basic parent - Child relationship kind of entitysets. But u can see here it is specifically mentioned as "Create". you can manipulate it for update as well but the idea of that method is that it is a create entity for "parent - Child" entity.

2. Change set Process

I think you got the change set process wrong!!!. You do not need to buffer any data at create entity level. Please check the below blog for more explanation or any other blog at SAP Blogs.

https://blogs.sap.com/2018/05/06/batch-request-in-sap-gateway/

You just need to set the defered mode as true in changeset begin process to tell SAP that you are doing changeset process -> so create entity will not be called!!

Now you get all the batch data at one go in changeset process, be it create update or delete, everything comes there(not read).

Now if there are multiple header entities(records) and multiple child entities you can use this or even for single header entity(single record). Also from the UI5 you donot need to send the data in deep format, you can just call the individual create, update or delete entries..

Also, when the changeset begin defered mode is set as true then even the deep create method will not be called, it will be available as a record in changeset process method.

Best Regards,

Mahesh

maheshpalavalli
Active Contributor
0 Kudos

By the way, what i feel is and heard from experts is that changeset process is the best practice.

babu_kilari4
Active Contributor
0 Kudos

Hi Mahesh,

Thank you for reply. we cannot use defer mode option since we are still on SAP NW Gateway 7.4 and if I understand well the said functionality is only available in later versions.

So, this is why we are leveraging the Create Entity method to buffer the records and read these buffered records in Change Set End and process them at one go. I hope I have been able to explain the bottleneck.

Thanks & Best Regards,

Babu Kilari

maheshpalavalli
Active Contributor

Cool. I guess in 7.4 upgraded versions it is available then, so for your scenario, if you have only one header record and multiple item records, so use deep create only but if the defer mode is available then use changeset procses which is better.

babu_kilari4
Active Contributor
0 Kudos

maheshkumar.palavalli Thank you for the reply. In our case, we don't even have any header. All we are doing is to get some item level entries and generate a unique number for all those entries and store it in a table. So, the unique number we generate + incremental numbering for each record together forms the key. This is why we were kind of wondering what is the standard SAP suggested option for such cases. If you think Deep Insert is the right one, we could certainly do it that way. However, I am trying to also understand the key differences. I agree that Deep Insert makes one single call to Backend and iterates on the list of entries whereas BATCH with CHANGSET BEGIN & CHANGESET END would make multiple calls i.e., one call for each payload entry to the backend system to ensure it processes it separately and we can buffer the records as part of each call to process it at the end using CHANGESET END. I am trying to understand the key differences as there must be some reason why SAP has introduced and provided both the options. Would you know ?

Thanks & Best Regards,

Babu Kilari

maheshpalavalli
Active Contributor
0 Kudos

From my understanding, If we have simple requirement like header(1record) and item(multiple or one) then we do not need to implement all that buffering and stuff, just simply use the deep create method. But in case if you are having some complex requirement like ( multiple headers ) or ( multiple headers & multiple items ), this change set process will come to picture.

I cannot comment on why exactly SAP has introduced it(we might even be able to find the answer :p), but it might also be that initial they came with deep create and realized they need changeset process as well.. But for us to come to conclusion, for simple requirement go for deep create and for complex requirement go for changeset process.

Note: -> Better always go for changeset process if you have the changeset begin/process/end methods(in supported 7.4 splevels)

Best Regards,

Mahesh