Mentor SAP

Association and Navigation

In SAP Gateway Service Builder, you can define a data model in many different ways.

 

You can import an ABAP Dictionary structure to create entity types and complex types in your data model. You can reuse existing Function Module parameters and BAPI parameters to create entity types with ease.

 

There are however some elements of a data model that must be created manually if not, the OData model is incomplete. These elements are as follows:

 

 

 

Some elements that can be created easily based on existing data structures can also be created manually or be maintained. These elements are as follows:

 

 

The service document for the service now shows two entity sets: ProductSet and BusinessPartnerSet. It contains relative links. When following these links, the query method of the respective entity set is called.

 

The $metadata document contains more detailed information about the underlying entity types and their properties.

 

Navigation Properties

A product is delivered by one supplier. From the UI that shows the details of a product, we want to navigate to the supplier of that product. In the figure, we see that one business partner (1) can deliver several products (n).

 

An association is defined between the two entity types BusinessPartner and Product in the $metadata document.

 

Using the parameter Multiplicity, the cardinality of the endpoints is defined.

 

Each entity type can define navigation properties in addition to complex types and simple properties. Navigation properties materialize as relative links in the payload and allow the user or client to navigate through the result set in a similar way to a website with hyperlinks.

 

When calling the URL /ProductSet('HT-1000'), you retrieve the details of that product.

Navigation properties should have meaningful names so that it is clear what the consumer can expect when calling them.