There are some legitimate cases where you may want to wait a short while in your program for something to happen. One thing I use a wait on is when I have a program running and it encounters a lock. This is ok when you are displaying a single record – you just tell the user that it’s locked. However, if you are compiling an editable ALV grid for example you don’t want to stop them editing some records because one is locked.
What I do is wat a second or so, and try again. If the record is still locked I wait a little longer, before after a certain number of times giving up and continuing on with the next record, flagging the failed record as not locked.
But when you wait are you polite or do you still hog the work process ??
Instead of using the ‘WAIT’ statement use the ‘ENQUE_SLEEP function module. The function module releases the work process for another task to use. The WAIT does not….