Skip to Content
7
Apr 24, 2021 at 06:42 AM

Calling Service using AJAX in Fiori Elements Extension doesn't work in Launchpad

2072 Views

Hello SAP Launchpad service Team,

I can replicate the issue that Renaat Haleydt described in his comment to the blog post from Marius Obert. To make your own replication easy I've updated the branch add-authentication of central-launchpad-cap in GitHub. Thanks to Mio Yasutake for this great starting point he described in Deploying a CAP based Fiori app to a central Launchpad.

In my branch I've added an OData V2 Fiori Elements application. Here I can use the SAP Fiori tools to add the Extension. The AJAX call is implemented in app/books-odatav2/webapp/ext/controller/ListReportExt.controller.js#L5. Like Renaat described, the call works fine when running the app standalone. In that case the Metadata is loaded from:

https://07fc19abtrial.launchpad.cfapps.eu10.hana.ondemand.com/my_service.demobooksodatav2-1.0.0/v2/catalog/$metadata?sap-value-list=none&sap-language=DE

the AJAX request ist sent to:

https://07fc19abtrial.launchpad.cfapps.eu10.hana.ondemand.com/my_service.demobooksodatav2-1.0.0/v2/catalog/Books

and requests from the Fiori Elements app are sent to:

https://07fc19abtrial.launchpad.cfapps.eu10.hana.ondemand.com/my_service.demobooksodatav2-1.0.0/v2/catalog/

But when I now run the same app in the launchpad I see the Metadata coming from:

https://07fc19abtrial.launchpad.cfapps.eu10.hana.ondemand.com/my_service.demobooksodatav2/~230421170029+0000~/v2/catalog/$metadata?sap-value-list=none&sap-language=DE

the Fiori Elements app requests go to:

https://07fc19abtrial.launchpad.cfapps.eu10.hana.ondemand.com/my_service.demobooksodatav2/~230421170029+0000~/v2/catalog/

and the AJAX requests end up at:

https://07fc19abtrial.launchpad.cfapps.eu10.hana.ondemand.com/cp.portal/v2/catalog/Books

which results in a "404 Not Found" error.

Looking forward for your help.

Best regards
Gregor

CC: Oliver Graeff, Maissa Ben Mahouachi