Prevent ABAP report timeout by Reseting the SAP runtime value using TH_REDISPATCH

You used to be able to achieve this by implementing the progress indicator as it not only added a timer or % complete icon to your report but also reset the reports runtime value back to 0. The runtime value stores how long the report has been running for, therefore if this is constantly reset to 0 it would never reach the maximum runtime length and timeout. The progress indicator seems to have changed in later versions of SAP and no-longer prevents a timeout.

An alternative way to prevent a timeout is to implement function module(TH_REDISPATCH) at the point where you want to reset the runtime value.

  CALL FUNCTION 'TH_REDISPATCH'
*   EXPORTING
*     CHECK_RUNTIME       = 0
            .

This could be at the same place you display a progress indicator. You could even implement an enhancement point at the end of the progress indicator function module(SAPGUI_PROGRESS_INDICATOR) to call TH_REDISPATCH. This would mean any call to the progress indicator function would once again reset the runtime value and help prevent a timeout as it did in previous versions.

Example ABAP program to demonstrate
The following example selects 1000 records from the EKKO table and loops around these displaying a progress message 'Purchase order nnnnnnnn' for each one. During each loop pass it executes function module TH_REDISPATCH to reset the runtime value. This means that irrespective of how long this report runs for it will not reach the runtime limit and timeout.


*&*******************************************************
*& DESCRIPTION: Reset runtime value to stop timeout
*&*******************************************************
REPORT  zstop_timeout.
TYPES: BEGIN OF t_ekko,
         ebeln LIKE ekko-ebeln,
       END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
      wa_ekko TYPE t_ekko.
DATA: gd_outtext(70) type c.
*********************************************************
*START-OF-SELECTION.
START-OF-SELECTION.
  SELECT ebeln
   UP TO 1000 ROWS
    INTO TABLE it_ekko
    FROM ekko.
  CHECK sy-subrc EQ 0.
  LOOP AT it_ekko INTO wa_ekko.
    concatenate 'Processing purchase order' wa_ekko-ebeln into gd_outtext
            separated by ' '.
  CALL FUNCTION 'TH_REDISPATCH'
*   EXPORTING
*     CHECK_RUNTIME       = 0
            .
*   Display indicator for ebeln count
    perform progress_indicator using gd_outtext.
  ENDLOOP.
  WRITE: /20 'Report "Complete" '.
*&---------------------------------------------------------------------*
*&      Form  PROGRESS_INDICATOR
*&---------------------------------------------------------------------*
*       Displays progress indicator on ABAP report
*----------------------------------------------------------------------*
form progress_indicator using p_text.
  call function 'SAPGUI_PROGRESS_INDICATOR'
      exporting
*         PERCENTAGE = 0
           text       = p_text.
endform.

Related Articles

SAP ALV Reports - ABAP or Advanced List Viewer reports
ALV grid reports using the object methods functionality
ALV TREE Example ABAP code and information for creating ALV tree based reports
SAP Dynamic documents in ABAP objects
SAP dynamic document example screens
ABAP report Progress indicator - When added also Stops report timeout
SAP progress indicator bar to count number of records processed within ABAP report and stop timeout
SAP percentage complete progress indicator bar for your ABAP reports
ABAP Reporting - Example code and information on various areas of ABAP reporting
ABAP Automatic refresh report to retrieve real time live data from SAP database
Automatic Refresh Report - periodically refreshes results
Capture ABAP report using WRITE statement to internal table with SAP
Write report straight to printer
Convert Spool request to PDF and send as e-mail
Convert Spool request to PDF and send as e-mail
Execute ABAP Report using the SUBMIT statement
ABAP report to display all the selection screen fields and any values input by the user