Search code examples
sapui5hanasap-web-ide

Access OData services from two different system in SAP Web IDE


I have two OData services on two different systems, for which I have added destinations in HCP and entries in neo-aap.json file.

{
    "path": "/sap/opu/odata",
    "target": {
        "type": "destination",
        "name": "ABC",
        "entryPath": "/sap/opu/odata"
    },
    "description": "ABC"
}, {
    "path": "/sap/opu/odata",
    "target": {
        "type": "destination",
        "name": "XYZ",
        "entryPath": "/sap/opu/odata"
    },
    "description": "XYZ"
}

With this, I'm able to access only one system's service i.e. OData service which is on ABC. When app loads app tries to load hit metadata for 2nd OData service as well in ABC which is obviously not there, hence fails.

How do I access the OData service on XYZ system?


Solution

  • If the 'path' is the same, only the first one will be matched. Set different paths for your destinations. The 'path' property in the neo-app.json is just an alias for your destinations. With your config, this means, whenever in your app, you request something from '/sap/opu/odata/... ' the application will overwrite this part of the path with the URL you configured in the Destination.

    Just make something like this:

    {
      "path": "/ABC/sap/opu/odata",
      "target": {
         "type": "destination",
         "name": "ABC",
         "entryPath": "/sap/opu/odata"
      },
      "description": "ABC"
    }, {
      "path": "/XYZ/sap/opu/odata",
      "target": {
         "type": "destination",
         "name": "XYZ",
         "entryPath": "/sap/opu/odata"
      },
      "description": "XYZ"
    }
    

    And then make sure you use "/ABC/sap/opu/odata" or "/XYZ/sap/opu/odata" whenever you set your model data sources.