SAP Knowledge Base Article - Public

2633627 - Operator "gt" incompatible with operand types "Edm.DateTime" and "Edm.String"

Symptom

  • When adding the date filter in the Odata API query, it is throwing below error message.
  • Operator "gt" incompatible with operand types "Edm.DateTime" and "Edm.String"

Environment

SuccessFactors BizX

OData API

Reproducing the Issue

Operation: Query(GET)

ResourcePath :EmpPayCompRecurring?$select=payComponent,seqNumber,startDate,userId,customString1,paycompvalue,endDate&$filter=(payComponent eq '1234' and startDate gt '1900-01-01')

Gives the error as :

Operator "gt" incompatible with operand types "Edm.DateTime" and "Edm.String"

Cause

The problem is that OData is interpreting 2013-08-07T12:41:00 as a string and not a datetime as the field was specified on the server.

Resolution

The solution is to prefix the string with 'DATETIME' keyword like below:

ResourcePath :EmpPayCompRecurring?$select=payComponent,seqNumber,startDate,userId,customString1,paycompvalue,endDate&$filter=(payComponent+eq+'1234'&startDate+gt+datetime'1900-01-01T00:00:00')

Keywords

gt, greater than operator, gt in filter, incompatibility with operand types "Edm.DateTime" and "Edm.String", datetime field, gt compatibility , KBA , LOD-SF-INT-ODATA , OData API Framework , LOD-SF-INT , Integrations , Problem

Product

SAP SuccessFactors HCM Core 1802