‎2007 Jun 20 9:32 PM
Hi,
I wrote the code as below, when i was debugging everthing is working fine but when i was executing directly, the cursor is not coming out. can you please suggest me the alternative.
code is
data: gv_delay type i value 10,
gv_time_end type sy-uzeit.
gv_time_end = sy-uzeit + gv_delay.
while sy-uzeit le gv_time_end.
write: /10 sy-uzeit.
endwhile.
do.
if sy-uzeit > gv_time_end.
exit.
endif.
write: /20 sy-uzeit.
enddo.
write: /10 'Something'.
regards,
Jaya
‎2007 Jun 20 9:35 PM
Try:
do.
get time
if sy-uzeit > gv_time_end.
exit.
endif.
write: /20 sy-uzeit.
enddo.
Rob
‎2007 Jun 20 9:35 PM
Try:
do.
get time
if sy-uzeit > gv_time_end.
exit.
endif.
write: /20 sy-uzeit.
enddo.
Rob
‎2007 Jun 20 9:41 PM
Hi Rob,
Its really wonderful, i will surely reward points. But can you please let me know what exactly the problem in my code & what is happening when we use <b>get time.</b>
Thanks
jaya
‎2007 Jun 20 9:44 PM
Get Time is basically updating the following fields:
sy-datlo, sy-datum, sy-timlo, sy-uzeit, and sy-zonlo to the current value.
Without the command Get Time you are using the same value for sy-uzeit for every iteration through the loop.
Message was edited by:
Davis
‎2007 Jun 20 9:46 PM
You would think that sy-uzeit would always contain the current time, but it doesn't. According to the documentation, GET TIME:
Sets the system field SY-UZEIT to the current time and resets SY-DATUM. Also refreshes the SY fields for the local time zone, i.e. SY-TIMLO, SY-DATLO and SY-ZONLO.
Rob
‎2007 Jun 20 9:49 PM
Rob, when I first opened this thread I assumed that it did contain the current time. I was quite surprised to find out (through debug) that it didn't. This could be valuable information in the future.
Regards,
Davis
‎2007 Jun 20 10:04 PM
The question is why it worked in debug mode at all.
Things like COMMITs will also reset sy-uzeit and I guess also executing a command in the debugger.
Rob
‎2007 Jun 20 9:42 PM
You need to get the time inside your loop. Otherwise you are working with the same time and will create an infinite loop.
Regards,
Davis
EDIT: Sorry, I did not see that Rob already responded with the correct code.
Message was edited by:
Davis
‎2007 Jun 20 9:44 PM
Hi Rob & David,
Both are really unsful to me so i rewarded both of you...
regards
jaya