0

Im trying to post data in batch call using OData service. But im getting Error like HTTP Request Failed. Im not able to find the exact error. Can some one please help me to fix this? Below is my code..

var payloadTest = {
        "Userid" : "",
        "RecId" : "000000012651",
        "Pernr" : "00039411",
        "Ename" : "Investment Test",
        "AttAbsType" : "TT01",
        "MarkAbst" : "",
        "Count" : 0,
    }

batchChanges.push(that.ODataModel.createBatchOperation(
                    "TestService('123')", "POST", payloadTest));

that.ODataModel.addBatchChangeOperations(batchChanges);
            that.ODataModel.setUseBatch(true);
            that.ODataModel.submitBatch(function(data, value) {
                that.ODataModel.refresh();

                if (data.__batchResponses[0].__changeResponses) {
                    that.busyDialog.close();
                    MessageBox.success(data.__batchResponses[0].__changeResponses.length);
                } else {
                    that.busyDialog.close();
                    MessageBox.error(data.__batchResponses[0].message);
                }

            }, function(err) {
                that.busyDialog.close();
                MessageBox.error("Error occurred", err);
            });

Please see the below error description in below image.. enter image description here

Please help me to fix the issue..

Thank you in advance

user2644620
  • 199
  • 1
  • 10
  • 37

1 Answers1

0

Your error message says "Bad Request" ... means your request body is simply wrong.

SAPUI5 - Batch Operations - how to do it right?

dotchuZ
  • 2,621
  • 11
  • 39
  • 65