Custom timeout page for Web Dynpro applications
Sometimes, users tend to open a lot of WD applications in multiple tabs. After some time (depending on SAP Basis configuration) the session is automatically closed by the application server (Web AS), which will result in a timeout. From a user’s perspective this is confusing.
Create a timeout page for system idles. The standard SAP response is:
Instead, the system should return a custom (company-specific) page with both F5 (Refresh) functionality and a big “Refresh” button. For example:
In transaction SICF both short dumps and session timeouts are treated as application errors:
If you choose to implement an explicit response page, this will be shown for all kinds of application errors. But we don’t want that, we only want to see a custom page for timeouts.
After trying multiple alternative, like redirecting to another URL and test the system tag <%=MESSAGE%>, I’ve found a working solution which is actually quite simple (Occam’s razor states: “The simplest answer is usually the right one”):
1. Create the .html page in any suitable program (Notepad++, or even a BSP application if you want to have the code available inside the system).
2. You need to copy-paste the code inside an OTR long text using transaction SOTR_EDIT. (This is how the explicit pages are created in SICF)
3. You’ll have to create a modification in the core WD class CL_WDR_CLIENT_ABSTRACT_HTTP for method PREPROCESS_REQUEST. (This cannot be enhanced as you need access to instance attributes which is not possible inside pre-/post exits, so you’ll need an access key)
Here, instead of writing the code directly, I chose to call a static method in a customer class. Also, I do this because I don’t want to use this timeout page in all applications. I’ve created a customizing table where I store the WD application name and a flag for ‘Active’, for all applications that should use this functionality.
lr_server type ref to cl_http_server,
lt_path type string_table,
ls_appl type ytpf_t_appl_list, “#EC NEEDED
ls_page type icf_response_page,
lv_index type i,
lv_service type string.
lr_server ?= ir_server.
if lr_server is bound.
“cl_wdr_task=>application->name can NOT be used here, as the instance is already destroyed…
split lr_server->m_runtime_memory_id at `/` into table lt_path.
if not lt_path is initial.
describe table lt_path lines lv_index.
read table lt_path into lv_service index lv_index. refresh lt_path.
if sy–subrc is initial.
translate lv_service to upper case.
select single service_name active
into corresponding fields of ls_appl
where service_name eq lv_service
and active eq abap_true.
if sy–subrc is initial.
ls_page–body = `2C768A4E40741EE3A7A55C5708059340` “SOTR automatically generated GUID
response_page_type = ir_server->co_page_error_type
response_option_page = ls_page
invalid_parameter = 1
document_not_found = 2
others = 3 ).
At runtime, if the application error type is a session timeout the explicit page is replaced with the custom page stored in the OTR long text.
This works both in IE and NWBC.
I’ve also started a discussion some time ago: Custom timeout page in SICF
Give it a shot and provide some feedback!
Is there a way to avoid this timeout issue, for example popup a message when it is about to hit the timeout to indicate the user it is going to be crashed soon, do refresh or something??
You can ask the SAP Basis guys to change the maximum idle time on your system. Instead of 30 min to 12 hours (or the maximum one person will stay at work 🙂 )
But you should know this is not healthy for the system, as all those work processes will remain active together....
Thanks Tudor, yeah that is one option, but that is not the best option with memory usage and lot of active work processes.
Thanks Tudor. Is there any way to close the browser window after timeout? Chaitanya.
Wouldn't that lead to a lot of user confusion? ("Where is the page I was working on???")
The only problem is you cannot directly write the JS code inside the timeout page, because it will completely be ignored by the SICF. On the other hand, you can redirect to another URL (perhaps a BSP application) where you can just put the statement above.
I haven't actually tested this, since it doesn't sound like a valid requirement. But if you really have to do this, please try it and return with some feedback.
Better is to use a timed trigger UI element and put the time lapse as 30 mins. This will ensure that the application will refresh itself after 30 mins and the auto time out will not happen.
In the event handler of this UI element, you can simply refresh the application.
Sure it is, but will you do an enhancement on all standard WD applications to add your Timer? And if you do this, and a user leaves his PC opened with whatever (e.g. a Material) locked in change mode. What happens then?
Isn't enhancement always a better choice rather than modification, given the fact that you need to explicitly take care of them during system upgrade and also not supported by SAP.
There are specific ways to determine if the application timeout has occurred and in that event you can redirect the user to custom page, rather than doing something with the SICF service and changing the standard class.
There are better solutions out there.
I don't get it... the modification we're talking about, you only have to do it once (Singular). While enhancing every WD application is much more time consuming...
Thanks for your information Tudor. After custom timed out action get triggered I have used FPM events to close the Web Dynpro ABAP Application . Regards, Chaitanya.
Can you share some mo reinfo on the FPM event you used? Any how-to docs/helpful info on that?
The idea here is to switch the standard timeout page for any Web Dynpro application (with the example filter described above), which means it also works for FPM, as FPM is built on top of Web Dynpro.
Anyhow, by the time the above code is processed, all FPM instances are destroyed by the garbage collector, so it is already to late to save data (temporary save perhaps) or to perform any other application-relevant function.
That's brilliant! 😀