cancel
Showing results for 
Search instead for 
Did you mean: 

FOX Formula from BPS to IP

0 Kudos

Hi Experts,

I need to migrate on BPS application into IP application and FOX formula is one of them.

The BPS code is as follows:

DATA CALMONTH TYPE 0FISCPER.

DATA CALYR TYPE 0FISCYEAR.

DATA CALMON_COPYFROM TYPE 0FISCPER.

DATA OFFSET TYPE I.

DATA PERIOD TYPE 0FISCPER3.

OFFSET = 1.

PERIOD = 000.

CALYR = VARV('VFISCYR0').

CALMON_COPYFROM = CONCAT(CALYR, PERIOD).

PERIOD = 001.

IF {CALMON_COPYFROM, 000} <> 0.

   DO.

      CALMONTH = TMVL(CALMON_COPYFROM, OFFSET).

      {CALMONTH, PERIOD} = {CALMON_COPYFROM, 000}.

      OFFSET = OFFSET + 1.

      PERIOD = PERIOD + 001. IF PERIOD = 013. EXIT. ENDIF.

   ENDDO.

ENDIF.

{CALMON_COPYFROM, 000} = 0.

When I copy and pasted the same code in IP, it was giving me error as below:

So, I replaced the code as below:

DATA CALMONTH TYPE 0FISCPER.

DATA CALYR TYPE 0FISCYEAR.

DATA CALMON_COPYFROM TYPE 0FISCPER.

DATA KF1 TYPE KEYFIGURE_NAME.

DATA OFFSET TYPE I.

DATA PERIOD TYPE 0FISCPER3.

OFFSET = 1.

PERIOD = 000.

CALYR = VARV(D_P0FISCYEAR).

CALMON_COPYFROM = CONCAT(CALYR, PERIOD).

PERIOD = 001.

IF {KF1, CALMON_COPYFROM, 000} <> 0 .

DO.

      CALMONTH = TMVL(CALMON_COPYFROM, OFFSET).

{KF1, CALMONTH, PERIOD} = {KF1, CALMON_COPYFROM, 000}.

    OFFSET=OFFSET + 1.

      PERIOD = PERIOD + 001. IF PERIOD = 013. EXIT. ENDIF.

   ENDDO.

ENDIF.

{KF1, CALMON_COPYFROM, 000} = 0.

Is this correct ?

When I am executing the FOX Formula, I am getting an error.

Also, It would be of great help if someone can help in explaining what exactly does this code do

Thanks,

Dinesh Vadwa

         

      

                                                                                                   

Accepted Solutions (1)

Accepted Solutions (1)

former_member93896
Active Contributor
0 Kudos

Hi Dinesh,

as you have already noticed, FOX in BW-IP requires that the key figure is specified in the {...} operands. You added KF1 but you also need to set KF1 to the name of the key figure you want to change. If you need this to work for all key figures you can add a FOREACH .... IN KEYFIGURES loop around your code.

What it does? Looks like copying data from period 0 to one year to all periods of another year.

Regards,
Marc Bernard
Product Management SAP EDW (BW/HANA)

0 Kudos

Hi Marc,

I have a keyfigure called Target and how to set KF1 to Target key figure that I want to change .


Is it fine if I just replace KF1 with TARGET in the code ?

Thanks,

Dinesh

cornelia_lezoch
Active Contributor
0 Kudos

put in exactly the technical name of your info object type key figure.

if that is TARGET use it, if it is ZTARGET use that one or whatever the name is.

Answers (3)

Answers (3)

0 Kudos

Hi Corenlia,

I have tried it but still getting the same error while running it. No syntax error.

Below is my current code.

DATA CALMONTH TYPE 0FISCPER.

DATA CALYR TYPE 0FISCYEAR.

DATA CALMON_COPYFROM TYPE 0FISCPER.

DATA OFFSET TYPE I.

DATA PERIOD TYPE 0FISCPER3.

OFFSET = 1.

PERIOD = 000.

CALYR = VARV( D_P0FISCYEAR ).

CALMON_COPYFROM = CONCAT( CALYR, PERIOD ).

PERIOD = 001.

IF { TARGET, CALMON_COPYFROM, 000 } <> 0.

  DO.

    CALMONTH = TMVL( CALMON_COPYFROM, OFFSET ).

    { TARGET, CALMONTH, PERIOD } = { TARGET, CALMON_COPYFROM, 000 }.

    OFFSET = OFFSET + 1.

    PERIOD = PERIOD + 001.

    IF PERIOD = 013.

      EXIT.

    ENDIF.

  ENDDO.

ENDIF.

{ TARGET, CALMON_COPYFROM, 000 } = 0.

Thanks,

Dinesh

cornelia_lezoch
Active Contributor
0 Kudos

Hi Dinesh,

TARGET is the technical name of your key figure - right?

Why do you use a data declaration for 0FISCYEAR? From the formula tuples I don´t see any fiscyear.

What are your fields to be changed? I assume its 0FISCPER and 0FISCPER3?

if period = 0FISCPER3 then this line should not work


PERIOD = PERIOD + 001.

since 0FISCPER3 is a time char you need to work with the TMVL again,

so it sould be period = tmvl(period, 1).


regards

Cornelia

0 Kudos

I have created Planning Sequence and executed it with trace to get the below Error:

Formula error: Access with invalid operand ' '

Please help me here

cornelia_lezoch
Active Contributor
0 Kudos

it´s probably this wrong key figure name. So insert the correct technical name for it

cornelia_lezoch
Active Contributor
0 Kudos

Hi Dinesh,

why are you asking us what the code is doing? You should know what you want your function to do.

What I can see is, that it is copying data from period 000 to periods 001 -> 012 and then deletes the value on period 000.

do you get errors when checking the fox code?

What is the error you get when running the function?

regards

Cornelia

0 Kudos

Hi Cornelia,

I asked what the code is doing because I have written it and am not that expert in FOX.

I dont get errors while checking the code. But below is the error while running it.

Thanks,

Dinesh