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

related to do enddo statement

Former Member
0 Likes
666

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.

3 REPLIES 3
Read only

Former Member
0 Likes
618

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.

Read only

ThomasZloch
Active Contributor
0 Likes
618

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

Read only

valter_oliveira
Active Contributor
0 Likes
618

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.