Tree types of Intend-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 tree possible ways to implement it (but only one of them was working for me):

  1. Intend Navigation as RAP CDS Association
  2. Intend Navigation as ABAP Call from RAP Action
  3. Intend Navigation as Fiori Extension

Let’s discuss all of them in details 🙂

1. Intend-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 Intend 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. Intend-Based Navigation as ABAP Call

You can use the class to trigger intend-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. Intend-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 intend 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 Intend-Based Navigation, depending of your requirements.

What is your experience with Intend-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/