Skip to Content
Author's profile photo Tejas Chouhan

Getting Data from 2 ERP systems using Multi Origin

Take a scenario where you need to create a service where we need to fetch data from multiple backend system.


We will just see the high level design for fulfilling this requirement :


Prerequisite :


  1. Gateway System is connected to all the back end system from which the data is to be fetched.
  2. System alias for all the back end system is maintained
  3. Parallelization node is maintained for better performance : Open the SAP Reference IMG in transaction SPRO and navigate to  SAP NetWeaver  Gateway  OData Channel  Administration  General Settings  Define Parallelization for Multiple Origin Composition  .


Say :

     GWS : Gateway System

     SAP_ERP1 : Backend system alias 1

     SAP_ERP 2 : Backend system alias 2

  • To define a service with multiorigin, we use ;mo with the service name . For eg : sap/opu/odata/sap/ZSERVICE;mo/$metadata
  • With the addition of ;mo, a new key property “SAP__Origin” is added in the response
  • SAP_Origin will specify the system alias to be used to get the data from different ERP systems.

/wp-content/uploads/2014/07/11_496187.png

Creation of Service :

  1. First we need to create a Gateway service using RFC or Structure.
  2. For using RFC we make sure that same RFC is present in all the ERP systems, with Import and Export parameters and the same Structure should be available in all the ERP systems, with the ABAP fields being the same.
  3. Create a GW project on all the backend system with same name : say ZSERVICE
  4. Once the service is created, add one of the service using one of the system alias say SAP_ERP1
  5. You dont need to add all the service as the names are same. Only one should do.
  6. Now you need to add all the system alias in /IWFND/MAINT_SERVICE for the ZSERVICE
  7. SAP_ERP1, SAP_ERP2, SAP_ERP3….etc

Execution from Gateway Client alternatively : Gateway client (/iwfnd/gw_client) :

You can execute GET, PUT, POST operations to read, update , create data.

Get_Entity can be used as :

  • /sap/opu/odata/sap/ZTEST_SRV;mo/GetBankDetailsSet(SAP_Origin=’ECC1’,Bankcountry=’’,Bankkey=’0001’)

Get_EntitySet can be used as :

  • /sap/opu/odata/sap/ZTEST_SRV;mo/GetBankDetailsSet?$filter=SAP_Origin eq ‘SAP_ERP1’ and Bankkey eq ‘0001’ and Bankcountry eq ‘Country’
  • /sap/opu/odata/sap/ZTEST_SRV;mo/GetBankDetailsSet?$filter=SAP_Origin eq ‘SAP_ERP2’ and Bankkey eq ‘0004’ and Bankcountry eq ‘Country’

POST :

/sap/opu/odata/sap/ZTEST_SRV;mo/CreateBankNo


XML :


<?xml version=“1.0” encoding=“utf-8”?>
<entry xml:base=
http://mytestdomain.com/sap/opu/odata/sap/ZSERVICE_SRV/xmlns=http://www.w3.org/2005/Atomxmlns:m=http://schemas.microsoft.com/ado/2007/08/dataservices/metadataxmlns:d=http://schemas.microsoft.com/ado/2007/08/dataservices>
<category term=
“ZSERVICE_SRV/CreateBankNo” scheme=http://schemas.microsoft.com/ado/2007/08/dataservices/scheme/>
<content type=
“application/xml”>
<m:properties>
<d:SAP__Origin>SAP_ERP1</d:SAP__Origin>
<d:BankData>Test</d:BankData>
<d:BankArea>TestArea</d:BankArea>
<d:BankCode>00001</d:BankCode>
</m:properties>
</content>
</entry>

Let me know if this article is useful for custom Fiori like application and to get the details from different systems. 🙂 :

Thanks. Appreciate your responses 🙂

Cheers!!

Tejas

Assigned Tags

      20 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo spandana N
      spandana N

      Hi  Teja ,

        Nice Document .. keep it up .

      I have the same scenario .Followed the   above concept but getting error .  Please do needful .

      URL : /sap/opu/odata/sap/ZXXX_TEST_SRV;mo/Add_MatnrSet?$filter=SAP__Origin eq 'LOCAL' and IWerks eq 'XX01'

      Error :

      <message xml:lang="en">Internal error occurred, contact your system administrator.</message




      Thanks in advance

      Spandana

      Author's profile photo Tejas Chouhan
      Tejas Chouhan
      Blog Post Author

      Hi Spandana,

      Please confirm below points :

      1. Your architecture of the landscape is Embedded or Central Hub (GW and Backend in same system or separate)

      2. If Gw and backend is in different system and LOCAL is the system alias of your gateway system ? I guess you are trying here to get the data from your gw system. Where the data won't exist.

      Scenario above explains getting data from 2 backend systems, using a gateway system.

      Regards,

      Tejas

      Author's profile photo spandana N
      spandana N

      Hi Teja,

      SAP  GW and SAP Backend are two different systems  and  i have  2  system alias like KLD_400  local (another RFC connection ) .

      Author's profile photo Tejas Chouhan
      Tejas Chouhan
      Blog Post Author

      Spandana,

      If Local is system alias for your gw system, you cant get any data. You have to give KLD_400.

      Regards,

      Tejas

      Author's profile photo Former Member
      Former Member

      Hi Teja,

      Really nice blog, it just solves my problem 🙂

      Author's profile photo Tejas Chouhan
      Tejas Chouhan
      Blog Post Author

      Great Ying ZHOU 🙂

      Regards,

      Tejas

      Author's profile photo Former Member
      Former Member

      Hi Tejas, I would like to know if I can use this on a SAP standard Fiori app, i.e. we don't want to do any Z-development. We also don't need to access multiple back-ends at the same time, only one at a time. But we want it to access the correct back-end depending on which tile was pressed. (Using authorizations works great if each employee must have access to one back-end only, but in our case we want one employee to be able to access each back-end according to his choice at the time)

      Author's profile photo Tejas Chouhan
      Tejas Chouhan
      Blog Post Author

      HI Duncan Aird

      Ideally it should work, Just say : you have 1 Gateway system and 3 backend system and 3 different apps.

      When user id : user01 logs in to launchpad and finds 3 applications.

      when he goes to 1st application, it should get data from 1st backend and respectively.

      You just have to enable Trusted RFC connection between gateway system and 3 ECC system.

      1st app -> System alias : SAP_ECC1

      2nd app -> System alias : SAP ECC2

      3rd app -> System alias : SAP ECC3

      In transaction : /iwfnd/maint_Service, you have to configure 1st app service's system alias as SAP_ECC1, then it will show you the data from 1st backend.

      Role will be same for all the 3 apps. Only system alias will change.

      This will work. 🙂

      Regards,

      Tejas

      Author's profile photo Devanand L
      Devanand L

      Hi Duncan,

      I have the same requirement. Were you able to achieve this for standard apps?. Depending on the tile press, the user should navigate to the corresponding client.

      thanks,

      Dev

      Author's profile photo Michael Appleby
      Michael Appleby

      Unless you are asking for clarification/correction of some part of the Document, please create a new Discussion marked as a Question.  The Comments section of a Blog (or Document) is not the right vehicle for asking questions as the results are not easily searchable.  Once your issue is solved, a Discussion with the solution (and marked with Correct Answer) makes the results visible to others experiencing a similar problem.  If a blog or document is related, put in a link.  Read the Getting Started documents (link at the top right) including the Rules of Engagement. 

      NOTE: Getting the link is easy enough for both the author and Blog.  Simply MouseOver the item, Right Click, and select Copy Shortcut.  Paste it into your Discussion.  You can also click on the url after pasting.  Click on the A to expand the options and select T (on the right) to Auto-Title the url.

      Thanks, Mike (Moderator)

      SAP Technology RIG

      Author's profile photo Former Member
      Former Member

      Hi Tejas,

      Its very useful information. Thank you for sharing with us. I am also working on MOC support. Get_entity and Get_entityset are working fine with MOC. But Create_entity method is not working with MOC. It is giving an error message like "Inline component is not defined or not allowed (HTTP PUT)". But when I remove ";mo" string from service URL, I am able to create the entity. Could you please help me in this??

      Thank You

      Seshu

      Author's profile photo Tejas Chouhan
      Tejas Chouhan
      Blog Post Author

      Are you creating "create service" in both systems ?

      Regards,

      tejas

      Author's profile photo Former Member
      Former Member

      Yes, We are implementing create service in both systems.

      Regards,
      Seshu

      Author's profile photo Former Member
      Former Member

      Dear Tejas Chouhan ,

        i am new to ODATA.I created ODATA in development server of SAP Net weaver Gateway Hub system and accessing  RFC Remotley from other sap back end system. now i have to deploy my ODATA service to Quality server of SAP Net weaver Gateway Hub system.how can i register my service in Quality server.As i registered in developenment with my developement server details of Net weaver Gateway Hub system.

      so kindly look in to the same and revet me the same.

      thanks in advance.

      Author's profile photo Former Member
      Former Member

      Lets say i have to create a deep entityset and i have enhanced the dpc_ext with an rfc then how do i need to proceed.

      Author's profile photo Michael Appleby
      Michael Appleby

      Unless you are asking for clarification/correction of some part of the Document, please create a new Discussion marked as a Question.  The Comments section of a Blog (or Document) is not the right vehicle for asking questions as the results are not easily searchable.  Once your issue is solved, a Discussion with the solution (and marked with Correct Answer) makes the results visible to others experiencing a similar problem.  If a blog or document is related, put in a link.  Read the Getting Started documents (link at the top right) including the Rules of Engagement. 

      NOTE: Getting the link is easy enough for both the author and Blog.  Simply MouseOver the item, Right Click, and select Copy Shortcut.  Paste it into your Discussion.  You can also click on the url after pasting.  Click on the A to expand the options and select T (on the right) to Auto-Title the url.

      Thanks, Mike (Moderator)

      SAP Technology RIG

      Author's profile photo MatĂ­as Denker
      MatĂ­as Denker

      Is it correct to say that another implied prerequisite of this solution is that all systems should have gateway activated?, that is, there should be a gateway hub, but also every backend should have installed and active it's own gateway. This solution does not appear to work when hub development is used, and only a gateway is active in the hub and it is connected to backends only thru RFCs, right? Thanks.

       

      Author's profile photo Tejas Chouhan
      Tejas Chouhan
      Blog Post Author

      Hi Matias,

      This can be the case when there are multiple backends connecting to 1 GW system, and the services which are developed in the backends are registered in the Gateway, and GW is connected to backend via rfc.

      Regards,
      Tejas

      Author's profile photo Former Member
      Former Member

      Hi Tejas,

       

      How can we add the SAP_ORIGIN parameter for standard apps?

      I have Approve PR and Approve PO apps on the gateway with 2 system aliases.

      When the user tries to open the app from the Launchpad, they get an error for authorization for one of the backend systems.

      I have configured roles for one of the system alias and user with that role only can access from that system.

      But the other system has no role and default system.

      I understand the SAP ORIGIN parameter can be added for custom services. I do not find any option for standard services.

      Also,is there a way to access the Fiori Launchpad URL only for a specific backend?

      Author's profile photo Alexander K
      Alexander K

      Hello Tejas.

      Can i get sap_origin without adding “;mo” to odata URL?