SAP Knowledge Base Article - Public

3727292 - Expand URL parameter not retrieving information in Odata V2 Sales Order for header pricing elements

Symptom

When trying to retrieve the Pricing elements, at header level, from a Sales Order with the URL parameter $expand, using Sales Order A2X OData V2 the entities are not returning. It can be observed that in Sales Order A2X OData V4 the parameter is retrieving the data correctly.

Environment

SAP S/4HANA Cloud Public Edition

Reproducing the Issue

  1. Run a GET request in a sales order following the URL <host>/sap/opu/odata/SAP/API_SALES_ORDER_SRV/A_SalesOrder('<sales order number>')?$expand=to_PricingElement
  2. See that the response looks like this:

"to_PricingElement": {
      "results": []
    },

Cause

Header pricing elements in the OData V2 API are returned only if there are persistent header conditions. When going to pricing tab in header it is possible to normally see lines with cumulated from the items.

This is calculated on the fly, as V2 response is purely CDS based, no data is returned.

Resolution

OData V4 API will return data not only with persistent conditions but also calculated on the fly, therefore the official SAP recommendation is to use API Sales Order (A2X, OData V4) if the requirement is to retrieve cumulated pricing conditions.

See Also

Keywords

API, header, pricing, element, data, GET, response, V4, V2, conditions, persistent, element, expand, $, URL, parameter , KBA , SD-SLS-API-2CL , API (Public Cloud) , Problem

Product

SAP S/4HANA Cloud Public Edition all versions