cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 Odata Batch: Uncaught TypeError: Cannot read property '__batchResponses' of undefined

Former Member
0 Kudos

Hi,

We are doing a batch call from a SAPUI5 application to an ABAP ODataModel.

What we want is to send several PO Numbers to read some text information.

The problem is when we do the call, the error happens: "Uncaught TypeError: Cannot read property '__batchResponses' of undefined"

This problem only happens if we call from the SAPUI5 application. If we use the Gateway Client for test, is works fine.

Code used in SAPUI5 for batch call:

var oBapiModel = this.getView().getModel("potrackingBapiModel"); 

oBapiModel.setUseBatch(true); 

oBapiModel.setHeaders({ "content-type": "multipart/mixed; boundary=batch; application/http" }); 

oBapiModel.setDeferredGroups(["ID"]); 

oBapiModel.read("/PoTextDataSet" , { groupId: "ID" }); 

oBapiModel.attachBatchRequestCompleted(this, function(oEvent){ console.log("BatchRequestCompleted!"); }); 

oBapiModel.submitChanges({ groupId: "ID", 
success: function(oData) {console.log("SUCCESS ODATA"); }, 
error: function(oData) { console.log("ERROR ODATA");
} });

Appreciate any help.

Regards,

Oscar

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

Hi,

We don't have to pass the setHeaders method setHeaders method is used to set the custom headers. for more info refer the below link.

https://sapui5.hana.ondemand.com/#/api/sap.ui.model.odata.v2.ODataModel%23methods/setHeaders