Show TOC

Association SetsLocate this document in the navigation structure

NoteThe following image contains links to more information.
In SAP Gateway Service Builder, you can define a new data model within your project to suit your exact service requirements based on the data you want to expose at runtime. Entity Types Entity Sets Associations Association Sets Function Imports Complex Types
Introduction
An Association Set groups Association instances (similar to how an Entity Set groups Entity Type instances). Hence, it specifies a relationship between two Entity Sets based on the respective Entity Types of the underlying Association.
Example Assuming you have a 1:n association Author_To_Books based on Entity Types Author and Book there may be an Association Set WrittenBy for the Entity Sets Authors and Books, as well as another Association Set FictionWrittenBy for the Entity Sets FictionAuthors and FictionBooks. This means if you follow a navigation link from an entry of an Authors feed at runtime, it yields a Books feed, whereas following a link from an entry of the FictionAuthors feed yields a FictionBooks feed - both are structurally equal (as they are based on the same Entity Types) but have different semantics and may contain different entries.
Procedure
To create an Association Set in the Service Builder proceed as follows:
  1. Right click the Data Model folder, and choose Create, and then select Association Set. Also, you can create a new Association Set when you right click the Association Set folder, and select Create. The Create Association Set dialog opens.
  2. Specify a name for the Association Set. The Association Set name must be unique, and cannot contain characters that are not allowed such as, numbers and other symbols. All the elements needed to create relations between entities, such as Association, Association Set, Referential Constraints, and Navigation Properties are also created for you. Press F4 in Association Name to choose from the list of associations in the model. The Association Set and Navigation Properties must be unique. The cardinality for the Entity Type and Entity Set are automatically verified. When you choose OK, a new Association Set is created in the project tree. In the mass edit view, the Association Set table displays the new entries for the Association Set.
Alternatively, use the following steps:
  1. Open the Service Builder.
  2. Expand the Data Model folder in the tree view of your project.
  3. Double-click the Association Set folder to open it in the mass edit view.
  4. Choose Display-->Change (Display-->Change) and then click Append Row (Append Row) to create a new association. A row is now added.
  5. Do the following in the mass edit view under Association Sets:

    Fields

    Description

    Name

    Enter a association set name in the Association Set Name field.

    Association

    Enter the association name in the Association Name field.

    Principal Entity Set Name

    Enter the name of the Principal Entity Set for which the association set has to be created.

    Dependent Entity Set Name

    Enter the name of the Dependent Entity Set for which the association set has to be created.

    Label

    Enter a label for the new association.

    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. Save the changes.