Sap ui5 and xsjs - sapui5

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"
}

Related

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

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.

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"
}

Bind northwind odata service to ui5?

I would like to take http://services.odata.org/V2/Northwind/Northwind.svc/ as sample service for my ui5 app.
SAP Web IDE provide following option for OData service connection:
Which option do I have to choose to connect with Northwind OData service?
it seems like you didn't set up a Connection in your Cloud Platform Cockpit.
Firstly, go to your Cockpit and choose Connectivty -> Destinations:
Select New Destination and configure it as followed:
Then go back to your WEB IDE to the step in your screenshot and select the service you just added.
After that, the wizard wants the relative URL for the Web Service. Paste /V2/Northwind/Northwind.svc and click on Test. If everything works, you can move on creating your app.
Hope this helps

Deep linking from Web to PWA (Standalone Version)

I have a web app that it can be installed as standalone application in the homescreen thanks to PWA standard.
When a user forget his password, a email is sent to him with a link to reset the password.
Can I deep-link to the already-installed standalone version instead of the web application in chrome browser? I'd like to achieve this behaviour:
User clicks in email link from gmail application.
OS check if link matches with any url schema pre-registered in the system (This is the step that I don't really know if it's possible from web right now)
If found, open the standalone version. Otherwise, open the browser.
There is an example of describing intent filters in json here. The relevant section of the manifest is intent_filters
{
"manifest_package": "org.chromium.webapk.test",
"scope_url": "https://pwa.rocks/",
"intent_filters": {
"scope_url_scheme": "https",
"scope_url_host": "pwa.rocks",
"scope_url_path": "/"
},
"start_url": "https://pwa.rocks/",
"display_mode": "standalone",
"orientation": "portrait",
"theme_color": "2147483648L",
"background_color": "2147483648L",
"icon_urls_and_icon_murmur2_hashes": "http://www.pwa.rocks/icon1.png 0 http://www.pwa.rocks/icon2.png 0",
"web_manifest_url": "https://pwa.rocks/pwa.webmanifest",
"version_code": "1",
"version_name": "1.0",
"bound_webapk": {
"runtime_host": "org.chromium.chrome",
"runtime_host_application_name": "Chromium"
}
}
If you set your scope properly in the manifest.json file, all links in other applications will open in the standalone version instead of the browser. Note that links in the browser will still prefer the browser version instead of the standalone. For example:
"start_url": "/",
"scope": "/",
"display": "standalone"
Note: Navigating directly to https://example.com/app/ from the address
bar will work exactly as the same as it does for native apps that have
an intent filter. Chrome assumes the user intended to visit the site
and will open this site.
Source: developers.google.com/web/fundamentals/integration/webapks
Configure the Android Intent Filters in Web App Manifest as shown here

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.