Symptom
Executing API_PURCHASEORDER_PROCESS_SRV only returns 1000 Purchase Order's.
Environment
- SAP S/4 HANA Cloud
- Sourcing & Procurement
Reproducing the Issue
1. Execute /sap/opu/odata/sap/API_PURCHASEORDER_PROCESS_SRV/A_PurchaseOrder?$select=PurchaseOrder.
2. Select GET.
3. Execute.
4. Response returns 1000 Purchase Orders.
Cause
API_PURCHASEORDER_PROCESS_SRV is working as designed.
Resolution
With Release CE 2105, <clauses>-limit = 1000 was introduced for Performance reasons in API_PURCHASEORDER_PROCESS_SRV.
• Default paging size (D) = 1000 if the client did not provide $top
• Maximum paging size (M) = 5000 if the client offers $top
You can add a filter to the API to be more selective with the GET on the Purchase Orders:
Example :
/sap/opu/odata/sap/API_PURCHASEORDER_PROCESS_SRV/A_PurchaseOrder?$expand=to_PurchaseOrderItem&$filter=CreationDate gt datetime'2021-04-24T00:00:00'
You can set the paging size up to 5000 records using the following OData request:
Example:
/sap/opu/odata/sap/API_PURCHASEORDER_PROCESS_SRV/A_PurchaseOrder?$top=5000
/sap/opu/odata/sap/API_PURCHASEORDER_PROCESS_SRV/A_PurchaseOrder?$expand=to_PurchaseOrderItem&$filter=CreationDate gt datetime'2021-04-24T00:00:00'&$top=5000
You can add a skiptoken to the URL:
Example:
/sap/opu/odata/sap/API_PURCHASEORDER_PROCESS_SRV/A_PurchaseOrder?$skiptoken=1000
the next page is retrieved, starting with the next Purchase Order after the last one in the first result set. At the end of this "page" the skiptoken allows forward and backward "navigation" by giving both skiptokens:
<link rel="next" href="A_PurchaseOrder?%24skiptoken=1000&$skiptoken=2000"/>
See Also
https://api.sap.com/api/API_PURCHASEORDER_PROCESS_SRV/resource
3062595-Documentation Correction: Missing What's New Information on Changed Behavior of API_PURCHASEORDER_PROCESS_SRV (SAP S/4HANA 2020 FPS02)
Keywords
Cloud, 2105, /sap/opu/odata/sap/API_PURCHASEORDER_PROCESS_SRV/A_PurchaseOrder?$select=PurchaseOrder , GET, API, API_PURCHASEORDER_PROCESS_SRV, 1000, Return, Limit, <clauses>-limit = 1000, CL_SADL_SQL_EXECUTOR, skiptoken, URL , KBA , MM-PUR-PO , Purchase Orders , Problem
SAP Knowledge Base Article - Public