SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software
Development resources, articles, tutorials, code samples, tools and downloads for SAP HANA and ABAP, HANA Database, SQLScript, SAP UI5, Screen Personas, Web Dynpro, Workflow

Launch Fiori App on Browser using ABAP Code

ABAP developers can launch Fiori apps from ABAP code and display Fiori application on web browser. In this tutorial, I want to show how to build the URL for the Fiori application for a desired Fiori app with a few simple cases.

For example, assume that you want to launch "My Inbox" app on default web browser using ABAP program code.

Fiori app on Fiori application LaunchPad

First of all, you can open the app on LaunchPad and check for URL parameters.
ABAP developers will realize a pattern as follows:
#WorkflowTask-displayInbox
This pattern is formed of "#{Semantic Object}-{Semantic Action}"

If you browse the Fiori Apps Library for "My Inbox" app you can validate the Semantic Object and Semantic Action configuration parameter values.

On Fiori Apps Library page of "My Inbox", switch to tab "Implementation Information"
Scroll down and display hidden details for Configuration
By scrolling down, you will reach a section names "Target Mapping(s)"
In this target mappings table, you will see the Semantic Object and Semantic Action values for the target Fiori app.

fiori app target mapping with semantic object and action

As I mentioned before, it is possible to get these parameter values by launching the Fiori app on Launch Pad and checking the URL address easily.

Following ABAP code can be used in an ABAP program which concatenates different parameters to form final Fiori app URL. And then ABAP cl_gui_frontend_services class execute method can launch the target URL on default web browser.

DATA:
 lv_url TYPE string,
 lv_server TYPE string VALUE 'flp.server.com',
 lv_client TYPE string,
 lv_fiori_object TYPE string,
 lv_fiori_action TYPE string.
 lv_client = sy-mandt.

SELECTION-SCREEN BEGIN OF BLOCK frame1 WITH FRAME TITLE TEXT-001.

SELECTION-SCREEN BEGIN OF LINE.
 SELECTION-SCREEN COMMENT 1(20) TEXT-002. " Semantic Object
 SELECTION-SCREEN POSITION 33.
 PARAMETERS: p_semobj TYPE char80 LOWER CASE DEFAULT 'WorkflowTask'.
SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE
.  SELECTION-SCREEN COMMENT 1(20) TEXT-003. " Semantic Action
 SELECTION-SCREEN POSITION 33.
 PARAMETERS: p_semact TYPE char80 LOWER CASE DEFAULT 'displayInbox'.
SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK frame1.

START-OF-SELECTION.

lv_fiori_object = p_semobj.
lv_fiori_action = p_semact.
lv_url = |https://{ lv_server }/sap/bc/ui5_ui5/ui2/ushell/shells/abap/FioriLaunchpad.html?sap-client={ lv_client }&sap-language=EN#{ lv_fiori_object }-{ lv_fiori_action }|.
WRITE lv_url.

CALL METHOD cl_gui_frontend_services=>execute
 EXPORTING
  document = lv_url
 EXCEPTIONS
  OTHERS = 1.
IF sy-subrc <> 0.
 WRITE :/ 'FAIL'.
ENDIF.
Code

Please note that the semantic parameters are case sensitive, so it is important to use them correctly right as they are defined. Because of that I used "LOWER CASE" option for parameters in Selection Screen.

ABAP programmers can try "SalesQuotation" and "manage", or "ATPRequirement" and "releaseForDelivery" as sample semantic objects and actions for different Fiori apps.

If the URL configuration and semantic object and action parameter values are not correctly defined, the ABAP programmer will definitely get an error message similar to following one:

Message: App could not be opened either due to an incorrect SAP Fiori launchpad configuration or a missing role assignment.
Details: {
 "info": "Failed to resolve navigation target \"#ATPREQUIREMENT-RELEASEFORDELIVERY\". This is most likely caused by an incorrect SAP Fiori launchpad content configuration or by a missing role assignment.",
 "fixedShellHash": "#ATPREQUIREMENT-RELEASEFORDELIVERY",
 "technicalMessage": "Could not resolve navigation target"
}



SAP HANA and ABAP

Install SAP Free
CRM Companies List
Web Based CRM Software


Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.