如何在使用 sapui5 执行更新操作时定义 HTTP PUT 方法

How to define HTTP PUT method while performing a update operation using sapui5

我想执行更新操作,但我遇到以下错误。

HTTP request failed (400 Bad Request): {"error":{"code":"SY/530","message":{"lang":"en","value":"Inline component is not defined or not allowed (HTTP PUT)"},"innererror":{"transactionid":"50EFF5DC7C760020E005F672522CBC10","timestamp":"20201018162311.0364030","Error_Resolution":{"SAP_Transaction":"Run transaction /IWFND/ERROR_LOG on SAP NW Gateway hub system and search for entries with the timestamp above for more details","SAP_Note":"See SAP Note 1797736 for error analysis (https://service.sap.com/sap/support/notes/1797736)","Batch_SAP_Note":"See SAP Note 1869434 for details about working with $batch.

var oEntry1 = {};
oEntry1.Ebeln = Ebeln;
oEntry1.Bukrs = Bukrs;
oEntry1.Bsart = "EC";
oEntry1.Lifnr = Lifnr;
oEntry1.Ekorg = Ekorg;
oEntry1.Ekgrp = Ekgrp;
oEntry1.Waers = Waers; // set the item data to ProductSet
oEntry1.POItem = itemData;

oModel.update("/POHeaderSet('" + Ebeln + "')", oEntry1, {
  success: function(data) {
    alert("success");
  },
  error: function(e) {
    alert("error");
  }
});

可以进行深度插入,但无法进行深度更新,因为不支持。

要在一次网关调用中更新父项和子项,您可以使用 $batch 功能。

查看批处理功能的文档:OData v2 Batch Documentation