Ashish Patil
Ashish Patil

Reputation: 1742

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?

Upvotes: 1

Views: 2313

Answers (2)

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.

Upvotes: 2

Bernard
Bernard

Reputation: 1238

This, from my perspective, is a bug. The key used for locating the destination is the "path" value so you will always hit the first destination. You can resolve this by changing the path from /sap/opu/odata to /sap/opu/odata1 You then edit your dataSources in your manifest.json: adjust the "uri" with the adjusted path on any models you are trying to point to the 2nd path.

I have written on this here and am busy trying to get SAP to change this behaviour.

Upvotes: 1

Related Questions