Symptom
When using the OData V4 API to query multiple customer returns while expanding pricing-related entities, the API returns an error message as "You can read pricing elements only for a single sales document item at once."
Example payload: https://host:port/sap/opu/odata4/sap/api_customerreturn/srvd_a2x/sap/customerreturn/0001/CustomerReturn?$filter=(CustomerReturn eq '123456' or CustomerReturn eq '123457')&$expand=_Item($expand=_ItemPricingElement,_ItemText,_ItemPartner),_Partner,_PricingElement
Environment
SAP S/4HANA Cloud Public Edition
Cause
This is a limitation in OData V4 API, currently only one customer return order can be retrieved via OData V4 when expanding pricing related entities.
Resolution
Follow either of the workaround below:
- Use the OData V2 API to query multiple customer returns; note that this API supports expansion only at the first level.
- Use OData V4 Batch request which supports querying multiple customer returns.
See Also
Keywords
OData v4, API, pricing elements, customer returns, batch request, OData V2, header pricing element, expand pricing element, You can read pricing elements only for a single sales document item at once , KBA , SD-SLS-RE-2CL , Returns (Public Cloud) , SD-SLS-API-2CL , API (Public Cloud) , Problem
SAP Knowledge Base Article - Public