on 2007 Aug 22 11:17 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
I developed a work around for this. Thanks All!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 !!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
66 | |
10 | |
10 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.