Show TOC

Creating RelationsLocate this document in the navigation structure

You can create internal relations between data objects in your data model and external relations to properties in another data model.

Note

You can only map to the root data object of the target data model.

When you create a relation, the following validation takes place:

  • For a Query operation, there must be a one to one relationship.

  • For a Read operation, there must be a one to many relationship.

  • If you are creating a relation between two data models generated by the content generator, you can only create a one to one association if one parameter is mapped to the target data model's key value (S_COR_ID_VALUE).

You can rename and delete existing relations from the context menu.

Procedure

Creating an External Relation

  1. Right-click one of the following and choose Start of the navigation path Create Next navigation step External Relation End of the navigation path:

    • Data Object

    • Object Structure folder

    • Related SAP GW Models folder

      The Create Relation popup displays, with the Source Data Object field already filled in with the name of the Data Object from which you are creating the relation:

      Create Relation

  2. Enter a Relation Name.

  3. Use the F4 Help to select the Target Data Model to which you want to link.

  4. Select the green check mark to continue.

    The new relation then appears under the target data model in the Related SAP GW Data Models folder in the tree view with a cardinality of 1, and the Properties Editor displays so that you can define the new relation. There are no mandatory fields.

  5. Save your entries.

The following fields are available for editing in the Properties Editor; the other fields are read-only.

Field

Description

Default

Entity Enabled

If selected, the relation is enabled in this data model and will be reflected at runtime. If not selected, the relation is ignored at runtime. Select this checkbox if you wish to enable the relation in this data model.

Selected

External Name

Name of relation as represented in the external service, service document, and metadata document.

 

Source Cardinality

Cardinality of the source data object. For internal (parent / child) relations, the cardinality is always 1 (one-to-one relationship). For external relations, it can also be 1:n (one-to-many relationship).

1

Target Cardinality

Cardinality of the target data object or data model. For internal (parent / child) relations, the cardinality is always 1 (one-to-one relationship). For external relations, it can also be 1:n (one-to-many relationship).

1

Target Operation

Name of the Query operation to be called in the target data model.

 

Title

Language-dependent title in the user's logon language (if available). Enter a suitable title.

 

Source Property

Specifies the source property for the external relation. Select a field from the source data object to map to the key field of the target data model (displays in the Target Property column). You can use the F4 Help to select the source property.

If the relation has a target cardinality of 1, simply map it. If the relation has a target cardinality of 1..n, enter the property from the source data object in the left column on the same line as the required target property in the right-hand column.

 

Target Property

Specifies the target property of the target data model for the external relation. Select the target data model's key field to which you want to map the source data object.

If the relation has a target cardinality of 1, simply map it. If the relation has a target cardinality of 1..n, select the property that you wish to return from the target data model.

 

Creating an Internal Relation

  1. Right-click a data object, and choose Start of the navigation path Create Next navigation step Relation Next navigation step Internal End of the navigation path.

    The Create Relation dialog box displays.

  2. Enter the Name of the relation and then press the green checkmark.

    The new relation then appears under the Relations from… folder under the data object in the tree view with a cardinality of 1, and the Properties Editor displays so that you can define the new relation. There are no mandatory fields.

  3. Save your entries.

When creating an internal relation, the fields listed in the table in Creating an External Relation above are also available for editing, except for Target Operation, Source Property, and Target Property. Other fields are read-only.