cancel
Showing results for 
Search instead for 
Did you mean: 

Adding up 24 months in Fox Formula based on a initial value of period

Former Member
0 Kudos

Hi,

I have the following requirement. I have cost center, cost element and Internal Order in my aggregation created on a multiprovider containing two cubes(ZYPONM and ZYPALLOC).

I need to calculate a rate based on 24 months data and user inputs the first month of the 24 month period. Based on user input I have to pick up the data for the next 24 months based on Internal order. So if I/O starts with 'FVACSICK' it should form part of the numerator and else it would form part of the denominator.

I have written the following code. For the denominator we need to divide by a attribute of cost element known as Payscale. This is not working and the 24 months are not being summed up. Only individual months are getting summed up. Please help me achieve my goal. Thanks.

DATA CC TYPE ZYCOSTCTR.

DATA CE TYPE ZYCOSTELM.

DATA IO TYPE ZYORDER.

DATA PFUND TYPE F.

DATA DBASE TYPE F.

DATA RATE TYPE F.

DATA VAR_PS TYPE F.

DATA VAR_FP TYPE 0FISCPER.

VAR_FP = VARV( ZVCMSM0FISCPER ).

PFUND = 0.

DBASE = 0.

RATE = 0.

FOREACH CC, IO, CE.

  DO 24 TIMES.

    IF IO CP 'FVACSICK*'.

      PFUND = PFUND + { 0AMOUNT, USD, VAR_FP, ZYPONM, ME_INPUT, CC, CE, IO } + { 0AMOUNT, USD, VAR_FP, ZYPONM, ME_INPUT_ADJ, CC, CE, IO }.

    ELSE.

      VAR_PS = ATRV( ZPSCALE, CE ).

      DBASE = DBASE + ( { 0AMOUNT, USD, VAR_FP, ZYPONM, ME_INPUT, CC, CE, IO } / VAR_PS ) + ( { 0AMOUNT, USD, VAR_FP, ZYPONM, ME_INPUT_ADJ, CC, CE, IO } / VAR_PS ).

       ENDIF.

    VAR_FP = TMVL( VAR_FP, 1 ).

  ENDDO.

ENDFOR.

*BREAK-POINT.

IF NOT DBASE IS INITIAL.

  RATE = PFUND / DBASE.

ENDIF.

IF CC CP '2100*'.

  { ZVNS_RPER, #, #, ZYPALLOC, AE_V&S, 'SDGE-PRHO', '0006110401', FVACSICK2100 } = RATE.

ELSEIF CC CP '2200*'.

  { ZVNS_RPER, #, #, ZYPALLOC, AE_V&S, 'SOCL-PRHO', '0006110401', FVACSICK2200 } = RATE.

ENDIF.

Accepted Solutions (0)

Answers (2)

Answers (2)

cornelia_lezoch
Active Contributor
0 Kudos

Hi Amab,

at first glance your fox looks good.

Are you saying, that the summation for PFUND is working but not for DBASE?

Is your fox really going into the else?

regards

Cornelia

sheldon_piao
Employee
Employee
0 Kudos

Hi Arnab,

Have you known the script RSPLFC_DEBUGGING_SCRIPT_FOX used for fox formula ?

See the following page:

I think after you are familiar with it, you can solve most of fox coding during designing time.

Best Regards,
Sheldon.