Skip to Content
Technical Articles

Disabling the Fiori Launchpad timeout in SAP Cloud Platform Portal

After 20-minutes of inactivity, the Fiori Launchpad session is timed out by default, disconnecting all oData services and requiring a refresh to proceed, not ideal if your end-user is in the middle of data entry, etc.

At the moment, disabling the timeout is only achievable through what’s called a Shell Plugin app, which is a SAPUI5 app that runs in the background of the Launchpad.

The official online guide will get you partway there, but there are some vital omissions…

 

Here’s my template below, simply copy this in place of the generated Component.js file.

<namespace> on the guide is launchpad.timeout.launchpadtimeout or <namespace>.<app name>

I’ve reconfigured the <URL> in the guide to work for all your SAP Cloud Platform Sub-Accounts (e.g. Dev, Test, and Prod).

sap.ui.define([
	"sap/ui/core/UIComponent",
	"sap/ui/Device",
	"launchpad/timeout/launchpadtimeout/model/models"
], function (UIComponent, Device, models) {
	"use strict";

	return UIComponent.extend("launchpad.timeout.launchpadtimeout.Component", {

		metadata: {
			manifest: "json"
		},

		/**
		 * The component is initialized by UI5 automatically during the startup of the app and calls the init method once.
		 * @public
		 * @override
		 */
		init: function () {
			// call the base component's init function
			UIComponent.prototype.init.apply(this, arguments);

			// enable routing
			this.getRouter().initialize();

			// set the device model
			this.setModel(models.createDeviceModel(), "device");

			// make a request to the server every 15 minutes
			setInterval(function () {
				//Get the SAP Cloud Platform Sub-Account
				var href = $(this).attr('origin');
				var split1 = href.split("-"); // split by - 
				var secondSubString = split1[1]; // all characters AFTER the first -
				var split2 = secondSubString.split("."); // split by . 
				var subAccount = split2[0]; // all characters BEFORE the first .
				
				jQuery.ajax({
					type: "HEAD",
					cache: false,
					crossDomain: true,
					uri: "https://flpnwc-" + subAccount + ".dispatcher.hana.ondemand.com/sap/fiori/launchpadtimeout/Component-preload.js"
				}).done(
					function (result) {
						jQuery.sap.log.debug("pingServer", "Successfully pinged the server to extend the session");
					}
				).fail(
					function () {
						jQuery.sap.log.error("pingServer", "failed to ping the server to extend the session");
					}
				);
			}, 900000); //15 minutes
		}
	});
});

 

 

Apart from the above, follow the official guide and the app should fire every 15 minutes, disabling the timeout!

I hope you found this blog post useful!

 

 

 

Be the first to leave a comment
You must be Logged on to comment or reply to a post.