在我们的应用程序中,我们使用S4Hana开发工具包来使用S4Hana的服务。
对于对S4的更新调用,我们使用补丁请求类型。在这样做的时候,我们发现我们不能在更新(补丁)期间设置空值。
例如:
--batch_A
Content-Type: multipart/mixed; boundary=changeset_176b-5a0d-cdab
--changeset_B
Content-Type: application/http
Content-Transfer-Encoding: binary
MERGE RequisitionItems(PurchaseRequisition='',PurchaseRequisitionItem='00000',DraftUUID=guid'00163e4e-c788-1eea-81bd-ddd3e2c48bf2',IsActiveEntity=false) HTTP/1.1
Plant: 0001
Currency: EUR
PurchaseOrg: 0001
CompanyCode: 0001
sap-contextid-accept: header
Accept: application/json
Accept-Language: en-GB
DataServiceVersion: 2.0
MaxDataServiceVersion: 2.0
Content-Type: application/json
Content-Length: 106
{"ExtPurgOrgForPurg":"0001","PurchasingGroup":"001",**"ExtPlantForPurg":null,**"ExtCompanyCodeForPurg":"0001"}
--changeset_B--
--batch_A--
在这里,我试图将ExtPlantForPurg设置为null,但是实体没有使用相同的值进行更新,而调试发现更新请求正文并不只包含这个字段(它被忽略,因为它包含null)
如果有任何方法可以使用补丁请求更新属性的空值,请让我知道。
发布于 2020-08-11 23:59:04
您可以使用includingFields()
功能专门列出应更新的字段,而不管其内容是否已更改。
https://stackoverflow.com/questions/58833210
复制相似问题