Skip to Content
Technical Articles
Author's profile photo Louis-Arnaud BOUQUIN

Call fiori app from SAPGUI transaction


EDIT : There is a standard method to do this, it’s easy to use at least if you found it in the documentation 🙂

Thanks to Dennis Schulmeister-Zimolong

cl_lsapi_manager=>navigate_to_intent(
  object          = ls_ui5_navigation-semantic_object
  action          = ls_ui5_navigation-semantic_action
  parameters      = lt_lsapi_parameters
  navigation_mode = if_lsapi=>gc_s_navigation_mode-inplace
). 

Handling Cross-App Navigation for SAP GUI and Web Dynpro Apps


 

There are many blog posts that explain how to call sapgui transaction from Fiori launchpad.

Here is an example.

But what if you want to do the opposite : call Fiori App from sapgui transaction. Why ?

Let’s take this scenario :

Your customer has SAP ECC with many SAPGUI transactions that work great. He moved to S/4 HANA with a conversion project so that he could keep his old transaction.

Now he wants a new custom development that will be called from one of his old transaction. You have 2 options :

  • Create a new SAPGUI transaction and use “CALL TRANSACTION”  in ABAP
  • Create a new Fiori APP (of course !!)

The second choice should be the best option but we need a way to call the fiori app.

I created a little method to do this. It works from SAPGUI, from a web browser or from business client.

Note that either when you use the web browser or the business client, the fiori app will open in a new tab which is coherent with the functionnality of the fiori launchpad (when you call a sapgui transaction from a fiori app, it opens in a new tab).

Now let see the code !

    "! Call Fiori app from sapgui
    "! @parameter i_semantic_object | Semantic object
    "! @parameter i_action | action
    METHODS call_fiori_app_from_sapgui
      IMPORTING
        i_semantic_object TYPE /ui2/semantic_object
        i_action          TYPE /ui2/action
        i_path            TYPE string OPTIONAL. 

METHOD call_fiori_app_from_sapgui.

    DATA(business_client) = NEW cl_nwbc( ).
    DATA(business_client_context) = business_client->context_get( ).

    IF business_client_context IS INITIAL.

      "Create sicf node (In this case, alias is created from sys id and client)
      DATA(node_path) =  `/` && sy-sysid && `_` && sy-mandt.
      TRANSLATE node_path TO LOWER CASE.

      DATA(lo_start_url) = NEW /ui2/cl_start_url( iv_icf_node_path = node_path ).

      "add sap params "sy-mandt", "sap-language", "sap-language"
      lo_start_url->add_sap_params( ).

      "add fragment
      IF i_semantic_object IS NOT INITIAL.
        IF i_path IS NOT INITIAL.
          lo_start_url->change_fragment( 
              iv_fragment = |{ i_semantic_object }-{ i_action }&{ i_path }| ).
        ELSE.
          lo_start_url->change_fragment( iv_fragment = |{ i_semantic_object }-{ i_action }| ).
        ENDIF.
      ENDIF.


      "start in browser if business client is not active
      lo_start_url->start_browser( ).

    ELSE.

      DATA business_client_url TYPE string.
      IF i_path IS NOT INITIAL.
        business_client_url = 
           business_client_context-login_url && |#{ i_semantic_object }-{ i_action }&{ i_path }|.
      ELSE.
        business_client_url = 
           business_client_context-login_url && |#{ i_semantic_object }-{ i_action }|.
      ENDIF.
      business_client->url_launch(
          url = business_client_url ).

    ENDIF.

ENDMETHOD.

There is just one thing that you have to change in the code : you need a way to find your SICF node from the fiori launchpad url. (just after the comment “”Create sicf node (In this case, alias is created from sys id and client)”).

You can add a path at the end of the url to go directly to an entity by navigation.

Hope it will help !

Assigned Tags

      3 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Rodrigo Melo de souza
      Rodrigo Melo de souza

      Excelent! Thank´s!

      In my case, i came from a fiori app call to one program tcode with call transaction and BDC that opens other page (the BCD is incomplete, and type 'E')... Here all is OK !!

      after conclusion, i need to go back to previous app... using your suggestion, it is opening a new tab with the app... how can i open in the same tab? I will continue trying here.. have any suggestion?

      Thanks till now!!

      Author's profile photo FLAVIO LEMOS
      FLAVIO LEMOS

      What if I need something a little bit different? I need to Call fiori app from SAPGUI transaction, but I need to determine the Fiori url dynamically. For instance, I need to determine dynamically the fior url for PR appoval.

       

       

      Thanks!

      Author's profile photo Dennis Schulmeister-Zimolong
      Dennis Schulmeister-Zimolong

      Hi all,

      There is also an official method to trigger intent based navigation in ABAP from any UI technology:

      cl_lsapi_manager=>navigate_to_intent(
        object          = ls_ui5_navigation-semantic_object
        action          = ls_ui5_navigation-semantic_action
        parameters      = lt_lsapi_parameters
        navigation_mode = if_lsapi=>gc_s_navigation_mode-inplace
      ). 
      
      

      It took me a while to find this, but it is actually described in the launchpad help: Handling Cross-App Navigation for SAP GUI and Web Dynpro Apps

      Kind regards, Dennis