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

ATNEW-ENDAT -The LOOP statement processing will be limited ERROR

vijay_kumar134
Participant
0 Likes
1,101

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.

3 REPLIES 3
Read only

amy_king
Active Contributor
0 Likes
723

Hi Vijay,

The message is because you're using a control break (AT NEW) combined with a WHERE condition within a loop.

Cheers,

Amy

Read only

Clemenss
Active Contributor
0 Likes
723

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

Read only

RaymondGiuseppi
Active Contributor
0 Likes
723

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