To continue reading for free, register below or login
To read more you must become a member of SearchSAP.com
');
// -->

I don't know if there's a way to check the remaining resources. Virtually, the memory is unlimited; when it runs short of memory, this simply means that the allocated disk space is exhausted. Making them much bigger in the SAP Instance Config will cure this.
As for the timeout: I have below a small program that works as a "screensaver" that regularly refreshes the screen automatically. This will do the job for you. I hope that it is clear enough to help you understand the concept.
REPORT zz_screen_saver NO STANDARD PAGE HEADING.
This program displays a list on a screen and refreshes it once a second. The list shows the status of the dispatcher queue: The number of jobs waiting for the different services at the moment. The remote callable function module should look like this:
DATA: BEGIN OF itab OCCURS 5.
INCLUDE STRUCTURE thlines.
DATA: END OF itab.
DATA i TYPE i VALUE 99.
DATA j TYPE i VALUE 99.
* Run the async. function module the first time
START-OF-SELECTION.
SET BLANK LINES ON.
CALL FUNCTION 'SPTA_RFC_PING_AND_WAIT'
STARTING NEW TASK 'WAIT'
PERFORMING when_finished ON END OF TASK
EXPORTING
seconds = 1.
WRITE: ''.
* Run the async. function module and display the freshest data
AT USER-COMMAND.
ADD 3 TO i.
IF i > 70. i = 1. ENDIF.
ADD 1 TO j.
IF j > 6 . j = 1. ENDIF.
sy-lsind = 1.
FORMAT COLOR = j.
DO 40 TIMES.
WRITE (132) ' '.
ENDDO.
SKIP TO LINE 15.
ADD 1 TO j.
WRITE AT /i ' ' COLOR = j.
WRITE AT /i ' Hello I''m still running ' COLOR = j.
WRITE AT /i ' ' COLOR = j.
CALL FUNCTION 'SPTA_RFC_PING_AND_WAIT'
STARTING NEW TASK 'INFO'
PERFORMING when_finished ON END OF TASK
EXPORTING
seconds = 1.
* When the async. function module finished, this form will be called
FORM when_finished USING taskname.
RECEIVE RESULTS FROM FUNCTION 'Y_ENQUE_SLEEP'.
* Trigger an event to run the at user-command
SET USER-COMMAND 'BUMM'.
ENDFORM. "when_finished
|