Skip to Content
Author's profile photo Former Member

Extending a service using the Gateway Service Builder

In this blog, I will introduce the service extensibility concept that was developed as part of the SP09 development for the SAP NetWeaver Gateway Service Builder.


Motivation: The motivation behind the service extensibility concept was to have a single service URL for both the original service and the new service (which is generated by redefining the original service). This will enable users to redefine a particular service as per the requirements but still access the new redefined service using the URL of the original service.

Prerequisites:

IW_BEP 200 SP09


Step-by-Step Procedure

Following are the step by step procedures to extend a particular service. I will redefine an original service into a new redefined one and then showcase the service extensibility functionality.

Creation of a “Service with SAP Annotations” or “Service with Vocabulary-Based Annotations” service


Create a new service by redefining the original service


Extend the service while generating the runtime artifacts


Check the service URLs


Creation of a “Service with SAP Annotations” or “Service with Vocabulary-Based Annotations” service

  1. Go to the transaction SEGW and create a new project by clicking on /wp-content/uploads/2014/08/1_516115.png
  2. Enter the details for the Project, Description, and Generation Strategy. Select project type as “Service with SAP Annotations” or “Service with Vocabulary-Based Annotations” from the drop-down. I have mentioned the project name as “z_srvext_parent” for better comprehension.

     /wp-content/uploads/2014/08/2_516131.png

     3. Create few entities for this project by right clicking on “Data Model” and selecting “Create Entity”. Or you could also right-click on the “Data Model” and                select the “Import” mechanism to import a data source. I will import a RFC in this example.

        /wp-content/uploads/2014/08/3_516132.png

     4. I now have the service as follows. Let’s call this the “parent” service.

     /wp-content/uploads/2014/08/4_516137.png

     5. Generate the Runtime artifacts by clicking on /wp-content/uploads/2014/08/5_516138.png. In the following dialog Click Continue.

     /wp-content/uploads/2014/08/6_516139.png

     The runtime artifacts for this “parent” service will be generated.

Create a new service by redefining the original service

  1. Let’s now create a new “Service with SAP Annotations project” and redefine it from the “parent” service. Navigate to the SEGW transaction and create a new service as follows.

     /wp-content/uploads/2014/08/7_516143.png

     Let’s call this the “child” service.

2. Right Click on the Data Model and select Redefine -> OData Service (GW).

/wp-content/uploads/2014/08/8_516149.png

3. In the following wizard, enter the values for the “parent” service and click “Next”.

/wp-content/uploads/2014/08/9_516150.png

4. Select the entity of the “parent” service in the next wizard as follows and click on “Finish”.

/wp-content/uploads/2014/08/10_516151.png

5. Add another entity to this service by right-clicking on Data Model and selecting Create -> Entity Type.

/wp-content/uploads/2014/08/11_516152.png

Add a property for this entity. (I have tried to keep the entities and properties to be as simple as possibleJ). The “child” project now has two entities as shown below.

/wp-content/uploads/2014/08/12_516153.png

6. The “child” project now looks like as follows:

/wp-content/uploads/2014/08/13_516154.png

The “parent” service appears under the Model References folder.

Extend the service while generating the runtime artifacts

1. Generate the runtime artifacts for this “child” service by clicking on /wp-content/uploads/2014/08/5_516138.png. The following dialog opens up.

/wp-content/uploads/2014/08/14_516156.png

The Overwrite Base/Extended Service under “Service Extension” is by-default unchecked. Once checked, we get the warning “Base service will be inaccessible” and the Technical Service Name and the Service Version fields get filled with the values of the “parent” service that was entered in step 3.

(If the checkbox Overwrite Base/Extended Service is checked, the service extensibility concept comes into play. The service URL of the “parent” service (Z_SERVICEEXT_PARENT) will now be re-directed (i.e. fetch the service details) to the “child” service (Z_SERVICEEXT_CHILD).

2. We will now register this service in the SAP NetWeaver Gateway Hub system. Click on Service Maintenance and select the Hub system and click on Register.

/wp-content/uploads/2014/08/15_516167.png

   Click Ok and enter the system alias in the next dialog. Enter the package in the subsequent dialog and click Ok.

   /wp-content/uploads/2014/08/16_516161.png

3. Register the “parent” service as well by following the same steps as above. Now since we have both the “parent” as well as the “child” services registered, we       can check the service URLs.

Check the service URLs

  1. Navigate to the “parent” service -> Service Maintenance, select the Hub system and click on Gateway Client to check the service details.

   /wp-content/uploads/2014/08/17_516162.png

   2. In the Gateway Client window, enter the details as mentioned in the picture below and execute to see the service details.

   /wp-content/uploads/2014/08/18_516163.png

Now, in the metadata of the “parent” service, we can see the two entities associated with the “child” service. This happens because the service URL of the “parent” service gets redirected to the “child” service as the “child” service has extended the “parent” service.

Both the “parent” and the “child” service can be accessed using the URL of the “parent” service.

Hope this post helped you get a perspective on the service extensibility concept in service builder 🙂

Assigned Tags

      12 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Syambabu Allu
      Syambabu Allu

      Hi Satyabrata,

       

      Excellent Stuff

       

      I will try to do implement

       

      Thanks,

      Syam

      Author's profile photo Ashwin Dutt R
      Ashwin Dutt R

      Hello Satyabrata,

       

      Great and thanks for sharing the information

       

      Regards,

      Ashwin

      Author's profile photo Ashish Kumar
      Ashish Kumar

      Hi Satya,

       

      Nice blog. It's good to know that now OData consumers can access extended service with base service URL itself and they do not have to change the URL in their existing application.

       

      Regards, Ashish

      Author's profile photo Former Member
      Former Member

      Hi Satyabrata,

       

      Thanks for the blog, I have tried the same as you advised on IW_BEP SP08 and I don't see any accessibility of extended model from the base URI(parent) ,even I tried same on SP09 and it is still the same.

       

      If I access the base URI I could able to get the base model(parent) only not the extended model after redefining base service in child.

       

      As we have IW-BEP SP09 on ISU and Gateway is HUB installation as a standalone.

       

      Advise me if I am missing any.Thanks

      Rajesh

      Author's profile photo Brad Pokroy
      Brad Pokroy

      Hi Satyabrata,

       

      Great blog, very helpful, thank you!

       

      Just out of interest, is there any way to do this once you have already generated the runtime artifacts? I found that I had to delete the project and re-create it in order to "Overwrite Base/Extended Service".

       

      Cheers,

      Brad

      Author's profile photo Tjarliman Rusadi
      Tjarliman Rusadi

      Hi Satyabrata,

       

      This is a very good information, however you did not mention about the GET_ENTITYSET or GET_ENTITY method.

       

      I tried using this method to extend the standard service MM_PUR_PO_MAINTAIN.

      I created a new service called ZMM_PO_MAINTAIN_EXT, and add one entity to it.

      After generating the service, I am able to see that my new entity can be called from the standard service. This is exactly like you mentioned above.

       

      However, when I tried to called the new entiry in the browser, there was an error saying that the GET_ENTITYSET was not maintained yet.

       

      How can I create these method (GET_ENTITYSET and GET_ENTITY ) for my new entity correctly ?

       

      Thanks and Regards,

      Tj

      Author's profile photo Dominik Tospann
      Dominik Tospann

      Hello Tjarliman Rusadi,

       

      I know it has been five years since your post, but were you able to figure out the solution to your post?

       

      Best regards

      Dom

      Author's profile photo Dong Nguyen
      Dong Nguyen

      Hello all,

       

      I checked the checkbox “The Overwrite Base/Extended Service” under “Service Extension”  when I create an extend Z project to to standard Odata service project. Now when I run metadata for standard Odata service. XML will has a property “sap:extending-service-id=’Z….’ “.

      I would like to undo this checkbox. I try to delete Z project but it's property still there. Could you please guide me how to do this?

      Thank you for your support.

      Dong Nguyen

      Author's profile photo Jan De Rijck
      Jan De Rijck

      Could you please take a look at https://answers.sap.com/questions/580813/sap-odata-versioning.html ?

      I think it is related to this issue, but somehow there is a difference 🙂

      Thanks!

       

      Author's profile photo Amit Kumar
      Amit Kumar

      Nice Blog ..

      Author's profile photo Amit Kumar
      Amit Kumar

      Very nice blog ...but how to enhance the UI5 component for the app ?

      Author's profile photo iMRO DEV TEAM
      iMRO DEV TEAM

      Any idea, how can the extension be reverted?