Skip to Content
0
Former Member
Jul 09, 2010 at 10:44 AM

looping issue

39 Views

hi all,

I loop over a table. Within that loop I have a while loop that continues to call the following code as long as flg_end is blank.

FORM find_next_step CHANGING p_next_step.

DATA: lv_next_step TYPE stunr.

SELECT SINGLE stunr

INTO lv_next_step

FROM t683s

WHERE kvewe = c_a "Usage

AND kappl = c_ka "Application

AND kalsm = 'ZCBK01' "Procedure

AND ( ( stunb >= p_next_step )

AND ( stun2 <= p_next_step ) ).

IF sy-subrc = 0.

p_next_step = lv_next_step.

ELSE.

flg_end = 'X'.

ENDIF.

First pass and a step is successfully returned. Second pass the select fails...and I drop outside the while loop. This process repeats until I reach end of outer table.. Odd...if I remove the while loop and replace with a do loop...all additional reads fail. If I remove the inner loop and perform static calls to the program...all additional reads fail. What gives?