‎2008 May 29 12:31 PM
hi friends ,
my friend had written this code .in this he has used do and endo statement.
here w_week contains value = 3 during runtime.
but he is internally clearing that value .eventhough report is working fine .
i couldn't understand .please if u know update me on this.
regards,]
diana
DO w_week TIMES.
IF so_date-low IS NOT INITIAL.
CLEAR: wa_weektable, w_week.
CALL FUNCTION 'GET_WEEK_INFO_BASED_ON_DATE'
EXPORTING
date = so_date-low
IMPORTING
week = wa_weektable-week
monday = wa_weektable-monday
sunday = wa_weektable-sunday.
wa_weektable-wday = so_date-low.
APPEND wa_weektable TO it_weektable.
CLEAR wa_weektable.
so_date-low = so_date-low + 1.
ENDIF.
ENDDO.
‎2008 May 29 12:36 PM
HI,
initially the value of w_week is 3 so the do...enddo will be processed for 3 times. after this looping number of times is assigned u r changing the value of that variable.
rgds,
bharat.
‎2008 May 29 12:36 PM
the "CLEAR w_week" is just a bug that can be removed.
When first reaching the DO loop, the system will evaluate the contents of w_week once. Subsequent changes will have no effect.
Cheers
Thomas
‎2008 May 29 12:40 PM
Hello.
If that DO/ENDDO block is not in a form which is called more times in runtime, it makes no sense that CLEAR statement. I don't know the program logic.
Inside tha that DO, clearing w_week will affect nothing. However, will prevent next time to enter inside it again (if the is one). If you want to end the block you should use statement EXIT.
Best regards.
Valter Oliveira.