sapui5使用OData服务在批量调用中发布数据

时间:2018-05-03 10:32:43

标签: odata sapui5

我试图使用OData服务在批量调用中发布数据。但我得到错误,如 HTTP请求失败。我无法找到确切的错误。有人可以帮我解决这个问题吗? 以下是我的代码..

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);
            });

请参阅以下图片中的以下错误说明.. enter image description here

请帮我解决问题..

提前谢谢

1 个答案:

答案 0 :(得分:0)

您的错误消息显示"错误请求" ......意味着你的请求主体是完全错误的。

SAPUI5 - Batch Operations - how to do it right?