Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
cancel
Showing results for 
Search instead for 
Did you mean: 
hannes_defloo
Advisor
Advisor

UPDATE : 22/04/2021: refer to new blog for customers with S/4HANA 2020 or FES 2020.

As part of the SAP S/4HANA Regional Implementation Group, I have the privilege of working with a lot of customers who are implementing SAP S/4HANA locally, regionally, and internationally.

Many of our customers are implementing or are already live with several SAP Fiori apps.  What possibilities do they have to detect how much these are used by the end-users?

One of the possibilities to do this using SAP Web Analytics, this is a service available on the SAP Cloud Platform.  It’s not a free service, you can find details on the pricing here.

Note that there are some other options to do measure user statistics of SAP Fiori :

    • ST03 transaction in the ABAP system also provides some statistics on SAP Fiori usage.  This is available in any system.

 

 

 

    • … there are most probably more options I’m not aware of



This blog is not aimed to make a comparison between all the tools but will go further on the option to measure user statistics via SAP Web Analytics. This seems the strategic direction of SAP for web analytics functionality and will be integrated in S/4HANA Cloud and other SAP solutions.  So you can expect more features to become available via this SCP service.

To try it out you can subscribe to a SCP trail account and use SAP Web Analytics with a static website.  This is described step by step in the following document: https://developers.sap.com/mission.cp-web-analytics-get-started.html

After you got this working, the next step would be start measuring the usage data of the SAP Fiori launchpad and apps on your S/4HANA system.

UPDATE 21/04/2021: customers on S/4HANA 2020 or with FES 2020  or higher do not need to create an FLP plugin anymore, it is included in standard in who have SAPUI5 1.78.  See new blog from my colleague Rashmi https://blogs.sap.com/2021/02/18/sap-web-analytics-analytics-solution-for-s4-on-premise-systems/

Customers on S/4HANA 1909 or lower releases create a custom FLP plugin which is started each time users open the SAP Fiori launchpad or apps.  Using SAP WebIDE (or the new Business Application Studio) you can create such a plugin via a template and deploy it on your S/4HANA system.  This was already described in detail with a demo video in the openSAP course “Key Technical Topics in a System Conversion to SAP S/4HANA”, section Week 3, Unit 7: Extensibility Use Cases: SAP Fiori Launchpad.   There is a lot more of interesting content in this openSAP Course, so if you have not yet followed this course, I can really recommend to subscribe to it!  Note again that this custom FLP plugin is not needed anymore with S/4HANA or FES 2020 (and SAPUI5 versions 1.78.x) or higher.

Before you deploy, the FLP plugin will have to be modified to send data to the SAP Web Analytics.  For this you have to replace the Component.js with the following code:

/*!

 * ${copyright}

 */

sap.ui.define([

	"sap/ui/core/Component"

], function(Component) {

	"use strict";



	var SWAComponent = Component.extend("com.sap.rig.wa.Component", {



		metadata: {

			manifest: "json"

		},

        /*global window, sap , document*/

		// Init function called on initialization

		init: function () {

			var oPluginParameters = this.getComponentData().config; // obtain plugin parameters

			var SWA_PUB_TOKEN = "", TRACKING_URL = "", USR = "";

			//Read the variables and pass them

			SWA_PUB_TOKEN = oPluginParameters.SWA_PUB_TOKEN;

			TRACKING_URL = oPluginParameters.SWA_BASE_URL;

			//USR = oPluginParameters.SWA_OWNER;

			USR = sap.ushell.Container.getUser().getEmail();

			this.loadSWAObject(SWA_PUB_TOKEN, TRACKING_URL, true, USR);

			this.loadWebGUI();

		},



		// create SWA object and load track.js

		loadSWAObject: function(SWA_PUB_TOKEN, TRACKING_URL, LOGGING, usr) {

			window.swa = {

				pubToken: SWA_PUB_TOKEN,

				baseUrl: TRACKING_URL,

				loggingEnabled: LOGGING,

				subSiteId: this.setSubSiteId,

				owner: usr

			};



			var d = document, g = d.createElement("script"), s = d.getElementsByTagName("script")[0];

			g.type = "text/javascript";

			g.defer = true;

			g.async = true;

			g.src=window.swa.baseUrl + "js/track.js";

			s.parentNode.insertBefore(g, s);

			if ((typeof sap !== "undefined" && typeof sap.ui !== "undefined") && sap.ui.version < "1.65.0") {

				window.onhashchange = function () {

					window.swa.trackLoad();

				};

			}

		},



		/*Method which listens to web gui announce event and then send the postmessage with baseurl,pubtoken and type as request*/

		loadWebGUI: function () {

			if (window.addEventListener) {

				window.addEventListener("message", function (e) {

					var guiresponse = JSON.parse(e.data);

					if (guiresponse.service === "sap.its.readyToListen" && guiresponse.type === "announce") {

						var swaCookies = escape(window.parent.document.cookie);                         

                   var body = {

                   "type": "request",

                   "service": "sap.its.trackSWA",

                   "pubToken":window.swa.pubToken,

                   "baseUrl":window.swa.baseUrl,

                   "message":"Response from SWA",

                   "isConsentGiven":true,

                   "cookieVal": swaCookies

                   };

						//post the message with pub token and base url

						e.source.postMessage(JSON.stringify(body), e.origin);

					}

				});

			}

		},



		

		

		//Set the subsiteid as each FLP tile where a system acts as a site

		setSubSiteId: function() {

			var subSite = "";



			if (window.location.href.substring(window.location.href.indexOf("#")) !== -1) {

				subSite = window.location.href.substring(window.location.href.indexOf("#") + 1);

			}

			if (subSite.indexOf("&") !== -1) {

				subSite = subSite.substring(0, subSite.indexOf("&"));

			}



			return (subSite !== "") ? subSite : undefined;

		}



	});



	return SWAComponent;



});


Now deploy and activate the FLP plugin to the S/4HANA system as shown in the openSAP video.

You can check if your plugin is successfully deployed, activated and loaded when starting the FLP using your browser developers tools.  Search in the network tab on the technical name of the plugin and you should find it back in the results:


Next step is to configure the plugin to send data to the SAP Web Analytics service. Retrieve the pubToken and baseUrl from your SAP Web Analytics admin cockpit.  Similar as in the tutorial for the static website in the tutorial you have to create a new site for the ABAP FLP.  Then in Site Management, click the Tracking Snippet, here you can find the 2 parameters:


 

In transaction /UI2/FLP_CONF_DEF you have to create an entry for the the FLP Plugin and add the 2 parameters: SWA_BASE_URL and SWA_PUB_TOKEN as string parameters. The UI5 Component ID has to corresponding with the one defined in the FLP plugin (JavaScript).

 


These 2 values you can configure in the transaction /UI2/FLP_CUS_CONF:


If everything is configured correctly, you should now see entries for your users in the SAP Web Analytics page:


You can also create a custom Dashboard to show FLP specifics like App Usage, List Users, App Usage Time.


In order to show this, you can build a Custom Dashboard with your own reports.  You can see how these are created below.

App Usage:


App Usage Time :


List Users:


 

Hope this blog helps you to try out and setup this up in your S/4HANA on-premise landscape.

 

 Becoming a SAP Fiori for SAP S/4HANA guru


You’ll find much more on our SAP Fiori for SAP S/4HANA wiki

Brought to you by the S/4HANA RIG

 

10 Comments