SAP Knowledge Base Article - Public

2148752 - How to extract future dated records using OData API

Symptom

How to fetch data for records with effective start date in future?

By default OData API call returns "AsOfDated" records for effective dated entities. 

 

Reproducing the Issue

Example : The following qurey returns only a single record i.e. the record which is currently active.

https://<hostname>/odata/v2/EmpJob?$filter=userId+eq+'EXAMPLE1'

This would not give the record as a result which has effective start date in future.

 

Cause

This query is lacking a filter that returns the future dated records.

Resolution

OData supports below two keywords as a filter parameter:

  1. fromDate
  2. toDate
  • It Can return multiple records, depending on information available.
  • For example, if the fromDate is 3/15/2013 and the toDate is 3/30/2013, the returned effective data would be like effective_start_date<=3/30/2013 and effective_end_date>=3/15/2013.

Note : The default query is asOfDate, using $filter for  start date or effective end will require the fromDate and/or toDate to be specified.

Use the filter parameter fromDate to return historic as well as future dated records.

Eg : fromDate=1900-01-01

Eg. of the query : https://<hostname>/odata/v2/EmpJob?$filter=userId+eq+'EXAMPLE1'&fromDate=1900-01-01

See Also

fromDate and toDate query: returns historic information for the specified date range. Can return multiple records, depending on information available. For example, if the fromDate is 3/15/2013 and the toDate is 3/30/2013, the returned effective data would be like effective_start_date<=3/30/2013 and effective_end_date>=3/15/2013. Query request: /jobInfo? fromDate=3/15/2013&toDate=3/30/2013 will return records from 3/15/2013 to 3/30/2013 for jobInfo entity.

Keywords

OData API, future dated records, API, OData, future date , KBA , LOD-SF-INT-EC , EC SF API/OData Entities , How To

Product

SAP SuccessFactors HCM Core all versions