SAP Knowledge Base Article - Public

3570957 - Discrepancy in Purchase Order Count in OData V2 and V4 API

Symptom

  • When migrating from OData V2 to V4 for Purchase Orders, a discrepancy in the count of Purchase Orders is observed.
  • In OData V2, the count of Purchase Orders has different number of entries.
  • In OData V4, the count of Purchase Orders has different entries, which matches the count in the "Manage Purchase Orders" app.

Environment

SAP S/4HANA Cloud Public Edition

Reproducing the Issue

  1. Make an OData V2 call to get the count of Purchase Orders.
  2. Make an OData V4 call to get the count of Purchase Orders.
  3. Compare the counts obtained from both calls.

Resolution

The difference between the OData V2 API and the OData V4 API is that the key distinction lies in the fact that the OData V4 API also returns Purchase Orders at the header level that are marked as deleted. To align the data with the OData V2 API, apply a filter by setting the header field PurchaseOrderDeletionCode = ''.  This will result in the same number of records as in the OData V2 API. 

Keywords

OData V2, OData V4, Purchase Orders, count discrepancy, API migration, SAP S/4HANA Cloud Public Edition, Sourcing and Procurement, Procurement Analytics, MM-FIO-PUR-ANA, MM-PUR-GF-MON. , KBA , MM-PUR-PO-2CL , Purchase Orders (Public Cloud) , Problem

Product

SAP S/4HANA Cloud Public Edition all versions