Show TOC

Redefining OData Service (SAP GW)Locate this document in the navigation structure

Overview
The Service Builder allows you to redefine the OData services for SAP Gateway. A service can be redefined only for the projects of type Service with SAP Annotations and Service with Vocabulary-Based Annotations.
The Redefine SAP Gateway Service function allows the user to do the following:
  • Redefine a service - to redefine a service for the first time in the Service Builder.
  • Extend current model - to add more artifacts to your model from an existing model. If your model already has artifacts from a reference model, you can add more artifacts from this model only.
  • Overwrite current model - to overwrite the existing model in the Service Builder with a new model from a different service.
After choosing one of the redefine options (OData Service SAP GW, BW Query Service, SPI Service, OData Service), system allows you to select a service to redefine (you can select only those services that are registered in the current SAP Business Suite backend system ). Once you select a service, the model displays in tree view, allowing you to select the required artifacts (entity types, associations, function imports) for new model.

The Modification Generator enables you to make certain restricted changes in the service using an external framework like SAP Business Information Warehouse (BW), Service Provider Interface (SPI), and Generic Interaction Layer (GenIL). For example, these services might not have a proper label or might not need all the artifacts, in such cases, the Modification Generator allows you to make changes without influencing underlying Data Provider Class(DPC), and reuses existing model.

Two new DPC classes generate during the generation process. New DPC inherits DPC of the base service. As a result, the DPC methods of the base service is still available. New DPC extension class inherits the new DPC Base Class, enabling you to extend methods of your service.

Note In the new DPC extension class, you can change the behavior of the existing (original) service but you cannot change its interface.
Redefining a service for the first time - Empty project:
To redefine an emplty project, proceed as follows: .
  1. Log on to SAP Gateway Service Builder.
  2. Create an empty project.
  3. Right click Data Model folder and select Start of the navigation path Redefine  Next navigation step OData Service (SAP GW) End of the navigation path. Wizard Step 1 of 2: Redefine Service appears.
  4. In Select Service region:
    1. In Technical Service Name field enter technical name of the service you want to redefine . Alternatively, you can use input help available for this field
    2. In Version field specify the version of the service. On selecting the service from input help version automatically populates
  5. In Remote System for Integration Scenarios section:
    1. Select Fetch metadata for Integration Scenario checkbox if you want to redefine a service created using Integration Scenario feature (SAP Business Information Warehouse (BW), Service Provider Interface (SPI), and Generic Interaction Layer (GenIL) and Easy Query.
    2. RFC Destination field becomes editable on selecting Fetch metadata for Integration Scenario. Use input help to select RFC destination of the service..
      Note If the RFC destination is incorrect, an error message is displayed.
  6. Click Next to continue.On successful validation of the RFC destination, Wizard Step 2 of 2: Redefine Service opens.
  7. Select the required artifacts. Refer to the artifacts selection logic described in Overwriting a model section.
As the Wizard Step 2 of 2: Redefine Service is same for all the redefinition scenarios, follow steps 14 to 19 in Overwriting a model section to complete the procedure.
Redefining a service for the first time - Project with a model
If you redefine a project with a model created by any other way apart from redefine for example, importing a data model, importing a data source or manually created model, system overwrites the existing model.
  1. Log on to Service Builder.
  2. Open an existing project to redefine.
  3. Click Display<-> Change (Display<-> Change) to switch to editing mode.
  4. Right-click Data Model and select Start of the navigation path Redefine  Next navigation step OData Service (SAP GW) End of the navigation path. A message box is displays asking your confirmation to overwrite the model.
  5. Click Yes. Wizard Step 1 of 2: Redefine Serviceappears.
  6. In Select Service region:
    1. In Technical Service Name field enter technical name of the service you want to redefine . Alternatively, you can use input help available for this field
    2. In Version field specify the version of the service. On selecting the service from input help version automatically populates
  7. In Target System for Metadata section:
    1. Select Metadata to be fetched from an external system checkbox if metadata of the selected service resides in another system.
    2. RFC Destination field becomes editable on selecting Metadata to be fetched from an external system. Use input help to select RFC destination of external system.
      Note If the RFC destination is incorrect, an error message is displayed.
  8. Click Next to continue.
  9. On successful validation of the RFC destination, the Wizard Step 2 of 2: Redefine Service opens.
  10. Select the required artifacts. Refer to the artifacts selection logic described in the Overwriting a model section.
Follow steps 14 to 19 in the Overwriting a model section below to complete the procedure.
Extending the existing model
There might be instances when you want to add artifacts without overwriting the model. In such cases, you can use Extend Current Model option and select the artifacts from the base model. In such cases, Technical Service Name field in Select Service region is read-only and displays the service from which you can add more artifacts.
  1. Log on to Service Builder.
  2. Open the project to be redefined.
  3. ClickDisplay<-> Change (Display<-> Change)
  4. Right-click on Data Model folder and select Start of the navigation path Redefine  Next navigation step OData Service (SAP GW) End of the navigation path. Wizard Step 1 of 2: Redefine Service opens.
  5. Select Extend current model. The Technical Service Name field is read-only and displays the base model's technical service name and version
  6. Choose Next to continue. Wizard Step 2 of 2: Redefine Service opens.
  7. Select required artifacts. Previously selected artifacts have read-only state. Refer to the artifacts selection logic described in Overwriting a model section.
  8. Choose Finish.. The added artifacts are displayed in the tree view under the appropriate folder.
Follow steps 14 to 19 in the Overwriting a model section to proceed.
Overwriting a model
If you want to overwrite an existing model you can use overwrite the current model option. On choosing overwrite, the existing model and the generated classes are overwritten.
  1. Log on to Service Builder.
  2. Open an existing project to be redefined.
  3. ClickDisplay<-> Change (Display<-> Change)
  4. Right-click on the Data Model folder and select Start of the navigation path Redefine  Next navigation step OData Service (SAP GW) End of the navigation path. Wizard Step 1 of 2: Redefine Service wizard opens.
  5. Select Overwrite model. This action overwrites the existing model.
  6. In Select Service region:
    1. In Technical Service Name field enter technical name of the service you want to redefine . Alternatively, you can use input help available for this field.
    2. In Version field specify the version of the service. On selecting the service from input help version automatically populates.
  7. In Remote System for Integration Scenarios section:
    1. Select Fetch metadata for Integration Scenario checkbox if you want to redefine a service created using Integration Scenario feature (SAP Business Information Warehouse (BW), Service Provider Interface (SPI), and Generic Interaction Layer (GenIL) and Easy Query.
    2. RFC Destination field becomes editable on selecting Fetch metadata for Integration Scenario. Use input help to select RFC destination of the service..
      Note If the RFC destination is incorrect, an error message is displayed.
  8. Click Next to continue.
  9. On successful validation of the RFC destination, Wizard Step 2 of 2: Redefine Service opens.
  10. Select the required artifacts.

    There is a selection logic in the backend, which automatically includes all the entity types that are end types/return type of chosen association/function import. The reverse is not selected. For example, consider the following model:

    Example
    1. COMPLEX TYPES
      • complex_type_1
      • complex_type_2
    2. ENTITY TYPES
      • entity_type_1
      • entity_type_2
      • entity_type_3
    3. ASSOCIATIONS
      • association_1 (between Entity_type_1 & Entity_type_2)
      • association_2 (between Entity_type_1 & Entity_type_3)
    4. FUNCTION IMPORTS
      • function_import_1
      Case1: User selects Entity_Type_1, Entity_Type_2 and Association_1. All these entities are selected and used in the new model. If Entity_Type_1 & Entity_Type_2 uses Complex_Type_1 & Complex_Type_2, they are automatically selected.

      Case2: User selects Entity_Type_1, Association_2. Since Entity_Type_3 is part of the Association_2, Entity_Type_3 is selected automatically along with Entity_Type_1 and Association_2.

  11. Choose Finish.
  12. Service Builder performs consistency check of the imported model and a message is displayed. Selected artifacts are then transferred to the respective folders in tree view. Also,
  13. A node with the name and version of the base service is created underModel References folder. Double-click this node. In the mass maintenance view Model Reference Type column displays Extend to indicate that this model can be extended.
    Note If the model has been referenced as an Include, the model reference type displayed is Include instead of Extend.
  14. You can perform the following functions in the redefined model:
    • Delete the artifacts.
    • Change Node Names and Labels
      1. Choose Edit. Node Name and Label fields can be edited.
      2. Choose to revert the redefined value to the original value.
      3. Choose Undo Identical Redefinition to view the fields which have been reverted to their original values in the course of editing.

        While redefining, if you change the name and label of an artifact more than once and in the course of editing you revert back to its original name, as in base project, clicking Undo Identical Redefinition makes all such fields non-editable, indicating these fields are not redefined and are same as in base project. Clicking Undo Identical Redefinition enables Redefine Attributes so that you can redefine name and label column of those artifacts, if needed, later.

      Note

      During redefinition name and lable chnage are allowed, but deleting a label is not supported. In case you delete a label, following are the impact.

      • Metadata does not reflect deletion and continues showing the label.
      • There can be issues in assignment of text keys to labels in the generated MPC, which may lead to incorrect label settings for other artifacts.
  15. After you have completed the redefinition process, generate runtime objects.
    Note

    Generation of MPC and DPC:

    • Case 1:Overwrite Base/Extended Service - If you have redefined an existing service, an additional section Service Extension appears in this wizard. Select Overwrite Base/Extended Service to overwrite the contents of the referenced service class. This option allows you to access the redefined (new) service using the base service URL. You can no longer access the base service using same URL.
    • Case2: Create a new service - A new service and model are created and registered during the generation process. A new set of DPC classes are also generated.
    After the service has been generated, the MPC classes are stored in Runtime Artifacts folder.
Constraint

When you redefine a base service (B1) in project P1 and while generating runtime artifacts you choose to overwrite base service by selecting the check box, the base service (B1) points to the artifacts of the redefined service (R1) (This can be confirmed by checking $metadata of the base service B1). Now, if you redefine the same base service B1 in another project (P2), R1’s artifact is expected to be listed in the wizard, but on contrary, original artifacts of the base service B1 displays, though the $metadata of B1 still shows artifacts of R1.

Importing more Properties
You can import more properties to the redefined service by following below procedure:
Pre-requisite

Base service must have an ABAP structure assigned to import more properties to the redefined service

Procedure
  1. In the tree view, right click the entity and click Import.
  2. Click Properties. Wizard Step 1 of 2: Import Properties displays
  3. In this wizard previously imported properties remains disabled and others enabled and selectable. Select the property you want to import
  4. Click Next
  5. Click Finish in Wizard Step 2 of 2: Import Properties .
Thus, selected property is imported and can be viewed under the entity in tree view.
Note
  • Importing properties, in the redefined projects, is possible only in SAP Gateway SP09 and higher versions.