cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with 0FISCYEAR in FOX

Former Member
0 Kudos

Gurus,

Good day! I have a FOX code that works on two key figures. ZCOUNT and ZFULL. ZCOUNT is used as a FLAG. I need to execute a function such that if ZCOUNT is greater than "1" perform some computations.

The issue that I am having is, if I run the following code it checks for all the years in the 0FISCYEAR but it does not do the computation for the years other than the first year.

<u><b>CODE:</b></u>

DATA FLAG TYPE I.

DATA YR TYPE 0FISCYEAR.

.......................

..................

............

FLAG = 0.

FOREACH YR.

FLAG = {ZCOUNT,YR,XX,YY...}.

IF FLAG > 0.

{ZCOUNT,YR,XX,YY...} = 1.

.......................

..................

............

ELSE.

{ZFULL,YR,XX,YY...} = 0.

{ZCOUNT,YR,XX,YY...} = 0.

.......................

..................

............

ENDIF.

ENDFOR.

The Output is of the format

YR XX ...... ZFULL ZCOUNT

2007 01 30,000.00 8

<b>2007 01 30,000.00 1</b> (correct for year 2007)

2008 01 20,000.00 8

<b>2008 01 20,000.00 0</b> (wrong for the following years)

<b>EXPECTED OUTPUT</b>

YR XX ...... ZFULL ZCOUNT

2007 01 30,000.00 8

2007 01 30,000.00 1

2008 01 20,000.00 8

2008 01 20,000.00 1

Please guide me!!!

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

the easiest way to find out is to debug. inlcude statement BREAK-POINT in your FOX formula, create a planning sequence with a selection variant and run it with SE38 and program RSPLS_PLSEQ_EXECUTE. Then you can follow what happens step by step.

Sequently be aware that FOREACH YR will only loop over those years for which you already have plan data. Do you have plan data for 2008?

D

Former Member
0 Kudos

Thanks for the suggestion Dries. Yes I do have plan data for the years 2008... It zeros out all the values. Not sure what is happening. Will try your SE38 suggestion. I tried using MESSAGE everywhere I get the YR (0FISCYEAR) values for all the years I want it to run in the FOREACH YR loop.

Thanks

Former Member
0 Kudos

By using the BREAKPOINTs I could see the values that are generated. But they show the same set of values that I get through MESSAGES. It runs for all the required years for the FOREACH YR loop.

Answers (3)

Answers (3)

Former Member
0 Kudos

I developed a work around for this. Thanks All!

Former Member
0 Kudos

HI,

I suggeest to use another local variable to update the count in the loop as mentioned below, and clear the local variable after the loop.

DATA count type i.

IF FLAG > 0.

COUNT = 1.

{ZCOUNT,YR,XX,YY...} = COUNT.

Thanks !!

Former Member
0 Kudos

Hi,

I would suggest you to check that the values in all the other characteristics on the records that you want to operate on using the code are the same as specified in the code. It might be a value mismatch because of which your code is not working.