SAP Knowledge Base Article - Public

3723692 - OData $orderby is ignored when the sort column is not first in $select on Datasphere Analytical API

Symptom

It can be observed that the $orderby clause of OData is ignored when the sort column (CC_END_DATE or CC_START_DATE) is not the first property in the $select list. The same request with the same filters and $orderby returns results that are not sorted, if the sort column is in 2nd/3rd position in $select. This contradicts OData v4 behavior, where $orderby must be independent of the $select projection order.

Expected behavior would be that, $orderby must be applied regardless of the position of the sorted property in $select, and $top must be applied after sorting.

Environment

SAP Datasphere

Reproducing the Issue

Example URL: https://****.hcs.cloud.sap/api/v1/datasphere/consumption/analytical/****/****/*****?$filter=****%20eq%20%2768122617%27%20and%20((***%20eq%20%27***%27%20or%20***%20eq%20%27***%27)%20and%20CC_END_DATE%20le%202026-02-18)&$select=***,CC_START_DATE,CC_END_DATE,***,DESCR&$orderby=CC_END_DATE%20asc&$top=5

Cause

Program error.

Resolution

A fix for this issue was created and it will be available to you via SAP Datasphere Wave 2026.08. See SAP Note 2984828 - SAP Datasphere Release & Delivery Schedule, regarding the planned availability of the fix.
 
As global deployment usually takes 24 hours, plan to test the fix one day later.

Keywords

OData $orderby ignored, sort column, $select, Datasphere, Analytical API , KBA , DS-BB-ODATA , To address issues related to Odata consumption API , Problem

Product

SAP Datasphere all versions