cancel
Showing results for 
Search instead for 
Did you mean: 

Inserting multiple record simultaneously from UI5 to HANA using xsodata

HI Thomas,

I am new in xsodata, i have a question now as per my requirement i don't need to insert header and line item concept , i have to only insert multiple record in a table , can u suggest me how to handle it into the xs odata side , a flow would be great like what i have to do steps do i have to create procedure or xsjs and need to call to xsodata and how we will call the service into the UI post request do i need to use batch in this case.

Also if we are using batch then will it be good if user is selecting or creating thousand reocrds will it be good ?

Please suggest me the standard sap way of doing it.

Thanks,

Jay

Gautam_M
Participant
0 Kudos

Any updates..

Accepted Solutions (0)

Answers (1)

Answers (1)

thomas_jung
Developer Advocate
Developer Advocate

There is nothing you need to do on the server side then. Just use a batch operation from the client side request. The XSODATA framework will handle the batch operation. Yes a batch operation is preferred for large scale operations. There is certainly less overhead. However in general OData is particularly well suited to VERY high volume scenarios. For those you should seek other, specialized tooling (SQL IMPORT, SAP Data Services, SLT, etc).

0 Kudos

Hi thomas.jung ,

As suggested by you i have created below entry in my xsodata service.

service {

"TableName" as "InsertTable" keys generate local "GenID" ;

}

and below UI code for batch operation.

var oModel = new sap.ui.model.odata.ODataModel(this.sServiceUrl);

for(var i=0;i<aCreateEntry.length;i++){

var sPath = "/InsertTable";

aCreateOperations.push(oModel.createBatchOperation(sPath,"POST",aCreateEntry[i],null));

}

oModel.addBatchChangeOperations(aCreateOperations);

oModel.submitBatch(function(oData, oResponse, aErrorResponses){aCreateOperations

if(aErrorResponses.length>0){

sap.m.MessageBox.alert("Error in Creating. Please try again...");

console.log(aErrorResponses);

}else{

sap.m.MessageBox.alert("Batch Successfull", {});

}

});

after doing that it is giving me below error "Default changeset implementation allows only one operation"

Could you please help in here

Thanks,

Jay