Technical Articles
Three types of Intent-Based Navigation in FIORI/RAP
During my daily work I’ve got a task to implement a call of another Fiori App from my Fiori Elements App. In order to achieve that I have found three possible ways to implement it (but only one of them was working for me):
- Intent-based Navigation as RAP CDS Association
- Intent-based Navigation as ABAP Call from RAP Action
- Intent-based Navigation as Fiori Extension
Let’s discuss all of them in details 🙂
1. Intent-Based Navigation as RAP CDS Association
According to documentation https://help.sap.com/docs/BTP/923180ddb98240829d935862025004d6/25f37dc4567f4287b9bfbdd0040270f1.html?locale=en-US
you can use @UI.lineItem annotation with type #FOR_INTENT_BASED_NAVIGATION to configure intent-based Navigation to another Fiori App. I have used the following configuration in Metadata Extension view of my RAP Model:
@UI: { lineItem: [ { position: 100 }
, { type: #FOR_INTENT_BASED_NAVIGATION, label: 'Send request', semanticObject: 'my_semantic_object', semanticObjectAction: 'create', requiresContext: true }
]
, identification: [ { position: 100 }
, { type: #FOR_INTENT_BASED_NAVIGATION, label: 'Send request', semanticObject: 'my_semantic_object', semanticObjectAction: 'create'}
]
, selectionField: [ { position: 40 }
]
}
status;
The button will be shown only on the List Report Page in spite of the fact, that I have configured it in identification section as well.
Note, that you can see the button only after deploying application to Fiori Launchpad, you cannot see the button in Eclipse or BAS Preview. This type of navigation will only work for Fiori Apps and not for SAP GUI for HTML even if you call this from Fiori Launchpad as target mapping.
2. Intent-Based Navigation as ABAP Call
You can use the class to trigger intent-based navigation to Fiori App from ABAP code like that:
cl_lsapi_manager=>navigate_to_intent(
object = 'your_semantic_object'
action = 'your_action'
parameters = lt_parameters
navigation_mode = if_lsapi=>gc_s_navigation_mode-new_external_window ).
This is working nicely but only from the backend side. So you cannot use this code as behaviour implementation of custom action in RAP, it will not work.
More information here https://blogs.sap.com/2016/05/13/cllsapimanager-environment-independent-navigation/
3. Intent-Based Navigation as Fiori Extension
According to the documentation https://help.sap.com/docs/SAP_NETWEAVER_AS_ABAP_752/a7b390faab1140c087b8926571e942b7/3a35ab684174415899c98da4931bd6c1.html?locale=en-US&version=7.52.5
The CrossApplicationNavigation service is used here to call an semantic object action.
I have generated the fiory elements extension using “Guided Development” function in BAS.
Choosing “Add a custom action using extensions”
After executing this wizard the manifest.json file will be updated with a new action snippet where you can setup the button label
"content": {
"header": {
"actions": {
"a_op_btnSendRequest": {
"id": "a_op_btnSendRequestButton",
"text": "CS-Auftrag Versenden",
"press": "csorder.csorder.custom.ObjectPageExtController.f_op_SendRequest",
"requiresSelection": false
}
}
}
}
and new ObjectPageExtController.js file will be created in webapps/custom section.
ObjectPageExtController.js contains a empty function where you have to implement your code for intent-based navigation.
The implementation may look like following:
sap.ui.define([],
function (){
"use strict";
return {
f_op_SendRequest: function(oEvent) {
var oCrossAppNav = sap.ushell.Container.getService("CrossApplicationNavigation");
// trigger navigation
oCrossAppNav.toExternal({
target : { semanticObject : "Name of your semantic object", action : "Your action" },
params : { your_parameter : [ your_value ] }
});
}
};
});
After this you will see the new button in Object Page, clicking on it will run another Fiori App in the same window.
You can configure the same button for List Report Page, but in this case you have to process all the selected records in a loop (in case you have allowed multiple selection).
So SAP gives us at least three possible ways to perform intent-based Navigation, depending of your requirements.
What is your experience with intent-based Navigation? Write in comments, how did you use it.
I will be glad if the content of this blog is useful to you. Follow me so you don’t miss the next content about SAP, Fiori, SAPUI5 and possibly OpenUI5.
I would also reccomend you to follow the SAP Fiori Elements environment Topic page https://community.sap.com/topics/fiori-elements
and read other community posts https://blogs.sap.com/tags/ed5c1ef6-932f-4c19-b2ba-1be375109ff5/
Thanks for sharing! It's "three" (3) and "intent-based" though. "Intent" is a noun, "intend" is a verb. English is confusing, I know. 🙂
Thanks again!
Thank you for corrections! I have updated the post.
Hi Mikhail ,
I believe all these navigations opens up in the same window, is there any way to open these navigations in a separate window?
Using the Fiori Extension can you run custom transaction codes / programs?
Nice post. I was not aware of the ABAP intent-based navigation 🙂
By the way, you can add 4th one for Fiori Elements apps -
Fiori Elements v2 -Â you can use extensionAPI.getNavigationController( ).navigateExternal( ) . Documentation.
Fiori Elements v4 - within a contoller, you can use this.getExtensionAPI( ).intentBasedNavigation.navigateOutbound( ) . Example here
For this, you need to configure an outbound navigation key in manifest.json where you need to provide a semantic object and an action. Then in the custom action implementation, you can call the method by passing this key and parameters as required for navigation.
Cheers!