Skip to Content
Author's profile photo Former Member

Session Time out warning message on UI

Sometimes one may get a requirement such as to produce a pop-up message on UI 5 minutes from timeout, so as to intimate the user to perform some activity to avoid session timeout.

Now the challenge here is that in order to trigger a pop-up there has to be an event. In the absence of any event trigger, this becomes a challenge to perform this using only ABAP.

It can be done using the combination of Javascript and ABAP code. One can enhance the component ‘CRM_UI_FRAME’ and the view ‘WorkareaViewset’. In the HTML page of the view, one can write the following code.

<script type=“text/javascript”>
var c=4200;                             <%–   session time out pop up time    –%>
var t;
var timer_is_on=0;

thtmlbRegisterOnLoad(doTimer);

function timedCount()
{
<%–document.getElementById(‘txt’).value=c;–%>
c=c-1;
if (c ==
‘0’)
{
alert(
“Your session will time out in 5 minutes”) ;
}

t=setTimeout(“timedCount()”,1000);

}

function doTimer()
{
c = 4200;                   <%–   session time out pop up time      –%>
if (!timer_is_on)
{
timer_is_on=
1;
timedCount();
}
}

</script>

Here, the variable ‘c’ contains the value of the session timeout popup in seconds. Now, this value can be caught from the system constant for session time out time. The code above is quite simple but the point to be noted here is the call to ‘thtmlbRegisterOnLoad’. This resets the counter on any user action. Since, all of the UI content is placed in Iframes so resetting the counter on ‘bodyonload’ works only the first time the page is loaded.

How I found out the ‘thtmlbRegisterOnLoad’ event : View->source of the page and then searched for any ‘load’ keyword.

This was my first blog. I hope consultants will find it helpful. In my next blog I’ll describe how to launch a GUI transaction on UI , on a custom button click.

Assigned Tags

      11 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Very different concept.

      Regards,

      Kavya

      Author's profile photo Former Member
      Former Member

      Greetings Nitin Gupta,

      Thanks for sharing 🙂 Great work 🙂

      Cheers,

      Savaridasan

      Author's profile photo Former Member
      Former Member

      Hi Nitin Gupta,

      Great Job, Really nice concept, I appreciated.

      Regards,

      Vishal

      Author's profile photo Former Member
      Former Member

      Helpful Blog Nitin.

      Regards,

      Amrit

      Author's profile photo Former Member
      Former Member

      Thumbs up, is testing fine in our dev system.  Will make the users happy.  They will be typing in notes & taking phones calls and get lost on time, lots of complaints when the system times out as typing in notes doesn't re-set the clock.

      Author's profile photo Former Member
      Former Member

      Great post thanks Nitin!!

      When I tested in sandbox,the popup appeared for the first timeout only.To make it appear again i need to log off and log in again.

      Is that something I am missing in your code or any additional logic have to be implemented for that feature?

      Your response is much appreciated!!!

      Author's profile photo Sar CRM
      Sar CRM

      Hi Mukesh,

      I am facing the similar Issue..is there any solution for this.

      Thanks,

      SAR CRM.

      Author's profile photo Jean-Yves Guyomarc'h
      Jean-Yves Guyomarc'h

      Hi Sara,

      There is now a standard feature that covers this topic. See Note 2092893, it adds an optional timeout countdown in the CRM header and also a popup that will warn the user a few minutes before his session times out.

      Regards,

      Jean-Yves Guyomarc'h

      Author's profile photo Sar CRM
      Sar CRM

      Hi Jean-Yves Guyomarc'h,

      Unfortunately..I cannot implement this oss note as it's related to higer versions of CRM..ours is 7.0 EHP1..

      Thanks,

      Sara.

      Author's profile photo Sigrid Wieshofer
      Sigrid Wieshofer

      Hi Sara,

      If you use a CRM Interaction Center business role, SAP Note 1877120 CRM-IC: session timeout issue with CRM 7 EHP1 and higher might be interesting for you.

      Best Regards,

      Sigrid

      Author's profile photo Sar CRM
      Sar CRM

      Sigrid,

      I already explored OSS note 1877120..this works only for IC with multi session..but we need user time out popup for all the roles..we are going with custom coding approach to achieve this.