Skip to Content

How to use Destinations in Widgets

My goal is to convert an SAPUI5 app which uses an OData Service to a Wdiget and use this Widget in the Portal Service.

i followed the following Tutorial which worked so far. I can insert the widget into my Freestyle Site in my Portal Service. The Site is shown but my table shows no Data. The OData Request returns "404 not found". I assume that the destinations of the original app haven't been added to the widget.

What is the best practice here?
Do i have to add a destination to the Freestyle Site? If yes, how?

Greetings
Oliver

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Dec 22, 2016 at 09:14 AM

    Hi Oliver,

    Destinations are used in the application lever, regardless of the portal framework, so you don't need to add them again.

    One difference between running the application as a standalone application and running in in the portal context is the URL of the application - when the application runs inside the portal it is actually running in the URL of the portal, prefixed with /sap/fiori/<application-name>.

    I assume that when your application tries to access the destination, it accesses "/destinations/<destination-name>/..." - and in the portal context, you need to add the /sap/fiori prefix as well.

    This can all be solved by modifying the AJAX requests in your application to support both scenarios (with and without a prefix):

    jQuery.get(jQuery.sap.getModulePath("<your-component-name>") + "/destinations/...")

    This way, running as a standalone application, getModulePath will return "/", and running in the portal it will return "/sap/fiori/<application-name".

    Regards,

    Guy

    Add comment
    10|10000 characters needed characters exceeded