cancel
Showing results for 
Search instead for 
Did you mean: 

OData parameter expand in XSA and XSODATA file

mauriciolauffer
Contributor
0 Kudos

I'm using XS Advanced (SAP HANA SPS12) to develop an application with SAPUI5 and Node.js. I'm exposing my CDS Views as OData with a .xsodata file.

I've created the Associations and the Navigations for the OData entity. Almost everything is working pretty fine. I can load the OData service in my UI5 model and bind the properties.

The problem is I cannot use OData parameter $expand! If I bind the element using the full path it works, if I use $expand, it doesn't work!

With full path: returns status 200 (OK)
https://myhost/services.xsodata/Entities('key')/navToAnotherEntity

With $expand: returns status 500 (Internal Server Error)

https://myhost/services.xsodata/Entities('key')?$expand=navToAnotherEntity

This is the error message when I try to use the parameter $expand

{
  "error": {
    "code": 500,
    "message": {
      "lang": "en-US",
      "value": "Cannot read property 'type' of undefined"
    }
  }
}

Taking a look at the document SAP HANA Help, chapter SAP HANA Developer Guide for XS Advanced Model > Defining OData Services for XS Advanced Applications > OData Parameter Entity Sets, it says:

"This navigation property cannot be used in combination with the OData query options $expand, $filter and $orderby."

But I'm not using any SAP HANA Calculation Views, I'm using only CDS Views. I'm not using parameterized entity. Why does the error happen?

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

On an expand you don't put the navigation name but instead the child entity itself.

miyanaleem
Participant
0 Kudos

Hi thomas,

Is it possible to $expand 2 tables ..

It showing erorr that $expand can be used only once.

whats the substitution for that.

thanks

Answers (0)