Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
Showing results for 
Search instead for 
Did you mean: 

As I could not find any writing on Composition feature of Gateway(available since SP05) where two/multiple services can be composed into one, here it goes...

Consider a scenario where you have two independent OData services(say, Sales Order and Business Partner). The two can be connected (associated) to see Business Partner details of a Sales Order. This can be achieved using the functionality Include->OData Service(GW) available in SEGW Data Model of SAP NetWeaver Gateway (SP05 and above).

          Here you would have option either to

               1) Compose current service(in a project) with one or multiple services in a) Current System  OR   b) External System.


               2) Compose 2 independently existing services(in Current/External systems) into a new service(project)

Lets consider the case 1) variance b) where we compose current service(in a project) with one service in External system.

Through this writeup I will also mention the difference in behaviour with the Current System case.

Assumption is that Sales Orders and Business Orders OData services are generated and registered out of service builder(SEGW) in two different systems.

  • Open the corresponding Sales Orders project and go to edit mode using the pencil toolbar button.

  • On the Data Model right click and invoke Include->OData Service(GW)


  • Select the Service in External System option. This makes the RFC Destination text field editable.

  • Using the F4 provided, chose the required RFC destination of the system where Business Orders service resides.

        Use the F4 help to select the Technical Service Name and Version and chose to continue using the tick.

  • Once an external service is included, a Model Reference entry gets added into the Data Model with Model Reference Type: Include


  • Next step is to associate the two models. Go to Associations Folder in the Data Model, add an entry. Give it a name.

  • Now create an External Association called so as this is between two entities of 2 different services.

        Click on the Ext Assoc button to invoke the Creation of External Association.

  • Choose the option External from the drop down of Association Type.

           Once External is chosen, since the project now has only one included model, the dependent Model Reference gets proposed since there is only one service is included in the project, else this has to be filled using F4 help.

           The proposal given can be over ridden anyways!


          In case where 2 or more services(from Current/External systems) are included, and your design requires you to associate entities of the included services, the Dependent and Principal model references can be chosen via F4 helps provided.

               The RFC destination for Metadata field becomes available when we have included Service in Current System. This is a special case where the     Metadata exists in an external system and the service is generated in the current system. A typical example for this would be an integration case where SPI's ABBID exists in another system and the OData service is generated in the current system. For more information on SPI integration please refer the blog SPI Integration with GW by ashish.kumar2 and saiharish.balantrapu

  • Next step is to continue using the tick available. As a result, it shows the Ext Assoc button enabled with a tick indicating External Association is created.


  • Now, use the F4 of Prinicipal Entity to chose the Sales Order entity.

The F4 provided on the Dependent Entity doesn't fetch entities of the service as the Model included is via Service in External System. This is because of a technical limitation. This means to say, one has to know the entity name of the service and enter it manually.

Where as in case of Model included via Service in Current System this F4 would list the entities, and you can select the required entity.

  • Enter the Dependent Entity name manually.


  • Go ahead and fill in the cardinalities as well like shown in the screenshot above.

        Now a composed project is ready for generation of an OData service.

  • Use Generate Runtime Objects button in the toolbar to generate artifacts like the service, model and classes.

  • Register using the Service Maintenance feature.

  • Click on Maintain toolbar button which leads to GW client OR T Code: /IWFND/GW_CLIENT to check the service doc.

        It looks like in the screenshot below


          This brings to a closure of phase 1, where the service document has collections/entitysets of both services composed into ONE :smile:

Thanks for going through the blog and any feedback would be most welcome !

Would be linking this to another blog on the Run Time soon... so, please stay tuned...