Skip to Content
0

SAPUI5 - JavaScript - Batch Request - Issue

Aug 14, 2017 at 05:28 PM

81

avatar image
Former Member

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.

code1.png (4.8 kB)
code.png (24.9 kB)
header.png (8.4 kB)
preview.png (30.2 kB)
payload.png (56.2 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Srikanth KV Aug 14, 2017 at 07:49 PM
0

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

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

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.
0

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-request/

0
Former Member

Yes, already implemented.

0
Former Member

Hi, Srikanth KV

Here the methods:

begin.png (23.9 kB)
end.png (11.7 kB)
0
Irfan Gokak Aug 23, 2017 at 08:17 AM
0

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;
});
Share
10 |10000 characters needed characters left characters exceeded