Symptom
An "Invalid URI segment" error with HTTP 400 Bad Request occurs when updating the validity end date for multiple pricing records via a batch request.
Environment
SAP S/4HANA Cloud Public Edition
Reproducing the Issue
- Call the API, for example: https://{host}:{port}/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV.
- Observe the error occurred: "Invalid URI Segment".
Cause
The error occurs due to incorrect URI formatting in the batch request, specifically the presence of unencoded special characters (e.g., colon ':') in the datetime value.
Resolution
- Encode special characters in the URI by replacing ':' with '%3A' in the datetime value, ensure the request is sent as a single POST call to the $batch endpoint and verify the correct batch structure as per API documentation.
- For example:
"uri" : "<host>/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity(ConditionRecord='0000032848',ConditionValidityEndDate=datetime'9999-12-31T00%3A00%3A00')".
See Also
- SAP Community: How to use Condition Record OData Service for Sales.
- SAP Help: API_SLSPRICINGCONDITIONRECORD_SRV - Batch Requests and Change Sets.
- KBA 3338020 - Error when calling API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdValidity.
- SAP Business Accelerator Hub: Overview | Condition Record for Pricing in Sales.
Keywords
invalid uri segment, bad request, status code 400, batch request, API_SLSPRICINGCONDITIONRECORD_SRV, A_SlsPrcgCndnRecdValidity, condition record, validity end date, batch processing, $batch endpoint, odata v2 adapter, uri format, colon symbol replacement, %3A , KBA , SD-MD-CM-2CL , Conditions and Condition Maintainance (Public Cloud) , Problem
SAP Knowledge Base Article - Public