‎2013 Jan 23 5:31 PM
Hi,
Please help me to solve the issue from Code inspector - like Loop statement processing will be terminated.
Thanks.
Viji.
‎2013 Jan 23 5:33 PM
Hi Vijay,
Why are you using where with from and to additions in the loop?
the from and to additions already define a range to read(you are getting the indexes already)
Hope this helps
‎2013 Jan 23 6:30 PM
This appears to be caused by the combination of a limited loop (WHERE or FROM TO) and the usage of AT statements.
May we see the loop? Additionally, may we see the declaration of the table being looped through and any sorting done to the table?
‎2013 Jan 23 6:55 PM
As specified in the message, usage of a LOOP AT with a WHERE clause and of AT/ENDAT statements in the loop can give unpredictable results (or not)
To ensure that control level processing is carried out properly, the following rules must be observed:
- A table key specified for LOOP in cond must be chosen so that it produces the required sort order of the imported rows.
- A restricting condition specified for LOOP in cond must select a contiguous block of rows from the internal table. Otherwise the behavior of the control level processing is undefined.
- The internal table cannot be modified within the LOOP loop.
- A work area wa specified in the LOOP statement after the addition INTO must be compatible with the row type of the table.
- A field symbol <fs> specified in the statement LOOP after the addition ASSIGNING must be typed with the row type of the table.
- The content of a work area wa specified in the statement LOOP after the addition INTO cannot be modified.
(From AT - itab documentation)
Regards,
Raymond
‎2013 Jan 24 6:14 AM
Hi ,
Please find the below code for the issue we discussed about:
AT END OF wempf.
READ TABLE git_mseg INTO gwa_mseg INDEX l_tabix.
IF gwa_mseg-wempf IS NOT INITIAL AND l_mtart = 'ZFES'.
l_sent_quantity = l_sent_quantity - 1.
gwa_final-bdmng = 1.
ELSE.
CLEAR : l_sent_quantity, gwa_mseg-wempf.
gwa_final-bdmng = gwa_resb_sum-bdmng.
ENDIF.
---------------
AT LAST.
IF l_sent_quantity GT 0.
gwa_final-wempf = space.
gwa_final-bdmng = l_sent_quantity.
l_sentqty = l_541 - l_542.
gwa_final-l_sentqty = l_sentqty. "Sent Qty
l_recqty = l_942 - l_941.
gwa_final-l_recqty = l_recqty. "rec Qty
IF gwa_final-l_sentqty IS INITIAL.
gwa_final-budat = space.
ENDIF.
IF gwa_final-l_recqty IS INITIAL.
gwa_final-recvdate = space.
ENDIF.
----------------
AT END OF bwart.
READ TABLE git_lead INTO gwa_lead INDEX l_tabix.
l_sent_date = gwa_lead-budat.
ENDAT.
ENDIF.
IF gwa_lead-bwart = c_942.
l_942_sum = gwa_lead-menge.
IF l_sent_quantity IS NOT INITIAL.
l_sent_quantity = l_sent_quantity - l_942_sum.
CLEAR : l_942_sum.
IF l_sent_quantity LE 0.
l_recv_date = gwa_lead-budat.
EXIT.
ENDIF.
ENDIF.
ENDIF.
CLEAR : gwa_lead.
ENDLOOP.
Thanks.
Viji.
‎2013 Jan 24 6:24 AM
Hi Vijay,
Try using either from-to or where addition with the loop.
In my program, i have used the from-to addition with LOOP and it is not showing the error in code inspector.
Hope this helps