Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member193369
Active Participant


Launching WebDynpro ABAP and FPM applications from the Fiori Launchpad (FLP) is already possible since quite some time (see https://scn.sap.com/docs/DOC-58178). However so far there was no way to navigate from a WebDynpro/FPM application to another application within the Fiori Launchpad.

This gap is now closed with SAP_UI 7.40 SP12 and I will try to explain in this blog how you could achieve this.

 

Intent-based Navigation


Navigation within the Fiori Launchpad is done by “Intent-based Navigation”. This means that on starting a navigation the source application simply tells the Fiori Launchpad the “Intent” of the navigation, but not the explicit target application. And then the Fiori Launchpad makes a lookup in its repository and starts the application matching the requested intent.

An intent consists of three parts: A semantic object, an action and parameters. The semantic object describes the business entity (e.g. customer, cost center, sales order...), the action what shall be done with the semantic object (e.g. display, edit, create...) and the parameters contain all further information needed to start the target application (e.g. the customer id, the cost center number …).

So it seems to be quite easy: To start navigation the application only has to call an API provided by Fiori Launchpad and provide the “intent”.

But there is a problem: As the Fiori Launchpad is a JavaScript based application running in the browser, the navigation API is it as well. On the other side the application code of WebDynpro ABAP and FPM is ABAP based and running in the backend. And there is no easy way for applications to bridge the frontend-backend boundary.

Now (with SP11) we offer ABAP based APIs for this. There are 3 flavors of this API (with increasing ease use): One for WebDynpro Freestyle (without FPM), one for Freestyle UIBBs within FPM and a 3rd one for the use in generic UIBBs (GUIBBs). Common to all 3 is the fact that they are working asynchronously - when trying to retrieve information from this API, you will not get the response immediately.

FLP Navigation API for WebDynpro ABAP Freestyle


If you are outside of FPM you have to use the API offered by interface IF_WD_FLP_API:
  Data(lo_flp_api) = cl_wd_flp_api=>get_api( view = view ).

 
























Method



Description



GET__SEMANTIC_OBJECT_LINKS



Returns a table with object links to an object, or if no object is specified, it returns all links and their descriptions.



IS_INTENT_SUPPORTED



Checks whether an intent or multiple intents are supported.



GET_HREF_FOR_EXTERNAL



Returns the reference to an object and action.



NAVIGATE_TO_OBJECT



Navigates to an object and action. A browser window opens with the application navigated to.



All these methods requires to supply a WebDynpro Action. After calling the method the response isn’t returned immediately but at a later point in time by calling this action handler. E.g. the call
lv_request_id = lo_flp_api->get_semantic_object_links( 
object = <semantic_object>
parameters = <parameter>
view = <view>
on_action = ‘OBJECT_LINKS_PROVIDED’ ).

 

returns only a request id directly. The requested list of navigation links is provided later by a call to the action handler ‘OBJECT_LINKS_PROVIDED’ of the provided view <view>.

A detailed description of this API can be found in the SAP Help Portal.

 

FLP Navigation API for Freestyle UIBBs


For Freestyle UIBBs in FPM we offer the new API IF_FPM_FLP_NAVIGATION. You can access this API via the IF_FPM interface:
DATA(lo_flp_api) = lo_fpm->get_flp_navigation( )

 

This API offers you 3 methods: GET_SEMANTIC_OBJECT_INTENTS, GET_SEMANTIC_OBJECT_INTENTS_M and NAVIGATE. The first 2 methods are used for the determination of the available navigation targets. You should use GET_SEMANTIC_OBJECT_INTENTS when you want to retrieve the navigation targets for a single semantic object, while GET_SEMANTIC_OBJECT_INTENTS_M allows you to request the targets for multiple objects at once.

Let’s assume we want to determine the list of available navigation targets for a given semantic object:

 
lo_flp_api->get_semantic_object_intents( <semantic_object> ).

 

This call has neither returning nor exporting parameters. Again the answer will be provided asynchronous. In the FPM context applications aren’t dealing with WD actions but with FPM events. And therefore some time after you called this method an FPM event will be triggered. This event has the ID given by constant
if_fpm_constants=>gc_event-flp_intents_available

 

and contains the list of available intents as event parameter. To evaluate this event you should handle it in the appropriate PROCESS_EVENT method. Here is some sample code showing how to retrieve the semantic object and the intents

 
  IF io_event->mv_event_id = if_fpm_constants=>gc_event-flp_intents_available.

DATA: lv_semantic_object TYPE fpm_semantic_object.
io_event->mo_event_data->get_value(
EXPORTING
iv_key = if_fpm_constants=>gc_event_param-semantic_object
IMPORTING
ev_value = lv_semantic_object ).

DATA: lt_intent TYPE if_fpm_flp_navigation=>ty_t_intent.
io_event->mo_event_data->get_value(
EXPORTING
iv_key = if_fpm_constants=>gc_event_param-intent_data
IMPORTING
ev_value = lt_intent ).

ENDIF.

You can use this information now for either rendering links or other UI elements allowing the user to trigger navigation or to navigate directly. In any case you have to trigger navigation at some place in your code. And this can be achieved by calling method NAVIGATE.
  lo_flp_api->navigate( iv_semantic_object = <semantic_object>
iv_action = <action>
it_parameter = <parameter> ).

With it_parameter you can transmit parameters like object keys, ... so that the called application knows what data to be displayed.


FLP Navigation API for Generic UIBBs


When using Generic UIBBs (GUIBBs) you don’t need to deal with any rendering code, as this is done by the generic coding provided by the GUIBB. You simply configure the UI based on a feeder class, which provides the necessary metadata and at runtime the displayed data.

To support FLP navigation we extended the configuration of the GUIBBs, allowing to attach a semantic object to fields in forms, columns in lists …



At runtime the assignment of a semantic object results in a Quickview being rendered on hovering this field. This Quickview displays a list of links, one link for each available action for the configured semantic object.



Now if the user presses one of those links an FPM event (with id if_fpm_constants=>gc_event-flp_navigation) is fired, allowing you to trigger the navigation from one of the PROCESS_EVENT methods (of your feeder classes or application controllers):
if io_event->mv_event_id = if_fpm_constants=>gc_event-flp_navigation.

* Get semantic object from event
data: lv_semantic_object type fpm_semantic_object.
io_event->mo_event_data->get_value(
EXPORTING iv_key = if_fpm_constants=>gc_event_param-semantic_object
IMPORTING ev_value = lv_semantic_object ).
* Get Action from event
data: lv_action type string.
io_event->mo_event_data->get_value(
EXPORTING iv_key = if_fpm_constants=>gc_event_param-action
IMPORTING ev_value = lv_action ).
* For additional parameters the field name and the data record from
* where the navigation link was triggered meight be useful
data: lv_fieldname type string,
lr_record type ref to data.
io_event->mo_event_data->get_value(
EXPORTING iv_key = if_fpm_constants=>gc_event_param-fieldname
IMPORTING ev_value = lv_fieldname ).
io_event->mo_event_data->get_value(
EXPORTING iv_key = if_fpm_constants=>gc_event_param-data_record
IMPORTING er_value = lr_record ).

data: lt_parameter type FPM_T_PARAMETER.
* Now you should add the application-specific logic to fill the parameters
*
* .....
*

* Finally trigger the navigation
mo_fpm->get_flp_navigation( )->navigate(
iv_semantic_object = lv_semantic_object
iv_action = lv_action
it_parameter = lt_parameter ).

endif.


Summary


FLP Navigation from WDA/FPM applications requires a complex interaction of client-side javascript based frontend logic with the backend side ABAP based application logic. Based on the WDA environment there are several APIs helping application developers to handle this

In Webdynpro Freestyle


API IF_WD_FLP_API manages the frontend communication for you

In a FPM based applications


API IF_FPM_FLP_NAVIGATION offers you an even simpler access to the functionality IF_WD_FLP_API offers. Additionally this API buffers the result of the frontend API calls, so that in a lot of cases additional roundtrips are avoided

When using GUIBBs


You additionally get a UI (Link list in Quickview) for triggering the navigation by simple configuration. The needed amount of code is reduced to a minimum.

12 Comments