Show TOC

Including an OData ServiceLocate this document in the navigation structure

Introduction
When creating an association, there may be instances when you want to link to an existing model as opposed to recreating it. In such cases, you can use the Including OData Service function to include models in the Service Builder and then create associations using the included models. This document is applicable to the projects of type Service with SAP Annotations and Service with Vocabulary-Based Annotations.
Example To create a sales order we require a list of customers and products. For the Sales Order service, two types of master data are required:
  • Customer
  • Product
You can use the Include Model function since the Customer and Product services already exist and can be reused.
Prerequisites
  • The service of the external data model must exist on the SAP NetWeaver Gateway hub system and be up and running.
  • To include a model from an external system, the system requirements are SAP NetWeaver Gateway SP05 (Software Component IW_BEP 200 SP05).
Including the Model
To include a model from a service, proceed as follows:
  1. Logon to the SAP NetWeaver Gateway system.
  2. Open transaction SEGW. The SAP NetWeaver Gateway Service Builder appears.
  3. Open an existing project to include a model from a service.
  4. Switch to edit mode.
  5. Right click on the Data Model folder and select Start of the navigation path Include  Next navigation step OData (GW) Service End of the navigation path from the context menu. Include Model from Service window opens.
  6. The Include Model from Service window opens.
    1. Case 1: Select the Service in Current System radio button if you want to include a service from the system in which you are working currently.
      1. On selecting Service in the Current System option, the RFC Destination field is automatically disabled.
      2. Enter the Technical Service Name of the service you want to include. Alternatively, you can also use the input help available for this field.
      On selecting the service from the input help window, the version of the service is automatically populated. If you enter the technical service name manually, you must specify the version.
    2. Case 2: Select the Service in External System radio button if you want to include a service from any external system.
      Note To include a model from an external system, the external system should be configured to SAP NetWeaver Gateway SP5 and higher. End of the note.
      1. On selecting the Service in the External System option, the RFC Destination field is automatically enabled.
      2. Enter the RFC Destination of the system in which the service you want to include resides. Alternatively, you can also use the input help available for this field.
      3. Enter the Technical Service Name of the service you want to include. Alternatively, you can also use the input help available for this field. On selecting the service from the input help window, the version of the service is automatically populated. If you enter the technical service name manually, you must specify the version.
  7. Click Continue. The selected service is added and available under the Model References folder in the tree view.
    Note To add further models, repeat the steps listed above.
  8. Double-click the included model, which can be found under the Start of the navigation path project Folder  Next navigation step Data Model  Next navigation step Model References End of the navigation path to view it in the mass maintenance view.The details of the referenced model are displayed in the mass maintenance view.
    Note The Model Reference Type displays Include, which indicates that the model was referenced by inclusion in Service Builder.
  9. Save the project.
Creating an External Association
This section explains how to create an association between the entities of the model you have included.
To create an external association proceed as follows:
  1. Open the Service Builder.
  2. Expand the Data Model folder in the tree view of your project.
  3. Double-click the Association folder to open it in the mass maintenance view.
  4. ClickDisplay-Change (Display-Change) and then Insert Row (Insert Row) to create a new association.
  5. Do the following to create an external association:
    1. Enter a name for the new association in the Association Name field.
      Note An error message displays if you do not enter a name for the association.
    2. Click the External Association Editor button in the mass maintenance view. The term external association refers to creating an association between the entities of the model that has been included in the Service Builder.
      Note You cannot make a selection until you have included a OData service.
      The Create External Association window displays.
    3. Do the following in the Create External Association window:
      1. Ensure External is selected in the Association Type field. The fields to enter the principal and dependent entity details are enabled.
        Note Depending on your requirements for the new association, you can enter either the details of the Principle Entity or Dependent Entity or both. However, you must make one entry.
      2. If you want to add an entity from the included model as the dependent entity, proceed as follows in the Enter the details if Dependent Entity is from the Included Model area:
        • Model Reference - Enter the model reference node name of the included model in the field. Alternatively use the input help to view and select the model reference node name. The input help displays the model reference node name of all the included models. On selecting the dependent entity, the Dependent Entity field in the mass maintenance view is populated with the entities of the selected model.
        • RFC Destination for Metadata - Provide the RFC destination of the system where the metadata of the included model resides. This is required only for the models whose metadata will be available in an external system, for example if you include a Gateway service created from a Service Provider Interface (SPI) or a SAP BW Analytics service.
      3. If you want to add an entity from the included model as the principal entity, proceed as follows in the Enter the details if Principal Entity is from the Included Model area:
        • Model Reference - Enter the model reference node name of the included model in the field. Alternatively, use the input help to view and select the model reference node name. The input help displays the model reference node name of all the included models. On selecting the principal entity, the Principal Entity field in the mass maintenance view is populated with the entities of the selected model.
        • RFC Destination for Metadata - Provide the RFC destination of the system in which the metadata of the included model resides. This is required only for the models whose metadata will be available in an external system, for example if you include a Gateway service created from an SPI or an Analytics service.
    4. Click Continue.
    The external association is completed and a checkmark appears on the External Association Editor button in the mass maintenance view. You can now create referential constraints, association sets and navigation properties for this association. The mass maintenance view displays the following fields:

    Fields

    Description

    Association Name

    Enter a name for the new association in this field.

    Note

    An error message displays if you do not enter a name for the association.

    External Association

    Click to create an external association. The term external association refers to creating an association with the entities of the model that has been included in the Service Builder.

    Principal Entity

    Enter the name of the principal entity, the entity which is being considered for the From Role in the new association. For an external association, if an included model is selected as a principal entity (refer to the Creating External Association step above), then the input help will also display the entities of the included model.

    Principle Entity Cardinality

    Select a cardinality for the principal entity from the drop-down list

    Dependent Entity

    Enter the name of the dependent entity, the entity which is being considered for the To Role in the new association. For an external association, if an included model is selected as a dependent entity (refer to the Creating External Association step above), then the input help will also display the entities of the included model.

    Dependent Entity Cardinality

    Select a cardinality of the dependent entity from the drop-down list

    Label

    Enter a label for the new association. This label is displayed as the label when the service is consumed.

    Label Text Reference Editor

    To define the label, use the Label Text Reference Editor. The Label Text Reference Editor enables you to enter the reference type.

  6. You can now generate the service.
Modifying the External Association
To modify an external association, proceed as follows:
  1. Click External Association button for the association with an external association.
  2. Make required changes.
  3. Click Continue.
Deleting an External Association
To delete an external association, proceed as follows:
  1. Click the External Association button for the association with an external association.
  2. Select the blank entry in the Association Type field.
  3. Click Continue
The check mark on the External Association button is removed.