07-09-2010 11:44 AM
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?
07-09-2010 12:16 PM
Hello Mathew,
I see the veriable "p_next_step" in your where condition
and it is set by same select statement via variable lv_next_step.
This seems like it's caused by the value of this variable
on further loop steps.
Can you please post your code including loop and while commands?
Bulent
07-09-2010 12:43 PM
If you can post the complete code, that might help us understand better.
Also, if you are not appending your values, why are you repeatedly selecting from DB into a variable?
Regds,
Kiran
07-09-2010 1:30 PM
Hi,
according to my analsys, either ur while loop will execute infinetly or it will not be executed even a single time,
as ur condition is not getting changed with in the same loop at every pass and also u are not storing values.
Regards
07-09-2010 4:07 PM
Hi,
Can you please post the entire code? Please note that using a loop inside a loop (especially inside a loop at table )is not adviseable as it affects the performance.
Please post the entire code so that we can better analyse the issue.
Regards,
Shiny