2010 Feb 19 8:38 AM
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
2010 Feb 19 9:24 AM
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
2010 Feb 19 9:24 AM
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
2010 Feb 19 10:38 AM
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
2010 Feb 19 10:51 AM
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
2010 Feb 19 2:11 PM
2010 Feb 19 2:12 PM