on 03-03-2011 5:30 PM
Hello
Let me share the scenario:
I declare the fiscal year / period as a constant (it will be current fiscal period in the future). I find the previous period. Then I search for a value of a Key Figure YSTCK for this period. So far works fine. Than if found I would like to populate this value for every future fiscal year / periods. So I create loop in the loop. No success. In debugger I can see that the value of my Key Figure disappears from the variable.
There are single values of this Key Figure for every Fiscal year / period.
My code has been attached below.
Hope somebody is able to help.
The idea was to make a loop at every fiscal year / period and when the proper one (previous than declared) is found in the cube, read the value and start another loop, populating the values.
Please, take a look.
Thank you in advance.
A
DATA S_FISCPER TYPE 0FISCPER.
DATA S_FISCYEAR TYPE 0FISCYEAR.
DATA S_FISCPER3 TYPE 0FISCPER3.
DATA Y_FISCPER TYPE 0FISCPER.
DATA X_FISCPER TYPE 0FISCPER.
DATA D_FISCPER TYPE 0FISCPER.
DATA D_FISCYEAR TYPE 0FISCYEAR.
DATA D_FISCPER3 TYPE 0FISCPER3.
DATA Z_KF TYPE F.
Y_FISCPER = 2010004.
X_FISCPER = TMVL(Y_FISCPER,-1).
FOREACH S_FISCPER.
S_FISCYEAR = SUBSTR(S_FISCPER,0,4).
S_FISCPER3 = SUBSTR(S_FISCPER,4,3).
IF S_FISCPER = X_FISCPER.
Z_KF = {YSTCK, S_FISCPER, S_FISCPER3, S_FISCYEAR}.
FOREACH D_FISCPER.
D_FISCYEAR = SUBSTR(D_FISCPER,0,4).
D_FISCPER3 = SUBSTR(D_FISCPER,4,3).
IF D_FISCPER > X_FISCPER.
{YSTCK, D_FISCPER, D_FISCPER3, D_FISCYEAR} = Z_KF.
ENDIF.
ENDFOR.
ENDIF.
ENDFOR.
Hello Arelis,
use DO...ENDDO and a counter instead. I removed fiscal year and period from the level (which you could derive easily with a characteristic relationship).
Regards,
Marc
SAP Techology RIG
DATA Y_FISCPER TYPE 0FISCPER.
DATA X_FISCPER TYPE 0FISCPER.
DATA I TYPE I.
DATA Z_KF TYPE F.
Y_FISCPER = 2010004.
X_FISCPER = TMVL(Y_FISCPER,-1).
Z_KF = {0AMOUNT, X_FISCPER}.
DO.
X_FISCPER = TMVL(X_FISCPER,+1).
{0AMOUNT, X_FISCPER} = Z_KF.
I = I + 1.
IF I = 12.
EXIT.
ENDIF.
ENDDO.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.