SAP Knowledge Base Article - Public

2735863 - Data is not coming in sorted when querying via OData/SFAPI - Recruiting Management


When I am performing a query selecting filter fields that are related to each other such as Country, the data is not coming in the correct order.

Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental.


SAP SuccessFactors Recruiting Management

  • OData API


This is caused by the order the system received the data and have the data stored in its database.


To have the data coming in a ordered way, meaning having the data coming in a sequential order you will need to add the $orderBy in the query to have the data sorted correctly, for example:

  1. The query is: [...]/odata/v2/JobRequisition?$select=jobReqId,country
    This query will return all the data in the order as they have been inserted into the database, so in this case the jobReqId will be what the results are sorted by, meaning that, the system will not order by country, then state then city, I can have the first result as United States and the second one as Australia, and so on. Summarizing, the order will be the order as it is in the database:
  2. Now, If I add a sorting on my query, I can have the result as a sequential order: [...]/odata/v2/JobRequisition?$select=jobReqId,country&$orderBy=country
    Now I will have my results ordered by the country, so in this case the all the occurrences of Australia and Brazil will come first and then all the United States occurrences:

You just need to add the information you need to be sorted by in the $orderBy of the query.


Order, OData, API, Sort, Dependent, Data, Sequential, Query, SFAPI, Cascading, Picklist , KBA , LOD-SF-RCM-API , Webservices & APIs , Problem


SAP SuccessFactors Recruiting all versions