Search code examples
javascriptsap-cloud-sdk

Empty key fields for MaterialBOMItem of API_BILL_OF_MATERIAL_SRV Version 2 using SAP Cloud SDK JavaScript


I am trying to update/delete a bill of material item using the SAP Cloud SDK JavaScript (version 1.12.0). The item belongs to a group BOM, i.e. the property "plant" is an empty string.

This results in the following self-explaining error message (example for PATCH request):

Error: OData update request failed!
    ...
Caused by:
Error: patch request to https://<host>:<port>/sap/opu/odata/sap/API_BILL_OF_MATERIAL_SRV;v=0002 $failed!
    ...
Caused by:
Error: The value:  of the key: Plant is not nullable, please set the value.
    ...

This behaviour is consistent with the documentation of the entity MaterialBOMItem of the service API_BILL_OF_MATERIAL_SRV (Version 2) (https://api.sap.com/api/API_BILL_OF_MATERIAL_SRV_0002/resource) where updating and removing entities of MaterialBOMItem require "Plant" and some other fields.

In detail, this affects the routes PATCH and DELETE which require these properties: BillOfMaterial, BillOfMaterialCategory, BillOfMaterialVariant, BillOfMaterialVersion, BillOfMaterialItemNodeNumber, HeaderChangeDocument, Material, Plant.

For some of them an empty value may be valid (e.g. empty plant for group BOM).

However, although "Plant" is marked as required it can be left empty when using the PATCH/UPDATE endpoints of API_BILL_OF_MATERIAL_SRV. This way I can update/delete a group BOM item.

Should the SDK support this behaviour as well?


Solution

  • Thank you for bringing this to our attention and for your comprehensive description of the issue. Yes, the SDK should support this. We fixed this bug and you should be able to use it with the next version (available ~2 weeks from now).