Symptom
When performing an Odata query with a filter defined for a text field, the following error message is returned:
Invalid Token Detected at Position X (where X represents the position of a character from the query)
Environment
SAP Cloud for Customer.
SAP Business ByDesign.
Reproducing the Issue
Perform a query using an Odata URL, and defining a filter for a text field. For example:
Cause
You are using a special character such as single or double quote (' or ") in the field value. As the Odata API uses these characters to limit the begin and the end of the values to be filtered, they are not properly handled by the system, causing the error.
Resolution
Perform the query suppressing the special character. In the example above mentioned in the Reproducing the Issue section, the e-mail of the filter should be inserted as "abcdef@mydomain.com".
The Odata API is capable of identifying the value even without the special characters.
Keywords
OData, Invalid Token Detected, Custom OData, Error, characters. , KBA , AP-RC-ODF , OData framework (C4C Only) , AP-RC-ODF-BYD , OData Framework and Console (ByD) , How To