REPORT ZIMREEEE NO STANDARD PAGE HEADING.
************************************************************************
* This program displays a list on a screen and refreshes it once in every
* second. The list shows the status of the dispatcher queues:
* the number of jobs waiting for the different services at the moment.
* The remote callable function module should look like this:
*
*FUNCTION Z_ENQUE_SLEEP.
**"-----------------------------
**"*"Local interface:
**"-----------------------------
*CALL FUNCTION 'ENQUE_SLEEP'
*          EXPORTING
*           SECONDS = 1.
*ENDFUNCTION.
************************************************************************
DATA: BEGIN OF ITAB OCCURS 5.
        INCLUDE STRUCTURE THLINES.
DATA: END OF ITAB.
* Run the async. function module the first time
START-OF-SELECTION.
  CALL FUNCTION 'Z_ENQUE_SLEEP'
       STARTING NEW TASK 'WAIT'
       PERFORMING WHEN_FINISHED ON END OF TASK.
  WRITE: ''.
* Run the async. function module and display the freshest data
AT USER-COMMAND.
  SY-LSIND = SY-LSIND - 1.
  CALL FUNCTION 'TH_REQUEST_QUEUE'
       TABLES
            REQUEST_QUEUES = ITAB.
WRITE: 9
'TYPE         WAITING    MAXINQ     QSIZE  SUMWRITETOQ  SUMREADFROMQ'.
SKIP.
  LOOP AT ITAB.
    WRITE:  / ITAB.
  ENDLOOP.
  CALL FUNCTION 'Z_ENQUE_SLEEP'
       STARTING NEW TASK 'INFO'
       PERFORMING WHEN_FINISHED ON END OF TASK.
* When the async. function module finished, this form will be called
FORM WHEN_FINISHED USING TASKNAME.
  RECEIVE RESULTS FROM FUNCTION 'Z_ENQUE_SLEEP'.
* Trigger an event to run the at user-command
  SET USER-COMMAND 'BUMM'.
ENDFORM.