cancel
Showing results for 
Search instead for 
Did you mean: 

Batch Call error in SAPUI5 application

skvallabhaneni1
Explorer
0 Kudos

Hi,

I have a Save button and upon clicking I am trying to submit the changes to the backend. I am using a batch call to the gateway service.

When I see the network tab after click on the button, the batch operation status is in 'pending' and after sometime I am getting an 500 internal server error- time out connection.

The error screenshot message is attached.

Can anyone please help why I am facing this issue.

My controller code on action is below.

onSave: function() {

var that = this;

var aBatchOperations = [];

var oModel = this.getView().getModel();

var oLayout = this.byId("HeaderPage");

var editData = oLayout.getModel("EditHeader").oData;

aBatchOperations.push( oModel.createBatchOperation(this.updatePath, "PUT", editData, null) );

oModel.addBatchChangeOperations(aBatchOperations);

oModel.setUseBatch(true);

oModel.submitBatch(function(data) { //Logic to Check Response oModel.setUseBatch(false);

sap.m.MessageToast.show("Operation Processed Successfully"); that.onNavBack();

oModel.refresh();

}, function(err) {

oModel.setUseBatch(false); // open a fully configured message box sap.ui.commons.MessageBox.show(err.response, sap.ui.commons.MessageBox.Icon.ERROR, "Error", [sap.ui.commons.MessageBox.Action.OK], sap.ui.commons.MessageBox.Action.OK); });

}

Regards

V. Suresh Kumarerror1.gif

Former Member
0 Kudos

You should use v2 oData model as the one you are using is obsolete. v2 model handles batches by default unless you switch batch processing off.

former_member228602
Contributor
0 Kudos

Just like Radek mentioned it is better to switch over to V2 Odatamodel from a usability issue. But your issue looks something else. First things first it is Error code 500 and i am surprised to see that you say server has not been hit. It could have hit the server and not your application and rejected by framework. I would suspect even in your case it has been rejected by framework.

Can you paste the screenshot of your batch request. Header and also content and answer could lie there.

skvallabhaneni1
Explorer
0 Kudos

Hi Radek,

How to use v2 OData model. Can you please refer some code snippet.

Regards

V. Suresh Kumar

skvallabhaneni1
Explorer
0 Kudos

Hi Narasimhan,

Please find the batch request, header and also content in the attached files. I attached the screenshots of the network tab, header content.

batcherror.gifheader.gifpayload.png

Regards

V. Suresh Kumar

former_member228602
Contributor
0 Kudos

Hello Suresh,

The requests appear to be correct. Next troubleshoot on gateway. Navigate to txn /iwfnd/error_log after request fails and check if any is caught there. You can attach the screenshot to check further.

Thanks and Regards,

Veera

skvallabhaneni1
Explorer
0 Kudos

Hi Veera,

I checked the transaction /iwfnd/error_log after the request fails but I didn't see any error in the log.

Regards

V. Suresh Kumar

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello Suresh,

1) Please ensure that "this.updatePath" contains unique parameter value that you want to update.

for performing PUT operation you need to specify unique parameter in updatePath.

2) Check whether you are getting data in "editData".

can you send console error log.

Regards,

Mahesh Phajage

skvallabhaneni1
Explorer
0 Kudos

Hi Mahesh,

this.updatePath has a unique parameter value.

We are getting the data in editData

We didn't see any error in the console.

The $batch operation is in pending state for sometime after that I am getting an error in the console log as '500 Internal Server Error, Connection Time Out'.

Regards

V. Suresh Kumar

junwu
Active Contributor
0 Kudos

can you check what is happening at the backend?

skvallabhaneni1
Explorer
0 Kudos

Hi Jun Wu,

The request is not coming to the backend. We checked the traces and we didn't see the request in the trace.

Regards

V. Suresh Kumar

junwu
Active Contributor
0 Kudos

did u enable batch processing in the backend?

skvallabhaneni1
Explorer
0 Kudos

Hi Jun Wu,

Yest, batch processing is enabled in the backend.

Regards

V. Suresh Kumar

junwu
Active Contributor
0 Kudos

check at network tab to see what u are sending in the request.

skvallabhaneni1
Explorer
0 Kudos

Hi Jun Wu,

The request looks good and I didn't see any issue with the request.

Regards

V. Suresh Kumar

junwu
Active Contributor
0 Kudos

show us the screenshot your request detail

skvallabhaneni1
Explorer
0 Kudos

Hi Jun Wu,

Please find the attached screenshot.

Regards

V. Suresh Kumarheader.gifpayload.png

junwu
Active Contributor
0 Kudos

screenshot is too small...........