cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Update Hana DB Using Batch Operation

Former Member
0 Likes
902

Hello Dev,

i am working on one ui5 Application Currently i am using XSJS service for Inserting and Updating Huge Amount ( 20 - 50 Thousand Records ) ,But it seems there is issue with Socket time Connection,So i want to do this in Odata using Batch Operation,

I understand  that I can Should use

var batchChanges = []; 

batchChanges.push( batchModel.createBatchOperation("/entity", "POST", DATA[] );

  batchModel.submitBatch(function(data) { 

  batchModel.refresh();

for Inserting Thousand of Records in one go without any TimeOut Connection Error !

But i am not getting  how could i Update the Thousands of records using Batch PUT Operation ?

i have found something.

But i am bit confuse that which one is the Where clause condition? i want to update the records on the basis of fieldname1 which is not a keyfield in the HANA DB TABLE


batchChanges.push(model.createBatchOperation( "/entity( fieldname1='" + data 1 + "',fieldname2=" + data 2+ "),  "PUT",data [] )




is this is the right way?

Accepted Solutions (0)

Answers (1)

Answers (1)

SergioG_TX
SAP Champion
SAP Champion
0 Likes

Shardul,

are you trying to update that many records from the UI ??   i have not heard of such scenario... alternatively, is there any other way to identify all these records in a simpler fashion.. then on the db you could do your mass update?

just a thought

Former Member
0 Likes

Yes ,i am pulling these records from third party API using AJAX get Method, than on success i want to insert these records in our Hana DB, i was using XSJS but XSJS is having Socket Timeout Issue, which can be extend upto 5 minutes only. but this processing taking more time because there is some validation as well which i am performing.. so thats why i want to upload and update that many records using ui frontend using Batch operation that is the only way left atleast it will not give me socket timeout connection ..

do you know any other way to insert and update  that many records  ?

SergioG_TX
SAP Champion
SAP Champion
0 Likes

I don't think you may be able to do this via an AJAX get from a UI very easy.. since this is a lot of records, most likely you will continue seeing timeout issues, etc.   you may be able to try Data Services (ETL Tool) 

maybe other options are available outside of SAP -

Former Member
0 Likes

Hello Sergio, thanks for your valuable suggestion

I am using batch Insertion do you have any clue i am getting this error " HTTP Request Failed "

After that i put Header ,but data is coming in Json Format.

oModel.setHeaders({

            

              "X-Requested-With": "XMLHttpRequest",

             "Content-Type": "application/http",

           "DataServiceVersion": "2.0"

      }); }


Than it is showing this error  NO Handle for data.

SergioG_TX
SAP Champion
SAP Champion
0 Likes

the content type could be 'application/json' instead if you are requesting json.. .i am not familiar with the x-requested-with property

Former Member
0 Likes

thanks for your reply,

this is the error " HTTP Request Failed "  in Log but then i added the header

oModel.setHeaders({

           

              "X-Requested-With": "XMLHttpRequest",

             "Content-Type": "application/http",

           "DataServiceVersion": "2.0"

      }); }







iam getting the data in Json format so i should use  "Content-Type": "application/json",  instead of Content type  application/http"  , but than it is still showing  HTTP Request Failed '


and if i am going with Content type  application/http"  than it is showing NO Handle for data. as you can see in the screenshot i have attached.



in both cases i am getting error , please advise