Show TOC

Data Model CreationLocate this document in the navigation structure

Use

When you create your own data model from scratch for the Generic Channel, certain default key fields can be generated as optional. You must, however, generate the Structure Type Container (STC) class.

To create a data model from scratch on the Generic Channel, follow the procedure below. Note, however, that as of SAP Gateway Release 2.0 Support Package 5 you are recommended to use the standard programming paradigm for the OData Channel as opposed to the Generic Channel.

Note

There should be at least one GetList (Query) and one GetDetail (Read) operation in a data model; for more information, see the OData specification at http://www.odata.orgInformation published on non-SAP site.

Procedure
  1. Start transaction SE80.

  2. Select SAP GW Data Model from the dropdown list.

  3. Enter a name for the data model you want to create, adhering to the following naming convention (maximum of 24 characters):

    <customer name range> or <reserved customer namespace><name>

    For example, ZJWTEST.

    A dialog box informs you that this object does not exist and asks if you want to create it.

  4. Select Yes and the Create Data Model dialog box is displayed, with the data model name you entered above displaying in the Name field.

    Enter PS (Public Solution Model) in the Type field for the data model.

    The version of your new Data Model is automatically set to 0001 in the Version field and is read-only.

    The From Scratch radio button and accompanying OData Channel checkbox are selected by default.

  5. Deselect the OData Channel radio button. The Create Key box becomes available.

  6. Enter a name for the Root data object.

  7. Select the Create Key checkbox if you want the following three key properties for the root data object to be created automatically:

    Property Name

    Core Type

    Length

    SCHEME_AGENCY_ID

    Edm.String

    16

    SCHEME_ID

    Edm.String

    30

    VALUE

    Edm.String

    72

  8. Select the green checkmark to continue.

  9. Enter the name of the package in which you want the data model to be saved and choose Save, or Local Object.

    A message displays at the bottom of the screen confirming that the data model has been saved. A model skeleton is created and displays in the repository browser in a tree structure, showing the root data object and an Object Structure folder beneath it, displaying the data objects and properties. If you selected the Create Key checkbox, the three key properties created for the root data object display underneath the Object Structure folder.

    Note

    If created, the key properties also apply by default to all data objects underneath the root; that is, the child data objects inherit the properties from the parent (root) data object unless you deselect the Inherit Key Fields checkbox when creating a data object.

    The Model Runtime field on the right indicates that the data model will use the Generic Channel at runtime (read-only).

  10. You can now add data objects, operations, properties, complex types, and relations to the data model (see More Information below).

  11. You can also rename or delete properties, data objects, and operations (Rename and Delete are available from the right-click menu). However, you cannot delete the root data object.

    Note

    The Rename and Delete menu options are only available for data models created from scratch.

  12. Select the Check button above the repository browser window. This checks the consistency of the data model you have created and lists any errors at the bottom of the screen so that you can correct them.

    Double-click a line in the error list and the data model header opens. Select the i (information) button at the beginning of an error line to display Help information that gives an explanation of the problem and a procedure to follow to correct it.

  13. After correcting any errors, double-click the data model name in the tree view and select the Generate STC Class button above the repository browser to generate the underlying STC class, which is necessary to run the model properly. If you did not create the data model in the local namespace, a customizing request displays for the STC class.

    You must also use this button to regenerate the STC class after making changes to the data model to ensure you have an updated version with the changes included.

    Note

    You must be in display mode when you press Generate STC Class. If you are in edit mode, changes are not included when regenerating the STC class.

After you have created the data model, you can reassign it to another package (for example, if you work on the model on local and then wish to move it to production). Right-click the data model name in the SE80 tree view, select Reassign package, and enter the new package details in the reassignment dialog box.

You can also copy a data model by right-clicking the data model name and selecting Copy. For more information, see Copying a Data Model in Deriving a Data Model from an Existing Data Model.

More Information

For more information, see the following sections:

Note

The sections listed below apply to model creation on both the Generic Channel and the OData Channel. Sections specific to the Generic Channel are identified as such.

Properties Editor to define or edit the data model's entities.

Creating Data Objects

Creating Properties

Creating Operations (specific to the Generic Channel)

Creating Relations (specific to the Generic Channel)

Creating Complex Types

Annotation Editor for information about adding or modifying user-specific annotations.

Documenting a Data Model

After you have created the data model, see:

Deriving a Data Model from an Existing Data Model to create a UC data model, required if you want to add annotations.

Creating a Consumption Model

Consumption Model URL to check the service.