Search code examples
proxysapui5sap-cloud-platform

Consume a third party library through a Destionation in Sap Cloud Platform


As we can call an external northwind oData service in our consuming sapUI5 app (relying on SCP destinations and routing in neo-app.json), I was wondering if it is possible to expose a custom library and call it in the same way, avoiding CORS issues once deployed. I can't find any suitable documentation on how to configure such destination.

My requirement is to reference an external library. I prefer not to embed the minified library in my project nor call it with an hardcoded path.

Any help would be very appreciated!

EDIT: This is the Destination I set up for testing purposes... I require the library in the manifest and set up the routing in neo-app.json but the library is still missing in my consuming project.

Test destination


Solution

  • I managed to answer to my own question: the proposed architecture is feasible: in the following, my working configuration. Please note that my destination configuration points to a custom library deployed in the same SCP.

    In the SAP Destination: enter image description here

    In the neo-app.json of the consuming app:

    enter image description here

    Then you can reference the library in your controllers as

    sap.ui.define([
        "sap/ui/core/mvc/Controller",
        "namespace/mylibrary/library"
    ], function (Controller, library) {....});