Show TOC

Including an OData Service (SAP Gateway).Locate this document in the navigation structure

Use

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 Include Model from Service function to include models in the Service Builder and then create associations using the included models.

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 as the Customer and Product services already exist and can be reused.

Prerequisites
  • The service of the external data model must exist on the SAP Gateway hub system and should be up and running.

  • To include a model from an external system, the system requirements are SAP Gateway SP05 (Software Component IW_BEP 200 SP05).

Process

To include a SAP Gateway service, proceed as follows:

  1. Logon to the SAP Gateway system.

  2. Open transaction SEGW.

    The SAP Gateway Service Builder opens.

  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 Service (SAP GW) End of the navigation path from the context menu.

    The Include Model from Service window opens.

  6. Do the following In the Include Model from Service window:

    1. Case 1: Select Service in Current System if you want to include a service from the system in which you are working currently.

      1. On selecting this 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 Service in External System 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 Gateway SP5 and higher.

      1. On selecting this option, the RFC Destination field is 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 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.



    Figure 1: Referenced Model displayed in the mass edit 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 describes you 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. Switch to edit mode.

  5. Click Insert row to create a new association.

  6. 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 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 model.

      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 SAP 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 SAP Gateway service created from an SPI or an Analytics service.

      4. Choose Continue.

        The external association is completed and a checkmark appears on the External Association Editor button in the mass maintenance view.

        Note

        You can now create referential constraints, association sets and navigation properties for this association. See Navigation Properties Referential ConstraintsAssociation Sets

      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.

  7. You can now generate the service.

Modifying the External Association

To modify an external association, proceed as follows:

  1. Choose External Association button for the association with an external association.

  2. Make the required changes.

  3. Choose Continue.

Deleting an External Association

To delete an external association, proceed as follows:

  1. Choose the External Association button for the association with an external association.

  2. Select the blank entry in the Association Type field.

  3. Choose Continue.

    The check mark on the External Association button is removed.

More Information

For more information, see Generating the Service.