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!