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
- Go to the transaction SEGW and create a new project by clicking on
- 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.
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.
4. I now have the service as follows. Let’s call this the “parent” service.
5. Generate the Runtime artifacts by clicking on . In the following dialog Click Continue.
The runtime artifacts for this “parent” service will be generated.
Create a new service by redefining the original service
- 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.
Let’s call this the “child” service.
2. Right Click on the Data Model and select Redefine -> OData Service (GW).
3. In the following wizard, enter the values for the “parent” service and click “Next”.
4. Select the entity of the “parent” service in the next wizard as follows and click on “Finish”.
5. Add another entity to this service by right-clicking on Data Model and selecting Create -> Entity Type.
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.
6. The “child” project now looks like as follows:
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 . The following dialog opens up.
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.
Click Ok and enter the system alias in the next dialog. Enter the package in the subsequent dialog and click Ok.
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
- Navigate to the “parent” service -> Service Maintenance, select the Hub system and click on Gateway Client to check the service details.
2. In the Gateway Client window, enter the details as mentioned in the picture below and execute to see the service details.
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 🙂
Hi Satyabrata,
Excellent Stuff
I will try to do implement
Thanks,
Syam
Hello Satyabrata,
Great and thanks for sharing the information
Regards,
Ashwin
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
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
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
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
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
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
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!
Nice Blog ..
Very nice blog ...but how to enhance the UI5 component for the app ?
Any idea, how can the extension be reverted?