cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 - JavaScript - Batch Request - Issue

0 Kudos

Hi friends.

I have a problem when I want to update data from SAPUI5 App.

The OData Model is v2.

I get the items from my table and update them through the odata model.

This is the controller code: SAP SCN thread

When I run the function this is the browser response:

This is the response of the ABAP system:

And this is the Request Payload:

According to the above I have some doubts:

1. Is the javascript code correct?

2. Are the Request Payload correct?

3. I have been investigating some discussions for this error, but still it is not clear to me which part should be corrected, if the ABAP part or the SAPUI5 part. (Discussion).

I do not have much experience for the management of batchs request, if someone knows or has dealt with something similar, I would appreciate your help.

Regards.

Accepted Solutions (0)

Answers (2)

Answers (2)

irfan_gokak
Contributor
0 Kudos

Hi,

For your reference. Code to make batch call.

batchUrls.push( oModel.createBatchOperation( "/EntitySet1", "GET"));  
batchUrls.push( oModel.createBatchOperation("/EntitySet2", "GET"));
batchUrls.push( oModel.createBatchOperation("/EntitySet3", "GET"));
oModel.addBatchReadOperations(batchUrls);
oModel.submitBatch(function(oData, oResponse) {
       	var batchError="";
        for (var i = 0 ; i<oData.__batchResponses.length ; i++){
            if(oData.__batchResponses[i].message !=null && oData.__batchResponses[i].statusCode!="200"){
                  batchError='X';
                  break;
             }
        }
        if(batchError !='X'){
              //if all calls goes success
        }
}, function(oData, oResponse){
         	debugger;
});
former_member365727
Active Contributor
0 Kudos

check if your metadata entityset structure and itemObject structure are same...

0 Kudos

Hi, Srikanth KV

Thanks for your help.Yes, the entityset structure and itemObject structure are same.When debugging in the Abap System, it only processes the first item in the table. At the time it is supposed to process the following items, it throws the error.
former_member365727
Active Contributor
0 Kudos

Have you implemented /IWBEP/IF_MGW_APPL_SRV_RUNTIME~CHANGESET_BEGIN and /IWBEP/IF_MGW_APPL_SRV_RUNTIME~CHANGESET_END ??

https://blogs.sap.com/2013/08/23/batch-request-in-netweaver-gatewaymultiple-operations-into-a-single...

0 Kudos

Yes, already implemented.

0 Kudos

Hi, Srikanth KV

Here the methods: