Search code examples
odatasapui5abapcds

How to access a two levels deep nested association of an OData V2 service?


I have exposed an OData V2 Service via the ABAP Service Gateway (SEGW) based on a CDS View. The view contains indirect associations to two other views (entity_1 > entity_2 > entity_3 - no direct connection between entity_1 and entity_3). My problem is that I can't access entity_3 from entity_1 via entity_2. Accessing entity_2 works just fine by using /service_name/entity_1?$expand=to_entity_2 but after that I can't dive any deeper. I tried using /service_name/entity_1?expand=to_entity_2($expand=to_entity_3) but as soon as I put a second query in parenthesis after the first one I receive an error message.

Do I use a wrong syntax or are these nested calls not supported by OData V2? And if it's not supported how do I solve my problem? The service is used in a SAPUI5 application where it should be bound against a tree table so I need (three) different levels in my service.


Solution

  • Apparently the syntax was wrong. It works if you use /service_name/entity_1?$expand=to_entity_2,to_entity_2/to_entity_3.