头图

As mentioned in the introductory article SAP OData Development Tutorial - From Getting Started to Upgrading (including SEGW, RAP and CDP) , SAP OData service development, technically speaking, can be divided into three categories. Therefore, this tutorial is also divided into three parts, which will be introduced separately. This article is the article directory for this tutorial.

About the Author

Jerry Wang, joined the SAP Chengdu Research Institute after graduating from the University of Electronic Science and Technology of China with a master's degree in computer science in 2007. Jerry is a SAP Community Mentor and a SAP China Technology Ambassador. In his 15-year career in SAP standard product development, Jerry has participated in the research and development of standard products such as SAP Business ByDesign, SAP CRM, SAP Cloud for Customer, SAP S/4HANA, and SAP Commerce Cloud (e-commerce cloud).

Jerry has in-depth research on the development, testing, publishing, deployment, testing of SAP OData services, as well as the behind-the-scenes technical implementation details and usage scenarios of OData services based on various SAP technologies.

Development tutorial based on SEGW - Gateway Service Builder

Develop OData services using the Restful ABAP Programming model (RAP for short)

  • Currently writing, stay tuned

Develop OData services using the SAP Cloud Application Programming programming model

  • Currently writing, stay tuned

@[toc]

Application scenarios of $expand operation in OData service

The OData model creation we have completed so far in this step has only one node, Book. In the actual project, the OData model is much more complicated than the model designed for teaching purposes in our tutorial.

For example, the following figure is the OData model of the SAP CRM My Opportunities Fiori application. You can see that the model root node Opportunity can navigate to other child nodes, for example, through the Navigation Properties(导航属性) which we will learn in this step, from the root node Opportunity Departure, you can navigate to other child nodes. For example, the yellow Products in the figure below is one of the navigation properties. Through this field, you can navigate to all the Products data contained in the Opportunity.

This navigational affiliation between Opportunity and Products is also reflected in the UI of the Fiori application. My Opportunity is a Fiori application. The detail page of Opportunity has several Tab pages. Starting from the second tab page, each tab page corresponds to a child node of the Opportunity OData model. Take the Products tab in the following figure as an example, the data it contains is technically obtained by navigating to the OData model sub-node Products through the Opportunity root node and using the Navigation Property of Products.

We open the Chrome Developer Tools network tab and find an HTTP request url:

GET Opportunities(guid'FA163EE5-6C3A-1ED6-9DC1-C10749724C39')?$expand=Competitors,Products,OpportunityLogSet HTTP/1.1

In this url, not only the data of the Opportunity root node whose guid is FA163EE5-6C3A-1ED6-9DC1-C10749724C39 is requested, but also the $expand operation defined by the OData protocol, 在同一个 HTTP 请求里 For example, Competitors , Products and other data are retrieved together.

It can be seen that the OData protocol $expand , its function is to retrieve the root node together with the child node data specified by the Navigation Property in the same HTTP request, thereby reducing the need to achieve the same data reading The number of HTTP requests spent for the purpose.

Here are the specific steps on how our own OData service supports $expand operations.


注销
1k 声望1.6k 粉丝

invalid