Skip to Content

     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.

Requirement:

     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:

/wp-content/uploads/2014/03/timeout_406882.png

     In transaction SICF both short dumps and session timeouts are treated as application errors:

/wp-content/uploads/2014/03/sicf_406884.png

     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.

     The explicit page can be written in HTML+CSS, but a major issue is that it completely ignores JavaScript. This means, you cannot test the error type and switch between different responses.

  

Solutions:

     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).

BSP.png

     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)

/wp-content/uploads/2014/03/wdr_406888.png

     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.

method handle.

  data:
    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 sysubrc is initial.
       
translate lv_service to upper case.

        select single service_name active
                            
from ytpf_t_appl_list
                            
into corresponding fields of ls_appl
                            
where service_name eq lv_service
                                
and active       eq abap_true.

        if sysubrc is initial.
          ls_page
body = `2C768A4E40741EE3A7A55C5708059340` “SOTR automatically generated GUID

          ir_server->set_page(
           
exporting
              response_page_type   
= ir_server->co_page_error_type
              response_option_page
= ls_page
           
exceptions
              invalid_parameter       
= 1
              document_not_found  
= 2
             
others                           = 3 ).

        endif.
     
endif.
   
endif.
 
endif.

endmethod.

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!

Tudor

To report this post you need to login first.

15 Comments

You must be Logged on to comment or reply to a post.

  1. Andi Masanam

    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??

    (0) 
    1. Tudor Riscutia Post author

      Hello Andi,

      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….

      Tudor

      (0) 
    1. Tudor Riscutia Post author

      Yes, you can do this with a simple JavaScript line: window.close( );

      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.

      Good luck!

      Tudor

      (0) 
      1. Ashish Singhal

        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.

        (0) 
        1. Tudor Riscutia Post author

          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?

          (0) 
          1. Ashish Singhal

            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.

            (0) 
            1. Tudor Riscutia Post author

              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…

              (0) 
    1. Tudor Riscutia Post author

      Hello Seid,

      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.

      (0) 

Leave a Reply