2012 Sep 27 6:04 PM
Hi,
I have extended program check for a program i was getting a error with description like this "The LOOP statement processing will be limited
(FROM, TO and WHERE additions in LOOP)
Interaction with group change processing (AT NEW, ...) is undefined".
Code :
LOOP AT t
WHERE klagr EQ name
AND matnr EQ z_matnr.
AT NEW class.
class_count = class_count + 1.
ENDAT.
ENDLOOP.
IF class_count > 1.
MESSAGE e398(00) WITH text-903 name ' (1)' ' ' .
DELETE t
WHERE matnr = z_matnr.
CONTINUE.
ENDIF.
ENDIF.
Please guide for this.
Vijay.
2012 Sep 27 6:21 PM
Hi Vijay,
The message is because you're using a control break (AT NEW) combined with a WHERE condition within a loop.
Cheers,
Amy
2012 Sep 27 10:09 PM
Hi Vijay,
just to explain what AMY already outlined:
The control break events are defined for a sorted table. AT NEW CLASS event is triggered if the field class value or the value of any field left of CLASS changes.
If you use a WHERE clause, just this record where the event is defined may be filtered. So the event will not be processed.
Resulting Rule: Never use AT control break statements in a loop that is filtered by WHERE clause. No WHERE or no AT.
Regards
Clemens
2012 Sep 29 10:48 AM
Just to add a reference, from the online help for AT - itab
After LOOP, a restricting condition cond can only be specified if this selects a consecutive line block of the internal table. Otherwise, the behavior of control level processing is undefined.
So there should not be any problem if the criteria of the WHERE are higher keys of the table (e.g. if your table is sorted by klagr, matnr, class)
Regards,
Raymond