Show TOC

Using the OData Channel Generation ToolLocate this document in the navigation structure

To import an existing data model, proceed as follows:

  1. Start the OData Channel Generation Tool in either of the following ways:

    • Launch the ABAP Workbench in transaction SE80 and enter /N/IWBEP/IMPORT_MODEL in the transaction field.

    • Navigate to the IMG activity in the SAP Gateway Implementation Guide (IMG) as follows.

      In transaction SPRO open the SAP Reference IMG and navigate to Start of the navigation path SAP NetWeaver Next navigation step SAP Gateway Business Suite Enablement  Next navigation step Backend OData Channel  Next navigation step Service Development for Backend OData Channel Next navigation step OData Channel Generation Tool End of the navigation path.

      The dialog box Select a model file for import is displayed.

  2. Navigate to the OData file you want to import and choose Open.

  3. The data is imported into the system and the Generate OData Channel Implementation mapping screen is displayed:

    OData Channel Generation Tool Mapping Screen

    In the Entity Binding screen area (top left), the entity types and complex types extracted from the OData file are listed in the Entity Name column of the table (complex types are indicated by a selected checkbox in the Complex Type column). The entity types correspond to data objects in an SAP Gateway data model.

    You can map these entity types to existing ABAP Dictionary (DDIC) structures using the search help available.

    The Entity Set Annotations screen area (top right) shows the annotation for each entity set (creatable, updatable, and so on) and you can select or deselect the boxes as required.

    The Property Type Mapping/Property Annotations (SAP Annotations) screen area shows each property and its annotation. Complex types are indicated by a selected checkbox in the Complex Type column and the complex type properties are displayed underneath.

    The EDM Name column shows the property name from the edmx file and the Field Name column shows the proposed property name in the model; you can change this if required. A dropdown list containing the fields of the structure that was mapped is available. Selecting a field automatically displays the requisite data element in the adjacent Data Elem. column. If the field name already exists, an error message is displayed.

    The DTyp column shows the proposed data type. You can change the proposed data type in the Data Elem. column, where search help is available.

    The Unit Property Name column defines the measurement unit of a property and contains the name of the unit attached to the property. For example, if the property is Price, the Unit Property Name could be Currency. Search help is available here.

  4. You can change the mapping and annotation if required. You can only edit data in columns that have a white background.

  5. When you are satisfied with the mapping and annotation, choose the Continue pushbutton at the top of the application screen or press F8 to continue.

    The generation screen Generate OData Channel Implementation is displayed:

    Generation Screen

  6. Enter a Package name, for example $TMP for local objects.

  7. Select the Overwrite Developer Classes checkbox if you want the content developer classes (custom coding) to be regenerated.


    Only select the Overwrite Developer Classes checkbox if you are sure you want content developer classes to be regenerated. Otherwise, you could risk losing your implementation as existing custom coding will be overwritten.

  8. Enter names for Model Provider Class and Data Provider Class fields. These are the classes that need to be registered for use on SAP Gateway. (They are not the only classes generated by the tool.) The maximum permitted name length is 30 characters, which includes a namespace or prefix of a maximum of four characters.

    If you enter a name that is already in use, an error message displays and you must choose another name. Validation is also carried out on the name length.

    The base model provider class and base data provider class names are displayed underneath for your information.

    The entity names, together with their associated class and interface names, are displayed in the Generated Class and Interface Names for Entities section at the bottom of the screen. You can change the names here, if required, subject to the validation described above.

  9. In the Namespace/Prefix field, enter a namespace or prefix for the ABAP classes and interfaces that will be generated (maximum of four characters). Choose a unique prefix to avoid naming conflicts, for example, ZHS_.

  10. To generate the implementation when you are satisfied with the mapping and annotation, choose the Generate Implementation pushbutton at the top of the application screen or press F8.

    A dialog box is displayed to inform you of the classes that will be overwritten by the newly generated implementation.

    Overwrite Information Dialog Box

  11. If you want to continue, choose the green checkmark. If you want to make modifications before triggering the generation process, choose Cancel pushbutton.


    If you checked the Overwrite Developer Classes box, pay special attention to the classes that will be overwritten; you could lose your implementation as existing custom coding will be overwritten.

    When you accept the classes to be overwritten, the generation process starts and, when completed, a dialog box shows details of the classes and methods that have been generated:

    Successful generation - display logs

  12. Choose the green checkmark and a message appears, informing you that the implementation has been successfully generated.

  13. Start transaction SE80 and navigate to the package in which the implementation artifacts have been generated (the package that you specified at the beginning of the process). The results should look similar to the example shown below:

    Generated classes and interfaces

    The following classes are generated:

    • <Prefix><ModelProvider>

    • <Prefix><ModelProvider>_BS (base class). This is the model provider superclass.

    • <Prefix><DataProvider>

    • <Prefix><DataProvider>_BS (base class). This is the data provider superclass.

    For each entity type, the following classes are generated:

    • <Prefix>IF<EntityType>

    • <Prefix>CL<EntityType>

    To view or edit a class, double-click it in the tree view on the left and its contents display on the right.

    You cannot modify the data provider classes.

  14. You must now add your custom logic to the model provider classes. Double-click a class and edit as required. When you first open the class, an error message informs you that you need to add logic to the empty methods.

  15. When you have finished adding your logic, save the model. You must then register and activate the service manually, as described in Runtime Registration and Service Activation.