Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

com.sap.cloud.server.odata.core.UndefinedException while using filter with expanded entity

ashishjain14
Product and Topic Expert
Product and Topic Expert
0 Likes
767

Hi,

While running the following query

/ProductSet?$expand=SellerDetails&$filter=SellerDetails/FullName eq `Seller1` 

I get the following error

com.sap.cloud.server.odata.core.UndefinedException: Cannot get property 'SellerDetails' of type 'mykartns.Seller' in entity type 'mykartns.Product', because the value is not set. This exception occurs because an undefined property is considered distinct from a null property (regardless of whether or not the property is defined as nullable in the service metadata). The attempt to access an undefined property may be evidence of a flaw in this client application (trying to access properties in a query result without having requested for the server to return values for the properties, or trying to access property values before initializing them), or may be evidence of a flaw in the service implementation (failing to return properties that were requested by the client application using $select or $expand). Depending on the root cause, options to avoid this exception include: (1) Using DataQuery.expand before executing a query (or in the query parameter to DataService.loadEntity) to ensure that navigation properties are requested from the server before trying to access them; (2) Using DataService.loadProperty to ensure that navigation properties are requested from the server before trying to access them; (3) Getting the service implementer to fix the service if it is unexpectedly omitting expected property values in responses; (4) Initializing all properties in newly created objects before trying to access the properties (using the 'setDefaultValues' function, or by specifying 'true' for the 'withDefaults' parameter of the proxy class constructor); (5) Using the 'hasDataValue' function to check if properties are defined before trying to access them; (6) With the dynamic API, using the 'getOptionalValue' function instead of using the 'getDataValue' function.


Attaching the metadata.txt for reference

Regards,

Ashish

metadata.txt

0 REPLIES 0