Application Development and Automation 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: 
Read only

How to create timed out error

Former Member
0 Likes
699

Hi All,

I want to create a timed out error as I need it for testing some code.

I am using "Wait" statement to make it wait more than the set run time, but its not working.

Can some one give me a code snippet to create timed out error.

Thanks and Regards

Ankit.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
684

hi,

take a two variables of type sy-uzeit.

at the beginning of the program..

v_starttime = sy-uzeit.

loop at itab.

v_difference = sy-uzieit - v_starttime.

if v_difference > 100.

raise execption TIMED_OUT.

endif.

endloop..

THANKS

Mahesh

Hi All,

I want to create a timed out error as I need it for testing some code.

I am using "Wait" statement to make it wait more than the set run time, but its not working.

Can some one give me a code snippet to create timed out error.

Thanks and Regards

Ankit.

4 REPLIES 4
Read only

Former Member
0 Likes
685

hi,

take a two variables of type sy-uzeit.

at the beginning of the program..

v_starttime = sy-uzeit.

loop at itab.

v_difference = sy-uzieit - v_starttime.

if v_difference > 100.

raise execption TIMED_OUT.

endif.

endloop..

THANKS

Mahesh

Read only

Former Member
0 Likes
684

If you want a program to keep running until the max runtime parameter is reached you could try;

WHILE 1 = 1.

ENDWHILE.

Read only

Former Member
0 Likes
684

check below..


DATA:  sec TYPE i,
       temp TYPE t.
sec = 0.

start-of-selection.

temp = sy-uzeit.

WAIT UP TO 10 SECONDS.

WHILE sec LT 11.

  sec = sy-uzeit - temp.

  IF sec GE 10.

    MESSAGE 'Time out' TYPE 'E'.
  ENDIF.

ENDWHILE.

It gives time out for 11 secs..

If useful .. reward points...

Regards

Prax

Read only

0 Likes
684

Thanks