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 …

/wp-content/uploads/2015/05/s2_703860.png

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.

/wp-content/uploads/2015/05/s1_703861.png

Now if the user presses one of those links an FPM event (with id if_fpm_constants=>gc_eventflp_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.

To report this post you need to login first.

12 Comments

You must be Logged on to comment or reply to a post.

      1. Emily Ning

        Hello Christian,

        No worries. May I ask a question here? I tried the 2nd flavor — FLP navigation API for freestyle UIBBs, when I call method lo_fpm->get_flp_navigation(), I got an initial object due to the failure on check whether FLP is active. So based on this case, it means I can’t go this way or I need to make some prerequisites for our application? Thank you so much.

        Kind Regards,

        Emily

        (0) 
        1. Christian Guenther Post author

          Hello Emily,

          IF_FPM->GET_FLP_NAVIGATION will return an instance of IF_FPM_FLP_NAVIGATION when the application is running in Fiori Launchpad. If running in another shell or standalone IF_FPM->GET_FLP_NAVIGATION will return initial. This is the way you can decide at runtime if FLP is active or not.

          Intent based navigation is only possible when FLP is active. So if your application should be enabled to run and navigate without FLP you have to code for both cases – so you will have in your application code lines like:

          DATA(lo_flp_api) = lo_fpm->get_flp_navigation( ).

          If lo_flp_api is bound.

            … “Logic when running inside FLP

          else.

            … “Logic when running outside FLP

          endif.

          Best regards,

            Christian

          (0) 
  1. Karnam Vasavi

    Hi Christian,

        I followed the second approach,

           lo_flp_api->get_semantic_object_intents( <semantic_object> )

        lo_flp_api is initial always because sap-shell URL parameter is initial. why is it so?

        Is there any prerequisites that we need to follow before doing this?

       Another question is that,

         i  followed the third approach as well, Quick view is not rendering by default and the event is not getting triggered in Process_event.

    BR,

    Vasavi.

    (0) 
    1. Christian Guenther Post author

      Hello Vasavi,

      are you sure that you are running your application inside Fiori Launchpad? sap-shell=FLP will be set only in this case and IF_FPM->GET_FLP_NAVIGATION will only return the FLP Api when running embedded in FLP. If the application is running in FLP you should see the FLP header on top of your application.

      Best regards,

        Christian

      (0) 
  2. Christian Guenther Post author

    Hello VasaviKarnam,

    this URL parameter should be set automatically if you are running inside FLP. If it’s not set although running in FLP you should open a ticket. But before please do a last check, if you are really, really running in FLP: Try to open the context menu on the header. If you get the browser’s context menu, then you are running in FLP. If you get the WebDynpro context menu (normally starting with “Display Quick Help”) then you aren’t running in FLP and you should check the way you integrated your app in FLP.

    Best regards,

      Christian

    (0) 
    1. Karnam Vasavi

      Hi Christian,

          Thanks for the information.sap-shell issue is resolved now.

           I have one more doubt ,

           is it possible to handle flp navigation on tool bar actions ?

      Regards,

      Vasavi.

      (0) 
      1. Christian Guenther Post author

        Hello Vasavi,

        yes of course! You can trigger the navigation on toolbar button click, and you can as well trigger the determination of semantic object intents on toolbar button click. The only thing you can’t do is do both things in one roundtrip, as the target determination is done on client side.

        Best regards,

          Christian

        (0) 

Leave a Reply