This video provides an in-depth explanation on how to use expand query options in OData. It demonstrates the process of accessing data from multiple entity sets together, using both the SAP framework and custom code. The presenter also discusses the performance implications of using the expand query option and introduces a new transaction code for tracing performance.
- Introduction to Expand Query Options in OData: The video begins by explaining the concept of expand query options in OData. This feature is useful when there is a need to access data from multiple entity sets together. The presenter explains that there are two ways to implement this: using the SAP framework, which works automatically, and writing your own code.
- Review of Previous Work: The presenter reviews the creation of a service to expose sales order data, which includes two entity types: sales order header and sales order item. They also discuss the association and navigation between these two entities.
- Demonstration of Expand Query Option: The presenter demonstrates how to use the expand query option to access both header and line item data together. This is done by using the
$expandquery option followed by the name of the navigation property that links the two entities. This method is shown to be more efficient as it reduces the number of calls to the backend system.
- Discussion on Performance: The presenter discusses the performance implications of using the expand query option. They note that while it reduces the number of calls to the backend system, it can still be slow if there is a large amount of data to fetch. This is because the system has to call the
get entity setmethod for each sales order, which is like running a select statement inside a loop.
- Introduction to Tracing: The presenter introduces a new transaction code for tracing performance. This tool helps in analyzing where exactly the time is being consumed and based on that, the code can be improved. The presenter demonstrates how to use this tool and explains the different types of traces available, including performance trace and payload trace.