我试图按下复选框上的oData创建并获得以下错误。不确定这是前端还是后端ABAP问题,因为在另一个项目中有相同的功能。
它在创建部分失败但奇怪的是仍在传递SiteId,ArticleNumber,VarianceDate&的细节。确认。
// Set CheckBox status, X for true, blank for false
onVarianceChecked: function (oEvent) {
var oEntry = {};
var bindingContext = oEvent.getSource().getBindingContext(this.MODEL_VIEW);
var path = bindingContext.getPath();
var object = bindingContext.getModel("SI").getProperty(path);
// Pass in the Header fields
oEntry.SiteId = this.SiteId;
oEntry.ArticleNumber = object.ArticleNumber;
oEntry.VarianceDate = moment(new Date(object.VarianceDate)).format('YYYY-MM-DDTHH:mm:ss');
// Set X or blank
if (oEvent.getParameter("selected") === true) {
oEntry.Confirmed = "X";
} else {
oEntry.Confirmed = "";
}
// Do the create
var oModel = this.getView().getModel("SI");
oModel.create("/VarianceHeaderSet", oEntry, {
success: function () {
console.log("Variance confirmed");
MessageToast.show("Variance confirmed", {
duration: 1000
});
},
error: function (oError) {
console.log("Error, variance could not be confirmed");
MessageToast.show("Error, variance could not be confirmed", {
duration: 1000
});
}
});
}
答案 0 :(得分:1)
'000000000'是Edm.DateTime的初始值,因此当您将DateTime属性建模为不可为空时,它将失败。
转到SEGW并将属性更改为“nullable”或确保始终在POST中提供正确的日期。