发生错误提交批处理请求

时间:2016-12-30 10:28:51

标签: odata sapui5

我正在尝试使用批量请求将http post发送到服务器。

生成请求的代码段:

   _.each(aNewDates, function (oNew) {
     oModel.create("/CostCenterCalendarSet", oNew, {
       groupId: "newDates"
     });
   });
   oModel.setDeferredGroups(["newDates"]);

和提交方法:

oModel.submitChanges({
  groupId: "newDates",
  oSuccess: function (oMsg) {
    return observer.next(oMsg);
  },
  oError: function (oErr) {
    return observer.error(oErr);
  },
});

作为回应我有以下错误: enter image description here

我做错了什么?

更新

我尝试使用ODataModel read方法,但没有得到任何结果。

          let oPlantFilter = new sap.ui.model.Filter("Plant", sap.ui.model.FilterOperator.EQ, oSelectedData.sPlant);
          let oWcFilter = new sap.ui.model.Filter("WorkCenter", sap.ui.model.FilterOperator.EQ, oSelectedData.sWc);

          oModel.read("/CostCenterCalendarSet", {
            groupId: "query-dates",
            filters: [oPlantFilter, oWcFilter]
          });

          oModel.setDeferredGroups(["query-dates"]);

          return Rx.Observable.create(function (subscriber) {
            oModel.submitChanges({
              groupId: "query-dates",
              success: function (oData, oResponse) {
                return subscriber.next(oResponse);
              },
              error: function (oErr) {
                return subscriber.error(oErr);
              },
            });
          });

0 个答案:

没有答案