Application Development 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: 

Error at new statement on extended program check need help

former_member242512
Participant
0 Kudos
614

Hi all ,

This is the code :

LOOP AT i_stocks INTO wa_stocks WHERE NOT pulkt IS INITIAL AND
                         NOT bstkt IS INITIAL AND
                         NOT fprctr IS INITIAL AND
                         ( write_off_fix <> 0 OR
                           write_off_pup <> 0 ).
    AT NEW fprctr.
      CLEAR: l_prctrsum_fix, l_prctrsum_pup.
    ENDAT.
    IF wa_stocks-bukrs <> lastbukrs.
      lastbukrs = wa_stocks-bukrs.
      PERFORM document_header USING xreversal.
      i_counter = 1.
      CLEAR lastkostl.
    ENDIF.
    
    ADD wa_stocks-write_off_pup TO l_prctrsum_pup.
 ENDLOOP

On Extended program check its says :

The LOOP statement processing will be limited
(FROM, TO and WHERE additions in LOOP)
Interaction with group change processing (AT NEW, ...) is undefined
(The message can be hidden with "#EC *)

It means at statement AT NEW fprctr .

Need help , How can i resolve this error ?

Regards .

Edited by: ujjwal dharmak on Feb 19, 2010 9:55 AM

Moderator message - Moved to the correct forum

Edited by: Rob Burbank on Feb 19, 2010 9:04 AM

1 ACCEPTED SOLUTION

Former Member
0 Kudos
168

Since you are using where condition in loop statement and also using the control break statement thats why it is showing the error for you.

So if you want you can do like this

loop at itab into wa.

if not wa-f1 is initial ....<and other conditions>.

continue.

endif.

at new f1.

endat.

endloop.

It will resolve your problem but I am having the doubt how the at new will work properly...

Regards

Shiba Prasad Dutta

5 REPLIES 5

Former Member
0 Kudos
169

Since you are using where condition in loop statement and also using the control break statement thats why it is showing the error for you.

So if you want you can do like this

loop at itab into wa.

if not wa-f1 is initial ....<and other conditions>.

continue.

endif.

at new f1.

endat.

endloop.

It will resolve your problem but I am having the doubt how the at new will work properly...

Regards

Shiba Prasad Dutta

Former Member
0 Kudos
168

At new does not work properly if used inside loop with where condition and that is happening in your case.

Solution of your problem is create a temporary table. Move data from your main table( which you are looping) into temp table. delete entries from temp table according to your where clause. then loop this temp table

Edited by: Anurag_n on Feb 19, 2010 11:44 AM

Former Member
0 Kudos
168

Hi,

You can use the standard way without the use of "AT NEW" : with another variable.

You can use it like this :


LOOP ...
  IF wa_stocks-fprctr NE ld_fprctr_old. " Check if fprctr has change since last loop
    CLEAR: l_prctrsum_fix, l_prctrsum_pup.
  ENDIF.

  ld_fprctr_old = wa_stocks-fprctr. " Store new value of fprctr

...

ENDLOOP.

Best regards,

Samuel

0 Kudos
168

Thanks all for your replies ! Thanks !

0 Kudos
168

Conditions within loop will work ..