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

Related questions

2 Answers

  • Posted on Aug 14, 2017 at 07:49 PM

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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on 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 a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.