CRM and CX Blogs by Members
Find insights on SAP customer relationship management and customer experience products in blog posts from community members. Post your own perspective today!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member


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.

11 Comments