Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Timer function in ABAP

Former Member
0 Kudos

Hello,

I have requirement to cancel execution of a function module if it exceeds 10 Sec. How do i do this in ABAP.

This FM is sending data through XI and waiting on confirmation from a external system through XI. But the requirement is to wait only for 10 sec and if no response continue the process after the FM.

Any help in this highly appreciated.

Thanks!!

Harprit

1 ACCEPTED SOLUTION

vinod_gunaware2
Active Contributor
0 Kudos

<b>GET_JOB_RUNTIME_INFO</b> Get the current job number from a program. Also returns other useful info about the current job.

<b>ENQUE_SLEEP</b> Wait a specified period of time before continuing processing.

<b>ENQUEUE_ESFUNCTION</b> Lock an abap program so that it cannot be executed.

Set the parameters as follows:

RELID = 'ZZ'

SRTF2 = 0

SRTF = (your report name)

Please note that you should not use SY-REPID to pass your report name to the function. The value of SY-REPID will change as it is being passed to the function module, and will no longer hold the value of the calling report.

regards

vinod

5 REPLIES 5

suresh_datti
Active Contributor
0 Kudos

Have you tried the following statement ?

WAIT up to 10 seconds.

Regards,

Suresh Datti

ferry_lianto
Active Contributor
0 Kudos

Hi Harprit,

You can use this FM <b>SWE_CD_TST_DELAY</b>.


CALL FUNCTION 'SWE_CD_TST_DELAY'
  EXPORTING
    DELAY = '10'.

Hope this will help.

Regards,

Ferry Lianto

Former Member
0 Kudos

Hi harprit,

1. as soon as we call the FM,

the program won't return

until it is finished (or some error has occurred)

2. So our abap code of

checking for 10 seconds / waiting for 10 seconds

/ any time code

won't get executed

(as we desire)

3. It may get exected only after the FM returns.

4. I don't think there is any direct way

of achieving the requirement.

regards,

amit m.

vinod_gunaware2
Active Contributor
0 Kudos

<b>GET_JOB_RUNTIME_INFO</b> Get the current job number from a program. Also returns other useful info about the current job.

<b>ENQUE_SLEEP</b> Wait a specified period of time before continuing processing.

<b>ENQUEUE_ESFUNCTION</b> Lock an abap program so that it cannot be executed.

Set the parameters as follows:

RELID = 'ZZ'

SRTF2 = 0

SRTF = (your report name)

Please note that you should not use SY-REPID to pass your report name to the function. The value of SY-REPID will change as it is being passed to the function module, and will no longer hold the value of the calling report.

regards

vinod

abdul_hakim
Active Contributor
0 Kudos

hi harprit

the control returns to the program once the fm got executed so you cannot set a time and skip from fm.

Cheers,

Abdul Hakim