Skip to Content

SAPUI5 - JavaScript - Batch Request - Issue

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)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Aug 14, 2017 at 07:49 PM

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

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 23, 2017 at 08:17 AM

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