Pages

Buy

Buy

Extend allowed runtime of a program

When you create a report or transaction that handles a lot of data with multiple selects and functions that are doing some manipulation of the data, or you have to call in this report a function module thousand times and you want to be sure that no matter how long it takes it should be done but your system administrators have put some restrictions for time limit then you have to use one of this methods:
  1. Call commit work whenever you want to reset the counter of running time for your transaction (especially if you haven't done any update into database tables)
  2. If commit work doesn't work or you don't want to use it at the moment then you could use FM TH_REDISPATCH with the check_runtime parameter equal to 0.
  3. You could also you FM SAPGUI_PROGRESS_INDICATOR for the same purpose but keep in mind that showing indicator too often can slower your program.
Both of the methods will make that the counter for application runtime will be reset, but be careful this can make you application run really long. Also if you got one select statement which takes more than maximum runtime for your system then it will not help so you have to prepare your coding to be able to use any of this method, like spliting the selects statements to parts or to select single in the loop.
 
Although it's nice to know this possibility my advice is to not to use it very often as the less time you have for program run the more optimized code you can provide, so it's really something that you use if you do not have other choice and you agreed that with your system admins.

Examples: (run the program and look into SM50 to see the runtime)
 
 
report  zab_reset_runtime.

  data: gt_vbak type standard table of vbak.
  do.
    select
  * up to 1000 rows from vbak
      into corresponding fields of table gt_vbak.
    call function 'SAPGUI_PROGRESS_INDICATOR'
     exporting
*       PERCENTAGE       = 0
       text             = sy-index
              .
    if sy-index eq 1000.
      exit.
    endif.
  enddo.


  "or
  do.
    select
 
 * up to
1000 rows from vbak
      into corresponding fields of table gt_vbak.
    commit work.
    if
 sy-index eq
1000.
      exit.
    endif.
  enddo.


  "or
  do.
    select
  * up to
1000 rows from vbak
      into corresponding fields of table gt_vbak.
    call function 'TH_REDISPATCH'
      exporting
        check_runtime = 0.

    if sy-index eq
1000.
      exit.
    endif.
  enddo.

1 comment: