SAP Knowledge Base Article - Public

3421809 - API API_BILL_OF_MATERIAL_SRV;v=0002 returns error with "The material number is longer than the length set" during a PATCH operation for a material that includes a forward slash

Symptom

API API_BILL_OF_MATERIAL_SRV;v=0002 returns error with "The material number is longer than the length set" during a PATCH operation for a material that includes a forward slash

Environment

  • SAP S/4HANA Cloud
  • Bill of Material

Reproducing the Issue

Call the API BILL_OF_MATERIAL_SRV;v=0002 with sample payload below and method PATCH

/sap/opu/odata/SAP/API_BILL_OF_MATERIAL_SRV;v=0002/MaterialBOMItem(BillOfMaterial='00000001',BillOfMaterialCategory='M',BillOfMaterialVariant='1',BillOfMaterialVersion='',BillOfMaterialItemNodeNumber='1',HeaderChangeDocument='',Material='12345%252F12345',Plant='1010')

{"BillOfMaterialItemUnit": "EA","BillOfMaterialItemQuantity": "10"}

Cause

The Material ='12345%252F12345' is using the incorrect format for '/'

Resolution

Instead of using %252F in the material for correct interpretation, it should be enough to use only '%2F'. Which means, the URL should look something like this:

/sap/opu/odata/SAP/API_BILL_OF_MATERIAL_SRV;v=0002/MaterialBOMItem(BillOfMaterial='00000001',BillOfMaterialCategory='M',BillOfMaterialVariant='1',BillOfMaterialVersion='',BillOfMaterialItemNodeNumber='1',HeaderChangeDocument='',Material='12345%2F12345',Plant='1010')

Keywords

KBA , LO-MD-BOM-2CL , Bills of Material (Public Cloud) , How To

Product

SAP S/4HANA Cloud Public Edition all versions ; SAP S/4HANA Cloud all versions