Show TOC

Defining PropertiesLocate this document in the navigation structure

Use

In SAP NetWeaver Gateway Service Builder, you can define properties for entity type and complex types. Properties define the characteristics of the data that an entity type or complex type instance will contain at runtime. The properties of entity types and complex types are stored in a separate Properties subfolder within the Entity Types and Complex Types folders in your Service Builder project.

Properties comprise the following:
  • Attributes
    • Name
    • Type (Edm type (with facets such as Nullable, MaxLength, FixedLength, Precision, Scale) or complex type
  • Annotations
    • SAP annotations (such as Creatable, Deletable, Label, UnitProperty)
    • Vocabulary-based annotations
  • ABAP type information
    • ABAP field name
    • ABAP type assignment
Procedure

To create a new property, proceed as follows:

  1. Expand the Data Model folder in the tree view of your project.

  2. Expand the Complex Types or Entity Types subfolder (depending on the data object type for which you want to edit the properties) and double-click the Properties subfolder.

  3. Choose Edit in the mass maintenance view and then Insert Row to add a new row to the table for the new property.

  4. In the Node Name column, enter a name for the property you want to create. You must enter a name in this column. For example, enter NEW_PROPERTY. Since this is a mandatory input field, if you do not enter a node name, an error message is displayed and you cannot save the changes to your project.

  5. Define the attributes of the new property:
    Note The columns in the Properties table differ depending on whether the project is of type Service with SAP Annotations, for which Edm Core Type and Complex Type are displayed, or Service with Vocabulary-Based Annotations, for which Type Kind(core type or complex type) and Type Name are displayed. For example, if your project is of type Service with Vocabulary-Based Annotations, the standard SAP attributes (creatable, updatable, sortable, for example) are not displayed since vocabulary-based annotations are to be used instead.

    Column

    Description

    Name

    Enter a new name for the new property or modify the existing name as required. If you have imported the complex type or entity type, a name is already displayed, for example, currency.

    Is Key

    Select this checkbox to indicate that this is a key field in the data model.

    Edm Core Type

    Enter the Entity Data Model type allowed in OData for this property. For example, Edm.String, Edm.DateTime.

    Type Kind

    Specify whether the property is a Complex Type or Core Type for projects of type Service with Vocabulary-Based Annoations.

    Data Type

    Enter the data type that corresponds to the complex type or core type property. If it is a core type property, use the input help to select the appropriate Edm. type.

    Precision

    EDM facet. Enter the number of decimal places permitted for numeric data types. The value defines the maximum number of decimal places permitted to the left and right of the decimal point.

    Scale

    EDM facet. Enter the maximum number of decimal digits permitted after the decimal point.

    Max Length

    EDM facet. Enter the maximum length you want to allow at runtime. For example, enter 30 to specify a maximum length of 30 characters for this property.

    Fixed Length

    EDM facet. Select the checkbox to specify if a fixed length applies.

    Unit Property Name

    Enter the unit property name. Use the input help to select an existing property from the same complex type or entity type. For example, if the property comprises a number that refers to a currency or amount, you can specify the relevant currency or unit of measure.

    Creatable

    SAP annotation for projects of type Service with SAP Annotations. Select this checkbox if you want to allow a value assignment to this property in Create (POST) requests at runtime. If you select this checkbox, you must include a Create operation in the data model.

    Updatable

    SAP annotation for projects of type Service with SAP Annotations. Select this checkbox if you want to allow a value assignment to this property in Change (PUT/MERGE) requests at runtime. If you select this checkbox, you must include an Update operation in the data model.

    Sortable

    SAP annotation for projects of type Service with SAP Annotations. Select this checkbox if you want to allow this property to be used in $orderby statements for sorting data at runtime.

    Nullable

    EDM facet. Select this checkbox if you want to allow a null value to be entered for this property at runtime.

    Filterable

    Select this checkbox if you want to allow this property to be used in $filter statements for filtering data at runtime.

    Label

    SAP annotation for projects of type Service with SAP Annotations . Enter a language-dependent label using the Label Text Reference Editor in the next column.

    Label Editor

    Use the Label Editor to specify the reference type (Data Element, Class, Program, Free Text). Depending on the reference type you select, the fields Object Name, Key, and Label that are relevant for the particular reference type are ready for input. Input help is available for these fields.

    Complex Type Name

    Enter the name of the complex type you have created in your project. You can use the input help to obtain an overview of complex types that exist in the current project.

    ABAP Field Name

    Internal name of the property. If you specified a structure binding for the parent entity or complex type, this denotes a component of this structure. Enter the ABAP field name. If you have imported the entity type, this field contains the ABAP field name in uppercase. You can use the ABAP Type Editor.

    ABAP Type Editor

    Use the ABAP Type Editor to specify how the ABAP type to EDM type mapping is to be determined (Structure Binding at Entity or Complex Type, Explicit Assignment, Determination by Runtime Object Generator) to be used for the ABAP field.

    Semantics

    Enter how the property is to be used. For example, classifies a number as a telephone number or a fax number.

    Value Collection

    Indicates whether or not the imported vocabulary includes a property for which a collection of values (multiple entries) exists. Applies to projects of type Service with Vocabulary-Based Annotations. This field is read-only in the properties for view for the data model.

    Note

    To delete an existing property, select the relevant row in the mass maintenance view and choose Delete Row.

    SAP annotations provide additional metadata for the data model, but they are not validated at runtime. As such, the metadata merely provides the user of the service with additional information. However, if you are developing a specific application, you could include validation checks in the relevant data provider classes. Since the validation checks require a specific use case, these must be tailored to suit the particular customer application. Since it is possible to set an EDM type as well as an internal ABAP type for properties, these types must be validated to ensure that there is no mismatch between the values. Mismatches of this kind where one type is more restrictive than the other, for example DateTime and Date, may lead to data loss. In case of non-compatibility between an EDM type and an ABAP type, an error message is displayed.

More Information

For information about defining navigation properties for entity types, see Navigation Properties.