Kishore Thutaram
SAP Solution Architect | 16+ Years' Experience in SAP | Sharing Practical SAP Knowledge | Engineering Graduate with Expertise in SAP Architecture
https://fiowelt.comRequirement: If the output session is idle for a specific time without any user intervention, set the timeout and raise a message pop-up to make a forcible refresh.
File: Controller.js
Implement the code below.
onInit: function () {
var osetTime;
var oPromise = new Promise(function (res, rej) {
this.getOwnerComponent().getModel().read("/TIMESet", {
//if we define the time at backend dynamically
success: function (data) {
osetTime = data.results[0].Time * 1000;
res();
},
error: function (err) {
osetTime = "300000";
rej();
}
});
}.bind(this));
oPromise.then(function (val) {
var timer;
function timeOut() {
clearTimeout(timer);
timer = setTimeout(function () {
MessageBox.show(
"Click OK to Refresh", {
icon: MessageBox.Icon.Error,
title: "Session Timeout",
onClose: function (sAction) {
location.reload(); // eslint-disable-line sap-no-location-reload
}
}
);
}, osetTime);
}
document.onmousemove = timeOut;
});
}
SAP Solution Architect | 16+ Years' Experience in SAP | Sharing Practical SAP Knowledge | Engineering Graduate with Expertise in SAP Architecture
https://fiowelt.com