Skip to Content
0

Batch Call error in SAPUI5 application

Feb 15, 2017 at 03:49 PM

192

avatar image
Former Member

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

error1.gif (21.9 kB)
10 |10000 characters needed characters left characters exceeded
Former Member

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.

0
Former Member
Former Member

Hi Radek,

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

Regards

V. Suresh Kumar

0

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.

0
Former Member
Veeraraghavan Narasimhan

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

batcherror.gif (9.1 kB)
header.gif (15.0 kB)
payload.png (135.8 kB)
0

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

0
Former Member
Veeraraghavan Narasimhan

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

0
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Jun Wu Feb 15, 2017 at 07:13 PM
0

can you check what is happening at the backend?

Show 8 Share
10 |10000 characters needed characters left characters exceeded
Former Member

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

0

did u enable batch processing in the backend?

0
Former Member
Jun Wu

Hi Jun Wu,

Yest, batch processing is enabled in the backend.

Regards

V. Suresh Kumar

0

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

0
Former Member
Jun Wu

Hi Jun Wu,

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

Regards

V. Suresh Kumar

0

show us the screenshot your request detail

0
Show more comments

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

0
avatar image
Former Member Feb 16, 2017 at 12:15 PM
0

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

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

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

0