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.

                                                            OR

               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)

          /wp-content/uploads/2013/11/compose_service2_284383.jpg

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

/wp-content/uploads/2013/11/include1_284399.jpg

  • 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.

/wp-content/uploads/2013/11/compose_service3_284574.jpg

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

    /wp-content/uploads/2013/11/include_serv1_284424.jpg

  • 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!

     /wp-content/uploads/2013/11/ext_assoc1_284425.jpg

          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 Kumar and Harish

  • 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.

         EXT_ASS2.png

  • 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.

       EXT_ASS2.jpg

  • 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

      /wp-content/uploads/2013/11/serv_doc_284451.jpg

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

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…

Thanks,

Rashmi

To report this post you need to login first.

19 Comments

You must be Logged on to comment or reply to a post.

  1. Sreenivas Pachva

    Hi Rashmi,

    Excellent useful information..Thanks for the sharing new things in Gateway..like image upload and composition and I hope that you keep continue your views with SCN contributers…

    🙂 And also I am big fan of your blogs …Your blogs can make the complex things into so simple…

    (0) 
  2. Arthi N

    Hi Rashmi

    Thank you for the useful blog.

    I have a question. I tried linking up services from ECC and BI into one service. Where do I register this service in a hub architecture? using SPI?

    (0) 
  3. Shefali Chopkar

    Hi Rashmi,

    This is very helpful blog.

    I am new to gateway, could you please update the further part on how to run this service to get result for both of services.

    (0) 
  4. Shefali Chopkar

    Hi Rashmi,

    I am using same concept, I am creating association between one entity in current service and one entity from included service. When I use $expand, i get error as Entity from included set is not found. Can you suggest solution?

    (0) 

Leave a Reply