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

DO ENDO Logic

Former Member
0 Likes
6,069

Hi ABAPers,

Neep Help.

REFRESH: i_zxxx.
  n = 1.
  DO n TIMES.
  SELECT *
         FROM zxxx
         INTO TABLE i_zxxx
         WHERE werks in s_site
         AND datum eq s_date-low
         AND status eq 'C'.
  IF i_zxxx is INITIAL.
  n = 1.
  s_date-low = s_date-low - 1.
  ENDIF.
  ENDDO.

In the above code I am expexting the do endo loop to run again when i_zxxx is intial by setting n = 1.

kindly help me change the logic to obtain the same.

Regards,

--Dep

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,764

Hi,

this is a single loop because n = 1 at start of the do ... enddo loop.

For your needs you should use a DO without n times and leave it, when sy-subrc eq 0 or date has a special value with EXIT.

Regards,

Klaus

Hi ABAPers,

Neep Help.

REFRESH: i_zxxx.
  n = 1.
  DO n TIMES.
  SELECT *
         FROM zxxx
         INTO TABLE i_zxxx
         WHERE werks in s_site
         AND datum eq s_date-low
         AND status eq 'C'.
  IF i_zxxx is INITIAL.
  n = 1.
  s_date-low = s_date-low - 1.
  ENDIF.
  ENDDO.

In the above code I am expexting the do endo loop to run again when i_zxxx is intial by setting n = 1.

kindly help me change the logic to obtain the same.

Regards,

--Dep

3 REPLIES 3
Read only

Former Member
0 Likes
2,765

Hi,

this is a single loop because n = 1 at start of the do ... enddo loop.

For your needs you should use a DO without n times and leave it, when sy-subrc eq 0 or date has a special value with EXIT.

Regards,

Klaus

Read only

0 Likes
2,764

Thank You Klaus for your quick answer. Resolved the issue.

Regards,

Dep

Read only

Former Member
0 Likes
2,764

Hi ,

use this:

REFRESH: i_zxxx.

n = '1'.

while n = '1'.

SELECT *

FROM zxxx

INTO TABLE i_zxxx

WHERE werks in s_site

AND datum eq s_date-low

AND status eq 'C'.

IF i_zxxx is INITIAL.

n = 1.

s_date-low = s_date-low - 1.

else .

clear n.

ENDIF.

ENDWHILE.