Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
MioYasutake
Active Contributor

Introduction


During development of Fiori apps, you may want to test app-to-app navigation in SAP Business Application Studio (BAS). In Web IDE Full-Stack this can be easily achieved by the method described in the following blog post.
Fiori App To App Navigation in Web IDE Full-Stack

Recently I found Fiori tools documentation and learned how to enable app-to-app navigation in BAS. If you are developing a Fiori elements app, you can activate app-to-app navigation with just a few clicks. If you are developing a freestyle app, this method is not available, but you can still enable navigation by following a few manual steps. In this blog, I'm going to demonstrate the both scenarios.

 

Enable App-to-App Navigation between Fiori elements app


If the source and target apps are both Fiori elements apps, it's easy. The only prerequisite is that the both apps are located in the same workspace.

1. Create source and target apps with Fiori elements


In the example below, the source app shows the a of orders and the target app shows a list of customers. The data source is Northwind OData V2 service.

1.1. Create the source and the target apps using SAP Fiori application template.

 

1.2. Select "List Report Object Page" floorplan.

 

1.3. Select Data Source and Service URL.

 

1.4. Select main entity. I have selected "Orders" for the source app and "Customers" for the target app.

 

1.5. Specify Project Attributes.

 

Select "Yes" for "Add FLP configuration".

 

1.6. Maintain Fiori Launchpad Configuration. Semantic Object and Action are necessary for app-to-app navigation.

 

1.7. To enable intent-based navigation, add the following annotation to the source (Orders) app.
            <Annotations Target="NorthwindModel.Order">
<Annotation Term="UI.LineItem">
<Collection>
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="OrderID"/>
<Annotation Term="UI.Importance" EnumMember="UI.ImportanceType/High"/>
</Record>
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="OrderDate"/>
<Annotation Term="UI.Importance" EnumMember="UI.ImportanceType/High"/>
</Record>
<Record Type="UI.DataFieldWithIntentBasedNavigation">
<PropertyValue Property="Value" Path="CustomerID"/>
<PropertyValue Property="SemanticObject" String="Customers"/>
<PropertyValue Property="Action" String="display"/>
<Annotation Term="UI.Importance" EnumMember="UI.ImportanceType/High"/>
</Record>
</Collection>
</Annotation>
</Annotations>

 

Also, I have added the following annotation to the target (Customers) app so that Customer ID and Company Name are displayed in the Object Page header.
            <Annotations Target="NorthwindModel.Customer">
<Annotation Term="UI.HeaderInfo">
<Record Type="UI.HeaderInfoType">
<PropertyValue Property="TypeName" String="Customer"/>
<PropertyValue Property="TypeNamePlural" String="Customers"/>
<PropertyValue Property="Title">
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="CustomerID"/>
</Record>
</PropertyValue>
<PropertyValue Property="Description">
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="CompanyName"/>
</Record>
</PropertyValue>
</Record>
</Annotation>
</Annotations>

 

1.8. Test the source app. It looks like below picture and the Customer ID is displayed as a link.

 

However, navigation is not possible yet.

 

2. Enable App-to-App Navigation


Next, let's enable app-to-app navigation.

2.1. Open Command Palette and enter Fiori: Enable App-to-App Navigation Preview.

 

2.2. Select the source application.

 

2.3. Select the target application.

 

As a result, the following message is displayed: App-to-App Navigation enabled.

2.4. Execute the source app and this time the navigation should work.
If you select customer "VINET" for example,

 

Customers app opens in the Object Page.

 

3. Behind the scenes


When you enable app-to-app navigation with the command described above, a file named appconfig/fioriSandboxConfig.json is generated.


Also, the following section is added to ui5.yaml.

These settings need to be manually added if you want to enable navigation for freestyle apps.

 

Enable App-to-App Navigation from Free style app


Freestyle apps don't appear in the source and target app list when you execute "Enable App-to-App Navigation Preview" command. So you need to add some manual configurations to enable navigation.

1. Create a Freestyle app


In the example below, I will create a freestyle app as a source app which shows a list of orders. The target app is the same as the previous example.

1.1.  Create a freestyle app using SAP Fiori application template. Here I have chosen "SAPUI5 Application".

 

1.2. Select Data Source and Service URL.

 

1.3. Specify Project Attributes and Launchpad Configuration.


 

1.4. Maintain the view code as follows.
<mvc:View
controllerName="northwind.ordersfreestyle.controller.App"
xmlns:mvc="sap.ui.core.mvc"
displayBlock="true"
xmlns="sap.m"
>
<Shell id="shell">
<App id="app">
<pages>
<Page id="page" title="{i18n>title}">
<content>
<Table id="table"
items="{path: '/Orders'}" mode="SingleSelectLeft">
<headerToolbar>
<OverflowToolbar>
<content>
<Title text="Orders" />
<ToolbarSpacer/>
<Button text="Nav to Customer" press="onNavToCustomer" />
</content>
</OverflowToolbar>
</headerToolbar>
<columns>
<Column>
<Text text="Order ID"/>
</Column>
<Column>
<Text text="Order Date"/>
</Column>
<Column>
<Text text="Customer ID"/>
</Column>
</columns>
<items>
<ColumnListItem>
<Text text="{OrderID}"/>
<Text text="{path: 'OrderDate', type: 'sap.ui.model.odata.type.DateTime'}"/>
<Text text="{CustomerID}"/>
</ColumnListItem>
</items>
</Table>
</content>
</Page>
</pages>
</App>
</Shell>
</mvc:View>

The view will show a list of orders and "Nav to Customer" button as below.

 

1.5. Maintain the controller code that triggers navigation.
sap.ui.define([
"sap/ui/core/mvc/Controller"
],
/**
* @param {typeof sap.ui.core.mvc.Controller} Controller
*/
function (Controller) {
"use strict";

return Controller.extend("northwind.ordersfreestyle.controller.App", {
onInit: function () {

},

onNavToCustomer: function (oEvent) {
var customerId = this.byId("table").getSelectedContexts()[0].getObject().CustomerID;
if (sap.ushell && sap.ushell.Container && sap.ushell.Container.getService) {
var oCrossAppNav = sap.ushell.Container.getService("CrossApplicationNavigation");
oCrossAppNav.toExternal({
target : { semanticObject : "Customers", action : "display" },
params : { CustomerID : [ customerId ] }
})
}

}
});
});

 

2. Enable App-to-App Navigation


Here you will add some configurations manually which would be generated if you use "Enable App-to-App Navigation Preview" command.

2.1. Create test/flpSandbox.html file.
<!DOCTYPE html>
<html>

<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Fiori Launchpad Sandbox</title>

<script>
window["sap-ushell-config"] = {
defaultRenderer: "fiori2",
bootstrapPlugins: {
"KeyUserPlugin": {
"component": "sap.ushell.plugins.rta"
},
"PersonalizePlugin": {
"component": "sap.ushell.plugins.rta-personalize"
}
},
applications: {
"masterDetail-display": {
title: "Order List",
description: "",
additionalInformation: "SAPUI5.Component=northwind.ordersfreestyle",
applicationType: "URL",
url: "../"
},
}
};
</script>

<script id="sap-ui-bootstrap" src="/test-resources/sap/ushell/bootstrap/sandbox.js">
</script>

<script id="sap-ui-bootstrap"
src="/resources/sap-ui-core.js"
data-sap-ui-resourceroots='{"northwind.ordersfreestyle": "../"}'
data-sap-ui-theme="sap_fiori_3"
data-sap-ui-compatVersion="edge"
data-sap-ui-async="true"
data-sap-ui-frameOptions="allow">
</script>

<script>
sap.ui.getCore().attachInit(() => sap.ushell.Container.createRenderer().placeAt("content"));
</script>
</head>

<body class="sapUiBody" id="content"></body>

</html>

 

2.2. Create appconfig/fioriSandboxConfig.json file.
{
"applications": {
"Orders2-display": {
"additionalInformation": "SAPUI5.Component=northwind.ordersfreestyle",
"applicationType": "URL",
"url": "../"
},
"Customers-display": {
"additionalInformation": "SAPUI5.Component=northwind.customers",
"applicationType": "URL",
"url": "../resources/northwind.customers"
}
}
}

 

2.3. Add the following section to ui5.yaml.
  - name: fiori-tools-servestatic
afterMiddleware: compression
configuration:
paths:
- path: /resources/northwind.customers
src: /home/user/projects/customers/webapp
- path: /appconfig
src: /home/user/projects/orders-freestyle/appconfig

 

Finally, start the app and open test/flpSandbox.html.
When you select a row and press "Nav to Customer" button, the Customers app will open and navigate to the Object Page.


 


 

Conclusion



  • You can enable app-to-app navigation for Fiori elements app with Fiori: Enable App-to-App Navigation Preview command.

  • You can enable app-to-app navigation for freestyle apps with manual configuration.


References


24 Comments
EkanshCapgemini
Active Contributor
0 Kudos
Hi Mio,

Thanks a lot for this blog. I was actually thinking of it while navigating away from WebIDE.

I am using VSCode with SAP Fiori Tools extension package and was testing the fiori element navigation. However, when we click on customer id in orders app, it shows error popup stating 'Navigation to this application is not supported.' 

I cross verified my Semantic Object and Action for target app but availed no benefit. Both my apps are using different ports (8080 for orders and 8081 for customers), is this the root cause for this error?

BR, Ekansh
MioYasutake
Active Contributor
0 Kudos
Hi ekansh005,

 

Thank you for your comment.

I think you need to adjust ui5.yaml file of orders project according to your local directory structure.

I have cloned the project to VS code and made the following change to ui5.yaml, and navigation worked.
    - name: fiori-tools-appreload
afterMiddleware: compression
configuration:
port: 35729
path: webapp
- name: fiori-tools-servestatic
afterMiddleware: compression
configuration:
paths: #adjust paths according to your local deirectory structure
- path: /resources/northwind.customers
src: ../customers/webapp
- path: /appconfig
src: ./appconfig

 

Best regards,

Mio

 
EkanshCapgemini
Active Contributor
Thanks mioyasutake

Infact 'fiori-tools-servestatic' were already present in my ui5.yaml file but with absolute path. Changing these to relative paths did the magic. Thanks for your support.

BR, Ekansh
maheshpalavalli
Active Contributor
Awesome one mioyasutake , this helped me a lot 🙂

BTW, i am doing for freestyle in BAS and I used the below config, which worked for me and not the one with 'home/user..' , not sure about the reason though..
    - name: fiori-tools-servestatic
afterMiddleware: compression
configuration:
paths:
- path: /resources/reusedapp
src: ../reusedapp/webapp
- path: /appconfig
src: appconfig
MioYasutake
Active Contributor
Hi maheshkumar.palavalli,

Thank you for your comment. Good to know that this post was helpful to you and you were able to solve your problem!

 
dhiraj_more
Participant
0 Kudos
Hi Mio,

Nice blog. I have a requirement where I have two fiori applications developed on cloud foundry using BAS. I need to call(more of a embed type) one application into one of the tab of other application.

If you have done something like this then please advise.

 

Thanks,

Dhiraj M
MioYasutake
Active Contributor
0 Kudos

Hi dhiraj.more,

Thanks for your comment.

Based on your requirement, embedding the second app as a component might be a good option.

https://sapui5.hana.ondemand.com/sdk/#/topic/346599f0890d4dfaaa11c6b4ffa96312.html

UdayMS
Participant
0 Kudos
Hi Mio

Great blog!!

I have requirement where from a custom Fiori module of mta application in Cloud Foundry, I want to call a standard fiori application which is deployed on premise on S/4 HANA. For example from one of the table row cell data like a invoice number, clicking on which should take me to a standard fiori application on on premise. Is it possble?

 

Thanks

Uday
MioYasutake
Active Contributor
0 Kudos
Hi Uday,

Thank you for your comment.

If your custom app and the standard app are both on BTP Launchpad, you can navigate from the custom app to the standard app.

I think it is not possible to test it in BAS, though.
UdayMS
Participant
0 Kudos
Hi Mio

We are having custom app on btp cloud launchpad and standard app on on premise s/4 hana

Thanks

uday
S0025160864
Explorer
0 Kudos
Hi Uday.

are you able to resolve this issue
S0025160864
Explorer
0 Kudos
Hi Mio,

can you please share some details on above mentioned navigation
MioYasutake
Active Contributor
0 Kudos
Hi poonam2023,

The prerequisite is you have both apps (custom app and S/4HANA app) available on the BTP launchpad (SAP Build work zone). To navigate from the custom app to the S/4HANA app, you use the intent (semantic object + action ) of the S/4HANA app.

How to make S/4HANA apps available on the BTP launchpad is described in the below tutorial.

https://developers.sap.com/tutorials/cp-launchpad-federation-prepares4hana.html

 
zhang-hao
Explorer
0 Kudos

Thanks to your blog, I was able to navigate with the above method, but I would like to add a check process for the selected data.


what should I do (for example, select multiple rows and display only the data of the same date in the navigation destination app)?I couldn't find a place where I could add check logic.

MioYasutake
Active Contributor
0 Kudos
Hi zhang-hao,

Thanks for reading. Below extension can be used to modify properties handed over to the target app.

Please note this is not for checking, but for modifying navigation context.

https://sapui5.hana.ondemand.com/#/topic/199a496c5fa544dfbe134b53eaba092e
zhang-hao
Explorer
Hi Mio

Thank you for your reply!

I checked the link you gave me.

I'll try this extension method.
zhang-hao
Explorer
0 Kudos
Hi Mio
I'm sorry for repeatedly asking questions.

In navigation settings above,  "Display" of "Semantic Object Action" is being used.

Are actions other than "Display" also available? For example, Create, Edit, Manage, etc.

If they are not available by default, could you please explain how to create custom actions?

From my research, it seems that in S/4, it can be configured through "SPRO," but I couldn't find a way to do it on BTP.

I appreciate your assistance.
MioYasutake
Active Contributor
0 Kudos
Hi Hao Zhang,

If you would like to have the target application open in edit mode, you need to create a custom action. With Fiori tools (guided development), you can easily configure custom actions. Here is the documentation on how to do it manually.

https://sapui5.hana.ondemand.com/#/topic/7619517a92414e27b71f02094bd08d06.html

Inside the custom action you can control in which mode (display/edit) the target application should open using the following extension API. There is a parameter "displayMode" which determines the target application's mode.

https://sapui5.hana.ondemand.com/sdk/#/api/sap.suite.ui.generic.template.extensionAPI.NavigationCont...
zhang-hao
Explorer
0 Kudos
Hi Mio,

Thank you for your response.

I checked the provided API but the parameter "displayMode" seems to be used for navigation within an app. Is it also possible to use it for navigation between apps?

Currently, I'm using the "CrossApplicationNavigation" API as introduced in this blog post. Regarding the "action: "display"", is it customizable?

I apologize for the repeated inquiries, but I would appreciate your response.
MioYasutake
Active Contributor
0 Kudos
Hi,

Sorry for giving a wrong link. Indeed, it was for internal navigation.

If your target app has different intents (semantic object + action) depending on display or edit mode, you can simply give different action to the "oCrossAppNav.toExternal" method.
tamilselvanm
Participant
0 Kudos

Hi mioyasutake

 

This is really a good blog.

I followed the same steps in this blog and it worked for scenario "App to App Navigation from SAP Freestyle(List Page) to SAP Fiori Elements(Object Page)"

But when we navigate from Object Page to List page, the list page gets refreshed every time. it takes time to load all the data in the table. How can we stop the initial load of list page all the time during Navigation from Object page to List page?

 

Regards,

Tamilselvan

 

 

 

MioYasutake
Active Contributor
0 Kudos
Hi tamilselvanm,

Thank you for your comment. I re-tested this scenario with both a freestyle app and a Fiori elements app as sources and observed the same behavior you described. When navigating back from the Object Page to the List Page, the List Page refreshes each time because it opens in a "new state," which means the view is completely reinitialized.

If you have set some filter conditions, you can retain them using the apps state (as a list report app would) to save loading time.

Regards,

Mio
tamilselvanm
Participant
0 Kudos

Hi mioyasutake,

 

It would be great if you share some filter conditions to retain them the using the apps state (as a list report app would) to save loading time in your scenario (SAP Freestyle and SAP Fiori Elements).

 

Regards,

Tamilselvan

scurry888
Participant
0 Kudos

I'm newer with Fiori:  Can someone tell me how I would add the annotation in 1.7 above?

Labels in this area