Former Member

Fox Formula - Calculate with Time-Characteristics

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?

10|10000 characters needed characters exceeded

Related questions

• Former Member
Posted on Aug 30, 2007 at 12:30 PM

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

10|10000 characters needed characters exceeded
• Former Member

Hi and thank you for answer,

but it dosn't work:

My coding:

DATA PER TYPE 0FISCPER3.

DATA ABC TYPE STRING.

DATA PERIODEN TYPE F.

FOREACH PER.

ABC = PER.

PERIODEN = ABC.

...

The statement PERIODEN = ABC is incorrect, SAP says: Type I and Type STRING not be the same.

• Former Member
Posted on Aug 30, 2007 at 02:35 PM

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?

10|10000 characters needed characters exceeded
• Former Member Former Member

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.