on 08-30-2007 1:17 PM
Hello,
I have the requirement to calculate with the fiscal period.
Simple compute: average_keyfigure = ytd_keyfigure / fiscal_period.
Fox formula says that fiscal_period is not the type F. So calculating ist not possible.
How can a divide with the fiscal period?
One option is to run a foreach for the periods and increment a counter inside the loop.
Will look like this,
DATA COUNTER TYPE I.
COUNTER = 0.
FOREACH PERIOD.
COUNTER = COUNTER+1.
ENDFOR.
Later you can use this counter value for mathematical operation.Will this work for you?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When you do it like this, the FOREACH-loop only loops over existing data records. May be there is no data record for period July, the counter counts one period less.
And that's the reason why I have to divide by the actual period.
In german: Die erste Methode ermittelt einen Mittelwert (es werden nur Perioden mit Werten berücksichtigt). Die gewünschte Methode soll den echten Durchschnitt bis zum letzten Datensatz ausgeben, auch wenn nicht in jeder davorliegenden Periode ein Datensatz vorhanden ist.
Sorry, but in german it's ever easier.
Use the VARI function then:
fiscal period = VARV(...)
Integer = VARI(0FISCPER3,1,fiscal period).
The VARI function returns an integer.
(I don't have access to the system now so I cannot check the syntax).
PS for the foreach loop use FOREACH 0FISCPER IN SELECTION, then it will loop over all possible values.
D
Hi,
Here some sample code which should help you further calculate with time characteristics
D
DATA LV_COUNTER TYPE I.
DATA LV_PERIODS TYPE I.
DATA LV_PERIOD_FROM TYPE 0FISCPER3.
DATA LV_PERIOD_TO TYPE 0FISCPER3.
DATA LV_FISCPER3 TYPE 0FISCPER3.
DATA LV_DISTR_AMOUNT TYPE F.
*TRANSFER VARIABLE PERIOD FROM AND PERIOD TO INTO LOCAL VARIABLE AND COUNT INTERVAL OF PERIODS.
BREAK-POINT.
LV_PERIODS = VARC(0I_PER3).
LV_PERIOD_FROM = VARI(0I_PER3,1).
LV_PERIOD_TO = VARI(0I_PER3,LV_PERIODS).
DO TOP-DOWN DISTRIBUTION FOR ALL ADJUSTMENT VALUES ON PERIOD = #
LV_COUNTER = 0.
LV_DISTR_AMOUNT = { 0G_QVVGRM,#} / LV_PERIODS.
DO.
LV_FISCPER3 = TMVL(LV_PERIOD_FROM,LV_COUNTER).
{ 0G_QVVGRM, LV_FISCPER3} = { 0G_QVVGRM, LV_FISCPER3} + LV_DISTR_AMOUNT.
{ 0G_QVVGRM,#} = { 0G_QVVGRM,#} - LV_DISTR_AMOUNT.
LV_COUNTER = LV_COUNTER + 1.
IF LV_FISCPER3 >= LV_PERIOD_TO.
EXIT.
ENDIF.
ENDDO.
Hi,
1) you can use the VARI function to make the difference between two posting periods.
2) The following statement can also be used to transfer values to another infoboject:
DATA LV_STRING TYPE STRING.
DATA VAR_A TYPE ...
DATA VAR_B TYPE ...
LV_STRING = VAR_B.
VAR_A = LV_STRING.
VAR_A and VAR_B have a different type.
D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.