sap.ushell.Container is undefined in SAPUI5 app deployed on SAP BTP Cloud Foundry - sapui5

I am facing an issue in calling sap.ushell.Container.getServiceAsync("CrossApplicationNavigation") from a SAPUI5 application deployed in BTP Cloud Foundry and accessed through SAP BTP Launchpad service.
My understanding is: if app is launched from Fiori launchpad, it can trigger CrossApplicationNavigation.
manifest.json has the following dependencies declared:
{
"sap.ui5": {
"dependencies": {
"minUI5Version": "1.52.0",
"libs": {
"sap.ui.core": {},
"sap.m": {},
"sap.ui.layout": {},
"sap.ushell": {},
"sap.collaboration": {},
"sap.ui.comp": {},
"sap.uxap": {}
}
Error coming in console:
Current sap.ushell:

Steps to address "sap.ushell.Container is undefined" error in an SAPUI5 app deployed on SAP BTP Cloud Foundry :
Check the SAPUI5 version : Ensure that the version of SAPUI5 libraries in your application matches the version supported by SAP BTP Cloud Foundry.
Verify the resource path : Make sure that the path to the SAPUI5 libraries in your application is correct and points to the correct location in SAP BTP Cloud Foundry.
Check the bootstrap configuration : Ensure that the bootstrap configuration in your index.html file is correct and matches the SAP BTP Cloud Foundry environment.
Clear the browser cache : Clearing the browser cache can sometimes resolve the issue as it may have stale resources.
Test with a different browser : If the issue still persists, try accessing your application using a different browser to eliminate any browser-specific issues.

Related

SAPUI5 BTP Cloud Foundry How to create SAPUI5 News in CF Launchpad?

I'm trying to migrate SAP BTP Neo Cloud Portal apps to SAP BTP Cloud Foundry. Im facing an issue in migrating an application which I configured App type as News in SAP BTP Neo.
Below is the pic of SAP BTP Neo Cloud Portal. Here we have an option to configure the App Type as SAPUI5 News:
Below is the pic in SAP BTP Cloud Foundry. Here we don't have an option to configure our app type as SAPUI5 News:
Can someone please help me to configure below apps in SAP BTP Cloud Foundry portal, which can be done in SAP BTP Neo by configuring the App Type as SAPUI5 News?

Add Custom SAPUI5 Library to SAP Cloud Platform Fiori Launchpad (Portal Service)

I've created a custom SAPUI5 library with the SAP Web IDE and deployed the library to the SAP Cloud Platform. The library is used by multiple SAPUI5 applications and works perfect when the apps are launched from the SAP Web IDE. The dependency to the library is defined in the manifest.json of each application:
"dependencies": {"libs": {"custom.library"}: {}}}
Furthermore I've already added the correct path to the file neo-app.json.
Now I've registered the SAPUI5 applications to the SAP Cloud Platform Fiori Launchpad. I can start the Launchpad and see the tiles for the apps. But when I start an app the following error occurs:
Error: failed to load 'custom/library/library.js' from https://sapui5.hana.ondemand.com/1.52.17/resources/custom/library/library.js: 404
How can I register the custom UI5 library to the Fiori Launchpad?
On SAP Community, you’ll find this blog about the SAPUI5 Custom control library.
There it says that you need to add an entry into “routes” array of neo-app.json file for your newly deployed library.
The entry shall look like this:
{
"path": "/webapp/resources/my/custom/control",
"target": {
"type": "application",
"name": "mycustomlib",
"entryPath": "/"
},
"description": "Custom control library"
}
Here, “path” is the path you use in the dependency definition of your controller JS file.
“name” in “target” clause contains the name under which you deployed the library into SAP Cloud Platform.
As SAP Fiori Crew pointed out, you need to create a route entry in neo-app.json for the SAP Cloud Platform router to know where to serve your library files from when requested by the applications.
A good way to find out the exact URL that needs to be added is checking the Network requests in your browser's Developer Tools, when trying to load the application in the Launchpad:
In the example above, adding this entry to neo-app.json solved the problem:
{
"path": "/sap/ui5/1/resources/vplanner/common",
"target": {
"type": "application",
"name": "vpfioricommon"
},
"description": "Common Library"
}

Sap ui5 and xsjs

I have created an SAP UI5 app in Web IDE and also a XSJS app using HANA web based tools. But I am unable to call the xsjs service directly from my Web IDE application using ajax call giving the full URL.
If anyone can give an idea it would be great.
First, you need to create a HTTP destination that includes the xsjs URL and the information of authorized database user from SAP Cloud Platform Connectivity section. Then you'll add that destination to your neo-app.json file like below, to be able to call it using "/customPathToUse". It's done.
{
"path": "/customPathToUse",
"target": {
"type": "destination",
"name": "NameOfTheDestination"
},
"description": "XS Destination"
}

Setting up a destination in SAP HANA CLOUD Platform

​Is it possible to setup a destination URL for your own internal SAP business network?
We are currently using Eclipse to deploy SAPUI5 to an ABAP repository but would like to start using SAP WEB IDE.
I've provided our URL but it's returing the error Failure reason: "Backend status could not be determined"

How to integrate SAPUI5 apps developed on ABAP repository in HANA Cloud Platform

The scenario is to use already developed SAPUI5 applications on ABAP Gateway as portal widgets in sites developed through SAP HANA Cloud Platform,portal service.
I know we can add the ABAP backend gateway services using HANA Cloud connector and destination in HCP cockpit.
How to do we deal with the SAPUI5 applications.
a) Do we need to export them from the ABAP repository and import them into HCP web ide?
b) Can we directly deploy the same application on HCP as well and access it on the site?
In above both cases, what about the service calls made from within the app? wouldn't the urls be changed once the app is moved/imported to HCP [assuming app only makes call to relative urls.]
Any information/Documentation on this would be really helpful.
to both a) and b) my answer is Yes. With some reservation for a) as actually I just don't know of another method to deploy existing SAPUI5 apps from backend to HCP.
In my case the scenario was the following:
First, we installed HCP connector, linked it to existing S-users, then I defined a destination in my HCP account. Be aware that you have to add some specific attributes to the destination to make it available in WebIDE.
My task was to extend some existing SAPUI5 applications, so I imported them into WebIDE and it appeared that they worked just fine when running via WebIDE without changing a single line of code or configuration. Apparently they can be deployed to HCP as a standalone apps or as a part of Fiori launchpad.