Skip to Content
0
Former Member
Jul 27, 2005 at 03:08 PM

FOX FOREACH loop problem

129 Views

I am having strange problems with the FOX FOREACH routine.

The code is below and as you can see very straigtfoward.

For each iteration it actually executing the whole script rather than just the code between FOREACH... ENDFOR!

Code below. Any assistance appreciated.

Alex

DATA CURRPER TYPE 0FISCPER.

DATA FISCPER TYPE 0FISCPER.

DATA SUMPLAN TYPE F.

DATA SUMACTUAL TYPE F.

  • Periods read from the variables with technical name PERIOD

CURRPER = VARV( 'ZPERIOD' ).

MESSAGE I001(CURRENTPERIOD) WITH CURRPER.

  • Total Planned Amount

FOREACH FISCPER.

SUMPLAN = SUMPLAN + { FISCPER, BAS, 020, C565 }.

ENDFOR.

  • Total Actuals (***change to date by variable)

FOREACH FISCPER.

  • IF FISCPER > CURRPER.

SUMACTUAL = SUMACTUAL + { FISCPER, 000, 010, C565

}.

  • ENDIF.

ENDFOR.

{ FISCPER, NW, 020, C565 } = SUMACTUAL.

ENDIF.

ENDFOR.

Message was edited by: Alex Munroe