sapdev logo background
sapdev logo sapdev logo
Comments

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.



comments powered by Disqus