Multiplanning area FOX Formula

Hi everyone,
I’m trying to implement a Fox’s formula with multi-areas through integrated Planning, but the function does not bring any result,  it just says that has read 24 records, but it hasn’t modified nor created any record, when, in fact, are at least 4 thousand.
The client request is that apply a correction factor over last year operation amounts. The correction factor is in a different Infocube than the others amounts.
All the characteristics of the aggregation level are set as “characteristic to be changed”, which are all relevant fields of both infocubes, including the field "Infoprovider". Therefore when I want to reference a key figure I use them all, so, when one of the fields is not in the key figure’s Infoprovider, I declare  it (or set it) with the value "#", Is that procedure correct?.
Ex. Characteristics in bold are not in the key figure's Infoprovider
{Key Figure, 0COMP_CODE, 0COSTCENTER, 0COSTELMNT, 0CO_AREA, 0CURRENCY, 0FISCPER, 0FISCPER3, 0FISCVARNT, 0FISCYEAR, 0INFOPROV, 0PROFIT_CTR, 0VERSION, 0VTYPE, Z1AVERSIO, ZVAR_EC}
Then, the string to reference this key figure is:
{ Z1AINDDVA, #, #, #, #, #, DAT_FYP1, DAT_FPER, VAR_FSCV, DAT_YBAS, ZBPS_VAR, #, VAR_VIPC, VAR_TVIE, VAR_IPCV , VAR_VREC}
This is my FOX formula code:
DATA CHA_CELM TYPE 0COSTELMNT.
DATA CHA_CMCO TYPE 0COMP_CODE.
DATA CHA_CECO TYPE 0COSTELMNT.
DATA CHA_CURR TYPE 0CURRENCY.
DATA CHA_COAR TYPE 0CO_AREA.
DATA CHA_CEBE TYPE 0PROFIT_CTR.
DATA DAT_YBAS TYPE 0FISCYEAR.
DATA DAT_YDER TYPE 0FISCYEAR.
DATA DAT_FPER TYPE 0FISCPER3.
DATA DAT_FPR1 TYPE 0FISCPER3.
DATA DAT_FYP1 TYPE 0FISCPER.
DATA DAT_FYP2 TYPE 0FISCPER.
DATA DAT_FYP3 TYPE 0FISCPER.
DATA INF_PROV TYPE 0INFOPROV.
DATA FLO_IPC TYPE F.
DATA FLO_BASE TYPE F.
DATA FLO_DERV TYPE F.
DATA VAR_VDBA TYPE 0VERSION.
DATA VAR_VDAA TYPE 0VERSION.
DATA VAR_VIPC TYPE 0VERSION.
DATA VAR_VREC TYPE ZVAR_EC.
DATA VAR_AREF TYPE 0FISCYEAR.
DATA VAR_MODI TYPE 0FISCYEAR.
DATA VAR_TVDB TYPE 0VTYPE.
DATA VAR_TVIE TYPE 0VTYPE.
DATA VAR_TVDM TYPE 0VTYPE.
DATA VAR_IPCV TYPE Z1AVERSIO.
DATA VAR_FSCV TYPE 0FISCVARNT.
DAT_YBAS = TMVL( VAR_AREF, 0, VAR_FSCV).
DAT_YDER = TMVL( VAR_MODI, 0, VAR_FSCV).
DAT_FPER = '012'.
DAT_FYP1 = CONCAT ( DAT_YBAS, DAT_FPER).
DAT_FYP2 = CONCAT ( DAT_YDER, DAT_FPER).
FLO_IPC = 1.
FLO_BASE = 0.
FLO_DERV = 0.
FLO_BASE = { Z1AINDDVA, #, #, #, #, #, DAT_FYP1, DAT_FPER, VAR_FSCV, DAT_YBAS, ZBPS_VAR, #, VAR_VIPC, VAR_TVIE, VAR_IPCV , VAR_VREC}.
FLO_DERV = { Z1AINDDVA, #, #, #, #, #, DAT_FYP2, DAT_FPER, VAR_FSCV, DAT_YDER, ZBPS_VAR, #, VAR_VIPC, VAR_TVIE, VAR_IPCV, VAR_VREC}.
IF FLO_BASE <> 0 AND FLO_DERV <> 0.
FLO_IPC = 1 + ( FLO_BASE / FLO_DERV ).
ENDIF.
FOREACH CHA_CMCO, CHA_CECO, CHA_CELM, CHA_COAR, CHA_CURR.
IF CHA_COAR = 1000.
IF VAR_VREC = CL01.
{ 0AMOUNT, CHA_CMCO, CHA_CECO, CHA_CELM, CHA_COAR, CHA_CURR, DAT_FYP3, DAT_FPR1, VAR_FSCV, DAT_YDER, ZSEM_C18, CHA_CEBE, VAR_VDAA, VAR_TVDM, #, # } =
{ 0AMOUNT, CHA_CMCO, CHA_CECO, CHA_CELM, CHA_COAR, CHA_CURR, DAT_FYP3, DAT_FPR1, VAR_FSCV, DAT_YDER, ZSEM_C18, CHA_CEBE, VAR_VDAA, VAR_TVDM, #, # } * FLO_IPC.
ELSE.
{ 0AMOUNT, CHA_CMCO, CHA_CECO, CHA_CELM, CHA_COAR, CHA_CURR, DAT_FYP3, DAT_FPR1, VAR_FSCV, DAT_YDER, ZSEM_C18, CHA_CEBE, VAR_VDAA, VAR_TVDM, #, # } =
{ 0AMOUNT, CHA_CMCO, CHA_CECO, CHA_CELM, CHA_COAR, CHA_CURR, DAT_FYP3, DAT_FPR1, VAR_FSCV, DAT_YDER, ZSEM_C18, CHA_CEBE, VAR_VDAA, VAR_TVDM, #, # } * 1.
ENDIF.
ELSEIF  CHA_COAR = 2000 OR CHACOAR = 3000.
{ 0AMOUNT, CHA_CMCO, CHA_CECO, CHA_CELM, CHA_COAR, CHA_CURR, DAT_FYP3, DAT_FPR1, VAR_FSCV, DAT_YDER, ZSEM_C18, CHA_CEBE, VAR_VDAA, VAR_TVDM, #, # } =
{ 0AMOUNT, CHA_CMCO, CHA_CECO, CHA_CELM, CHA_COAR, CHA_CURR, DAT_FYP3, DAT_FPR1, VAR_FSCV, DAT_YDER, ZSEM_C18, CHA_CEBE, VAR_VDAA, VAR_TVDM, #, # } * 1.
ENDIF.
ENDFOR.
Finally, when I try to debug the formula,  it doesn’t bring any value to the correction factor and exits without continue executing the next part of the code in which it should apply the correction factor over the amounts.
I have some question about this kind of FOX formula:
1.- How I resolve this issue in order to get my correction factor to be applied over the amounts.
2.- Is there a way to make a direct reference in order to read each Infoprovider?
3.- When is right to use all of the fields in the aggregation level (as “characteristic to be changed”) and when is not?.
4.- If I don't use all multiprovider’s fields in the aggregation level, the update is over all of the records and its combinations?
I hope you can help me with this.
Thanks in advance and best regards
Inge Eichhorns

Hi Inge,
See my response below for your perusal.
How can i make a direct reference in order to read each Infoprovider?
**When you have a combination of InfoProviders...you need to advise the system to pick up the appropriate InfoProvider. Either you will make the selection a constant or will assign a variable. By selecting or identifying the InfoProvider your function will write to the appropriate Key Figure.**
When is right to use all of the fields in the aggregation level (as “characteristic to be changed”) and when is not?
**It depends on the requirement. Having said that...**
**You will select all the characteristics in the cube when you are  planning to copy one year/one period data to other periods keeping all other characteristics as constant.**
***You will select characteristics based on the functionality that affects the changes on the InfoProvider.
Hope I addressed your requirement.
Should you have any further concerns please let me know.
Regards
Srinivas
Thanks.

Similar Messages

  • Ignoring characteristics in a BPS FOX formula

    Hello,
    I have a multiplanning area consisting of two planning areas. In the first one there are yearly data. In the second one there are monthly data. I have a FOX formula distributing the yearly data by a set of periodization keys into the planning area with monthly data.
    Now we have introduced a new characteristic "Resource class" in the planning area with yearly data. It has not been added to the planning area with monthly data, as it is not relevant there.
    My original assumption was that the FOX formula didn't have to be modified as "Resource class" should not be taken into consideration during the periodization. This proved to be wrong. It seems only data with no resource class are periodized. So it seems the system keeps the values of all characteristics not in the "Fields to be changed" and ignores the data if a characterstic value can't be stored in the destination planning area because the characteristic doesn't exist in that planning area. Even if the characteristic is not in the planning level.
    I want data to be periodized regardless of resource class. One way to do it is to loop over all resource classes and then periodize the total value. The FOX formula is however already quite complicated. Is there a simpler way to make the system completely ignore the resource class and run the existing FOX formula with values aggregated on resource class?
    Best regards,
    Christoffer Owe

    If you are using a distribution function for distributing the yeraly data to monthly data then  try unchecking the 'resource class' characteristic in the 'to be changed fields'.

  • Problem with Nested loop in Fox-Formula

    Dear Experts,
    Let s share the scenario :
    MaterialGroups with following Keys for Example AAAA, BBBB, CCCC..., Materialgroups are selected in the 1st input ready query, which is assigned to DataProvider DP_1 in a  webtemplate.
    every Materialgroup has several Materials, for instance:
    Materialgroup AAAA has following Materials: AAAA10, AAAA11, AAAA12, AAAA13...
    Materials are  selected in a second  input ready Query, which is assigned to a second DataProvider DP_2 in the Same Webtemplate as the query 1.
    Both Materialgroup and Material are based on the same Aggreagtion level and same real time cube.
    I want to copy the input values for every  MaterialGroup ( 1st query, DP_1) only to it s own Materials (2cond Query, DP_2).
    To resolve this Issue i wrote the following Fox Formula code with a nested loop, however it does not work properly. when I m debugging the code, i could release that the second Loop was ignored.but wehn i replace the second loop (nested loop) with a fixed value it s seems to work properly
    DATA MG1 TYPE MATG.<------ MaterialGroup
    DATA MT1 TYPE MAT.<----
    Material
    DATA S1 TYPE STRING.
    DATA S2 TYPE STRING.
    DATA S3 TYPE STRING
    DATA K TYPE F.
    DATA Z TYPE F.
    FOREACH MG1.
    To check Materialgroup in debugger
    S1= MG1.
    BREAK-POINT.
    K = {KEYfIG, #, MG1}.
    BREAK-POINT.
    FOREACH  MT1.   <----- if i set MT1 to a fixed value like AAAA11 then S3 get the wished value namely AAAA
    S2 = MT1.
    BREAK-POINT.
    S3 =  SUBSTR (MT1, 0, 4).  
    BREAK-POINT.
    IF S1 = S3.
    {KEYFIG, MT1, #} = K.
    following Statement is only used To check in debugger if Material has become the same Materialgroup value
    Z = {KEYFIG, MT1, #}.
    BREAK-POINT.
    ENDIF.
    ENDFOR.
    ENDFOR.
    Thakns for any help
    Frank
    Edited by: FRYYYBM on Mar 17, 2011 10:54 PM
    Edited by: FRYYYBM on Mar 17, 2011 11:06 PM

    Hi,
    Please try this way.
    DATA MG1 TYPE MATG.<------ MaterialGroup
    DATA MT1 TYPE MAT.<----
    Material
    DATA S1 TYPE STRING.
    DATA S2 TYPE STRING.
    DATA S3 TYPE STRING
    DATA K TYPE F.
    DATA Z TYPE F.
    FOREACH MT1.
    FOREACH MG1.
    To check Materialgroup in debugger
    S1= MG1.
    BREAK-POINT.
    K = {KEYfIG, #, MG1}.
    BREAK-POINT.
    FOREACH MT1. <----- if i set MT1 to a fixed value like AAAA11 then S3 get the wished value namely AAAA
    S2 = MT1.
    BREAK-POINT.
    S3 = SUBSTR (MT1, 0, 4).
    BREAK-POINT.
    IF S1 = S3.
    {KEYFIG, MT1, #} = K.
    following Statement is only used To check in debugger if Material has become the same Materialgroup value
    Z = {KEYFIG, MT1, #}.
    BREAK-POINT.
    ENDIF.
    ENDFOR.
    ENDFOR.
    ENDFOR.
    Thanks.
    With regards,
    Anand Kumar

  • Using variable in fox formula containing several characteristics

    Hi @all,
    is it possible to use a variable in fox containing more than one characteristic? I need to have some additional information for a few 0SEM_POSITs but don't want to create an attribute.
    I've created variable ZSCV25 containing characteristics 0SEM_POSIT and ZSCADVDEL but wasn't able to get any data by using VARI.
    Anybody an idea? Thanks for your help.
    Regards,
    Thomas

    <FONT FACE = "Tahoma", Font Color = "Blue">
    Dear Thomas<br>
    I don't think FOX Formula Variable can contain more than one characteristic value. <br><br>However I can suggest you to try one thing. Create an Exit Variable and in its ABAP Code refer to the master data table of base variable and retrieve the value of its desired attribute. <br><br>For example, let us assume that you have a characteristic 0COMP_CODE and 0COUNTRY is its attribute. Now you want that depending on the value of 0COMP_CODE selected by User in another variable ZCOMP_CODE , 0COUNTRY should be automatically populated in variable ZCOUNTRY. So in this case, please make ZCOUNTRY as an Exit Variable and write ABAP Code for that. In the ABAP Code, get the value of 0COMP_CODE which is entered by User in the other variable ZCOMP_CODE. Then write a select statement in ABAP and retrieve the value of 0COUNTRY from the master data table of 0COMP_CODE where Company Code value is equal to value of variable ZCOMP_CODE.<br>
    I hope I am getting you and you are getting me :-)<br>
    <br>Please let me know in case of any confusion.
    <br><br>
    Hope it helps.<br><br>
    Cheers Abhijit<br>
    </FONT><FONT FACE = "Verdana", Font Color = "Red">
    Removed
    </FONT>

  • How to Write a FOX Formula in Intergrated Planning Functions?

    HI BI-IP Experts,
    I have just written a FOX formula to call an ABAP Function Module which will execute a Process CHain to run.
    Here is what I wrong in the FOX formula in the Planning Function ZPF_FOX_CALL_PC.
    Call Function Z_CALL_PROC_CHAIN
    = * 1.
    I had to add in this line otherwise the system do not allow me to save the FOX.
    In the Function Module Z_CALL_PROC_CHAIN, it contains the following codes:
        SUBMIT rsprocess
               WITH type    = 'CHAIN'
               WITH variant = 'Process chain name'
               AND RETURN.
    Next I created a workbook with a button that executes this Planning Function ZPF_FOX_CALL_PC.
    The button contains 3 lines:
    CMD => Execute Planning Function
    Planning Function Name => ZPF_FOX_CALL_PC
    CMD => SAVE_AREA.
    After I clicked on the button, my excel seems to be running and I waited for very long but nothing happens.
    And it seems to be running and running and won't stop.
    Is it because the program is running in a loop because I missed out some codes in the FOX?
    Thanks,
    Shunhui.

    hi,
    Since you have not given any condition, the fox formula is being executed for all the number of records...thats why you are seeing the loop.
    example if you have 10 records in your BPS template, the formula is getting executed 10 times for each
    you need to select the field for condition which will make 1 entry, so the function module gets executed just once..
    or.. in the function module when you trigger the process chain, make an entry in a database table... when the 2nd row starts, it will check the table... if the entry exists, it will skip the scheduling of process chain... so on..
    In the process chain.. at the end, delete the entry from the database..
    so your code in the function module should be like this ... assume you have 10 records..
    select * from table zlock  where process chain name = pc name  
    (this is to check if the process chain is already running, if yes skip, if no trigger the process chain)
    if sy-subrc eq = 0.
    exit
    else.
    DATA: number           TYPE tbtcjob-jobcount,
          name             TYPE tbtcjob-jobname VALUE 'JOB_TEST',
          print_parameters TYPE pri_params.
    CALL FUNCTION 'JOB_OPEN'
      EXPORTING
        jobname          = name
      IMPORTING
        jobcount         = number
      EXCEPTIONS
        cant_create_job  = 1
        invalid_job_data = 2
        jobname_missing  = 3
        OTHERS           = 4.
    (this will trigger the process chain in background)
    IF sy-subrc = 0.
      SUBMIT rsprocess
      WITH type = 'CHAIN'
      WITH variant = 'PC name'
      VIA JOB name NUMBER number
                        AND RETURN.
    (after the process chain started, make an entry in the lock table.. so it will not be executed again)
    insert entry in table zlock
    ENDif.
    endif.
    I understand this is complex, but I think its one solution I can think of.

  • How to realize special scenario with FOX formula - FOREACH, variables

    Hello,
    we want to use the integrated planning for the following thing within the portal:
    A salesman should add manual values (planned turnover) for his top 10 customers. The rest of his yearly budget should be distributed automatically and equally to the rest of his customers.
    I thought a lot about it and arrived at the conclusion that:
    - we have somehow to put the salesman number into a variable maybe also the year for which the planning should be done -- Which possibilities are given to do this?
    - We need an additional flag that tells if this customer has to be planned / was planned manually.
    After the manual planning a planning function (FOX formula) has to be executed in order to
    1. get the budget that was already planned manually
        use of FOREACH in combination with an IF clause
        -- Which kind of FOREACH do I have to use?
    2. calculated total budget - manual planned budget = budget that has to be distributed
        after FOREACH
    3. count on how many customers the distribution has to be done and calculate the
        turnover per customer (rest budget / counted customers)
        use of another FOREACH loop which counts every value that hasn't got the flag set
    4. distribute the remaining budget on the customers that weren't planned manually
        -- Can it be done with something like turnover=value that should be assigned ?
    Maybe it's simple to realize this scenario but I'm a absolute "newbie" on that theme.
    Thanks
    Bettina

    Hi,
    I have been following this thread for quite long, here's my take on this
    1. Please create all the master data like sales man, customers in BI. for the key customers  add an attribute to key customer which can be a single character field.
    2. Add Sales man as an attribute to customer master and maintain values for each customer.
    3. Create an exit variable for customer number, this should read value from the sales man variable and populate all the key customers.
    4. Create an agg level with the above 2 and the required time characteristic. There will be 3 variables on the input ready query a. sales man number b. key customer exit variable c. some time period variable.
    5. Create a planning function of type generate combination for the agg level created in the above step. Add this function to the work book or the web template.
    6. Now salesman will be able to go in and create his budget for the key customers.
    Annual budget entry
    1. Create an agg level without customer, add salesman and time characteristics.
    2. create a query which will allow to enter data (yearly budget) for the salesman.
    Allocation to non key customers
    1. Create an agg level that should create the missing combinations sales man and non key customers. If designed properly the first agg level can also be used for this function.
    2. Create a fox function which with foreach loop for customer and sales man if the amount is 0 add 1 to counter, also read the value wtih customer as blank (yearly budget), lastly if the amount is not blank sum up the amount. This will help in getting the balance amount.
    3. get balance figure as total - allocated. One more foreach loop same as above if the amount is blank then amount = balance / counter.
    Tried to answer
    thanks

  • Type error while calling function module with in FOX formula

    Hi,
    I am getting following error while calling function module from FOX Formula:
    "Types of parameter DAY_IN () and variable J_CALDAY(D) are inconsistent"
    Following is the code:
    DATA    I_CALDAY       TYPE  0CALDAY.
    DATA    N_CALDAY       TYPE  0CALDAY.
    DATA    KYF              TYPE KEYFIGURE_NAME.
    FOREACH   I_CALDAY, KYF.
       CALL FUNCTION SLS_MISC_GET_LAST_DAY_OF_MONTH
          EXPORTING
             DAY_IN  =  I_CALDAY
          IMPORTING
             LAST_DAY_OF_MONTH = N_CALDAY.
        {KYF, N_CALDAY}  =  {KYF, L_CALDAY}.
    ENDFOR.
    Import parameter DAY_IN is of type sy-datum (that inturn is data element SYDATUM of data type DATS - same as 0CALDAY). Not sure why error is being thrown. Any idea? Thanks.
    Edited by: SAP_BOY on Dec 4, 2009 5:26 PM

    Hi,
    I think It will not identify ,though you have  (data element SYDATUM of data type DATS - same as 0CALDAY).Check it out by assigning it through a variable of type D.
    Data I_CALDAY TYPE D.
    Hope it may work out.
    Regards,
    Indu

  • Variables in FOX formulas in IP

    Hi All!
    I would like to create FOX planning function that will be based on variables.
    So, we have 2 variables AA and BB based on characteristics:
    1. For 0CALMONTH with tech. name AA
    2. For ZPROJECT with tech, name BB
    I have a query, where at the first screen I make a selection for ready-for-input variables AA and BB. Then, at the second screen I execute planning function via button.
    The sense of PF is copy all values of key figure ZKEYFIGURE from ZPROJECT = '0', 0CALMONTH = selected value of variable AA to ZKEYFIGURE of ZPROJECT = selected value of variable BB, 0CALMONTH = selected value of variable AA.
    In master data of characteristic ZPROJECT we have different projects. but 1 is with technical name 0. This is the first master data in table.
    DATA VAR1 TYPE 0CALMONTH.
    DATA VAR2 TYPE ZPROJECT.
    DATA VAR3 TYPE ZPROJECT.
    VAR1= VARV(AA).
    VAR2 = VARV(BB).
    VAR3 = VARI(BB, 1).
    {ZKEYFIGURE, VAR1,VAR2}={ZKEYFIGURE,VAR1,VAR3}.
    After execution I see , that records were read, but 0 generated, 0 changed.
    Maybe someone can advice what I do wrong?

    Firstly,for 0calmonth,the from and to value is same as you are using the selected values of variable AA.
    So no change in the value of 0CALMONTH
    Secondly, in the fox formula,  for zproject, you are using the same variables. Hence the fox formula understands that there is no change in the value.
    Define two variables for zproject, lets say proj1 and proj2.
    Assign proj1 ='0'.
    I have modified your fox code, give a shot with the following code, hopefully you might get the results as you want.
    DATA VAR1 TYPE 0CALMONTH.
    DATA PROJ1 TYPE ZPROJECT.
    DATA PROJ2 TYPE ZPROJECT.
    VAR1= VARV(AA).
    PROJ1 = 0.
    FOR EACH 0CALMONTH IN VARIABLE VAR1.
    PROJ2 = VARI(BB,1).
    {ZKEYFIGURE, PROJ2}={ZKEYFIGURE,PROJ1}.
    Endfor.

  • Calculating a Leap Year with a FOX Formula

    Hi to everybody.
    Is it posible to calculate a leap year using BPS in BW 3.5 with a FOX formula?
    The code i need to write is something like this:
    if ((year % 4 == 0) AND ((year % 100 != 0) OR (year % 400 == 0)) then
      it is a leap year;
    else
      it isn´t a leap year;
    endif;
    The problem i have is that my variable year is an standard type 0CALYEAR and I cannot do i.e.
    Year MOD 4, and save this value to an integer because 0CALYEAR and INTEGER are different types of variables.
    Any idea?
    Thanks in advance!
    Edited by: Ivan Lopez on Jan 15, 2008 5:24 PM
    Edited by: Ivan Lopez on Jan 15, 2008 5:24 PM

    Hi,
    Eventhough variable is on the characteristic 0CALYEAR, you can assign the variable value to an integer in FOX.
    Declare a local variable of type integer.
    DATA YEAR TYPE I.
    YEAR = VARV(variable).
    Now you can do MOD operations on YEAR.
    Regards,
    Bindu

  • FOX forumla in IP: can I use Planing-functions in a FOX-formula ?

    Hi All,
    I know that there is a possibility to call an ABAP functions via a function modules within a FOX formula,
    but is it also possible to use a standard planning functions in a FOX formula ?
    I have some planing functions created like the copy-function, the delete-function or the repost-function.
    Now I would like to use the standard planing functions within a fox formula.
    If it´s possible, how do I call them within a FOX formula?
    Thanks a lot 

    Hi,
    You would be knowing that any planning function gets the data to operate on, based on the filter using which it is executed - it can give entirely different output in two cases if the filters are different. Thats why it does not mean much to call a planning function from inside another planning function - think about it, the situation will get messy if that was done. As I understand, you probably want to execute some standard functions after some part of your fox code and after that is executed, get back on with the code.
    For such a requirement, you can break your fox into multiple parts and then combine the parts and the std. pl. functions in a planning sequence in the order you need.
    But please also remember that depending on the complexity, many times it is advisable to create one fox (or exit) function rather than a sequence of many functions. Reason being that each function's execution in the sequence will include some overhead due to the planning framework (determining the transaction and reference data, lock server etc), so if you create just one function for the whole operation, this overhead will get significantly reduced.

  • Fox Formula in Integrated planning.

    Hi All,
    I have a requirement like this.
    My data in cube is like this.
    SEASN BR    DU   ST      PS      VOL..
    SS09    AD    BB   ST1    PS1     100
    SS09    AD    BB   ST1    PS2     200.
    SS09    AD    BB   ST2    PS3     300.
    SS09    AD    BB   ST3    PS4     400.
    i need to count the no.of PS under one ST i.e for  ST1 the count should be 2 and for ST2 it should be1.
    The fox formula thar we are using is ,
    DATA DU TYPE ZDEVPUN.
    DATA SR TYPE ZGSMSR.
    DATA BR TYPE ZORBRANDS.
    DATA PS TYPE ZPRODSPEC.
    DATA SEASON TYPE ZSEANI.
    DATA ST  TYPE ZSOURCTYP.
    DATA COUNTER TYPE I.
    DATA PSA TYPE STRING.
    DATA PSB TYPE STRING.
    PSA = 'XXX'.
    COUNTER =0.
    FOREACH SEASON,BR,DU,SR,ST,PS.
    PSB =ST.
    IF PSA <> PSB AND PSA <> 'XXX'.
    COUNTER =0.
    ELSE.
    COUNTER =COUNTER +1.
    ENDIF.
    PSA = ST.
    ENDFOR.
    but while executing this code PS is considering  all four values i.e PS1,PS2,PS3,PS4 for ST1 and populating COUNTER with value 4.
    Please provide any inputs for this problem.
    Thanks in Advance.
    Reshma.

    Keep only PS and key figure name in fields to be changed and the remaining in field list.
    Write code as below.
    count = 0.
    Foreach PS.
    count = count + 1.
    Endfor.
    This will give you the count of PS for each combination of SEASN BR DU ST.

  • Fox formula for actual/plan data  - Planning function

    Hello,
    I am working on the following scenarios for developing a  planning functions for a monthly forecast.
    It is rolling montly forcast where user starts the planning in Jan and he has to show the actaul value for the month of Jan and blank values for the remaining 11 months of the year and then the user post his new forecast values for the remain 11 of the year(to replace initial balnk values) so that the data will be saved to real time cube with version v108
    In Feb, Jan & Feb months has to show the act values and remaining 10 months has to show last month forecast data. The the user may revise the forecast for the 10 months and then we have to write the data to the real time cube with version v208
    In Mar, Jan, Feb and Mar has to show the actual values and the reamining 9 months has to show the last month forecast and then users may revise the forecast data and then i have to write back to the cube with version v308.
    I want to automate this process for all the months and all years without manual intervention. So, i decideed to write a fox formula for this scenario with following draft code.
    I will get the fy period & year as a variable values and then take the system date into the variable
    for each fy period
    if the fy perio <= sys date.
      {version, infoprovider,value type,amount} = {0,act cube, 10, 0amount)
    else
    {version, infoprovider,value type,amount} = {result,plan cube, 20, 0amount)
    endif.
    result will be calculated on the separe routine and populated here
    case (fy per)
    when 01.
    concatenate v1 with fy+2(2) into y
    result = v1+y
    when 02.
    concatenate v2 with fy+2(2) into y
    result = v2+y
    when 03.
    concatenate v3 with fy+2(2) into y
    result = v3+y
    when 04.
    concatenate v4 with fy+2(2) into y
    result = v4+y
    when 05.
    concatenate v5 with fy+2(2) into y
    result = v5+y
    when 06.
    concatenate v6 with fy+2(2) into y
    result = v6+y
    when 07.
    concatenate v7 with fy+2(2) into y
    result = v7+y
    etc...for all months
    So, can you please let me know the best way to implement this (either by fox formuls or exits)...your inputs are really appreciated
    Thanks,
    Srini
    Edited by: srini on Mar 28, 2008 12:05 PM

    Hi Srini,
    If I 've understood u r problem clearly ,You have to write two Fox Functions and you can call exit variable in both to check the system date.
    I think first you should create exit varriable which would return the system date,use the same variable in data slice to lock the data till current period.
    After that create one fox restricted with any one version where you can copy the data for planning .for example:-
    1)First Fox:-
    DATA TIM_FISCPER TYPE 0FISCPER.
    TIM_REF_FISCPER = VARV(ZEXIT_FPER).
    Get the last month
    version using modlue or any another logic .(v108)
    FOREACH TIM_FISCPER.
        IF TIM_FISCPER <= TIM_REF_FISCPER.
      {0amount,version(001) ,tim_fiscper} = {0amount,version(000) ,tim_fiscper}.
    else.
      {0amount,version(001) ,tim_fiscper} = {0amount,version(v108) ,tim_fiscper}.
         endfor.
    Its just n example use the granularity according to the requirement.
    2)Second fox would save the changed plan data:-
    DATA TIM_FISCPER TYPE 0FISCPER.
    TIM_REF_FISCPER = VARV(ZEXIT_FPER).
    Get the last month
    version using modlue or any another logic .(v208)
    FOREACH TIM_FISCPER.
        IF TIM_FISCPER > TIM_REF_FISCPER.
      {0amount,version(v208) ,tim_fiscper} = {0amount,version(001) ,tim_fiscper}.
         endfor.
    Here ZEXIT_FPER is an exit variable created using cmod and populated with system date.
    Hope it will helpful for u.
    Rgds,
    Indu

  • Definition of Reference Data in complex Fox Formulas

    Hello IP Experts / Gurus / Developers,
    As far as I know there is no real concept behind the determination of Reference Data in Integrated Planning, when you do run functions from a sequence and not directly on a Dataprovider (where you have the possiblity to define editable and not editable structure elements).
    The reference data is generated at runtime of the FOX Code. Using Complex FOX Code with a nested loop, the reference data in the planning buffer (seen in Planning Modeller) isnt really the data that it should be. Some read statements (in loops, but also outside the loops) are not recognized and obviously do not lead to the definition of Reference Data. This is not a specific problem of my function or architecture. It doesnt occur, when I reduce the complexity of the FOX Code to a few rows.
    The question that I have is: Is there any possibility to define reference data in a fox statement or before running it?
    Function modules, hidden statements etc. ?
    Maybe a trick with running a loop like the one below (doesnt work, it also leads to immense performance issues)
    FOREACH YEAR, CCODE IN SELECTION.
       VALUE = {0amount, YEAR, CCODE).
       EXIT.
    ENDFOR.
    Thanks in advance for sharing your experience.
    Michael

A: Definition of Reference Data in complex Fox Formulas

Hi Michael,
   I don't think I understand from your post what is the issue that you are trying to solve; but it would not be correct to say that there is 'no real concept' behind determination of reference data.
Reference data is the data a planning function needs to read, which is outside the selection of the filter under which the function is currently running. So for the same function, reference data can change when running under different filters. Reference data can only be read, not modified - I am sure that is already clear. And also, the selection corresponding to reference data is not locked by planning.
Whenever you put any selection (inside the curly braces - {}) on the right hand side of the equal sign (talking about Fox), and if this selection is not contained in the filter, this data will be read as reference data. Also, statement like FOREACH in REFDATA will read reference data. Regarding the amount of data that is read (and hence the performance impact), it depends on factors like master data (for eg, in the Foreach statement in your code, it must be slow becuase of the huge master data that CCODE might be having), and number of records in cube, that are being read. You cannot really "define" reference data using code - it will be determined at run-time.
Hope this helps.

Hi Michael,
   I don't think I understand from your post what is the issue that you are trying to solve; but it would not be correct to say that there is 'no real concept' behind determination of reference data.
Reference data is the data a planning function needs to read, which is outside the selection of the filter under which the function is currently running. So for the same function, reference data can change when running under different filters. Reference data can only be read, not modified - I am sure that is already clear. And also, the selection corresponding to reference data is not locked by planning.
Whenever you put any selection (inside the curly braces - {}) on the right hand side of the equal sign (talking about Fox), and if this selection is not contained in the filter, this data will be read as reference data. Also, statement like FOREACH in REFDATA will read reference data. Regarding the amount of data that is read (and hence the performance impact), it depends on factors like master data (for eg, in the Foreach statement in your code, it must be slow becuase of the huge master data that CCODE might be having), and number of records in cube, that are being read. You cannot really "define" reference data using code - it will be determined at run-time.
Hope this helps.

  • Execution of Fox Formula's

    Hi,
    I have a general question about Fox Formula's. We created a planning function based on a Fox Formula which should distribute values from region not-assigned to other regions. I debugged the Fox Formula and am quite surprised to see that the Fox logic is processed/called twice.
    Why is the Fox logic called twice ? Can anyone explain this ?
    For your info, in our case the first time the internal tables contain all assigned values for region, the second time the internal tables contain just the not-assigned region. This is horrible if you need to define calculated fields in Fox that make calculations based on the assigned and not-assigned data. I managed to solve this via putting the variables in the ABAP memory (via a self created ABAP function) but this is really a solution I am not too happy about.
    Any ideas about this behaviour of Fox ?

    Dear Subha,
    I am sure there are plently of options but what I usually do is the following :
    1) I place an endless loop in the Fox Code : e.g.
    DO.
    IF FLAG = 'X'.
    EXIT.
    ENDIF.
    ENDDO.
    2) I launch the Fox Function in my IP application which will then hang due to the endless loop.
    3) Via transaction SM50 I search for my process which is hanging and I take it in debugging mode via Process > Mode > Debugging in the menu
    4) You will then arrive in debugging mode in your Fox formula and you'll see that ABAP is generated based on your FOX.
    5) Then you jump outside the endless loop in debugging, in this example you put value X in field flag and start debugging as usual via single step or others (F5, F6, F7,...)

  • Problem in writing Fox Formula

    Hello All,
    I need to write a formula to fill values in the  key figure.
    The value is to be sum of other two input ready key figures.
    ex a = b +c ( B and c are input ready key figures)
    To implement this i have to write a fox formula in planing function.
    I am new to Integrated Planning.
    Please let me know how this formula will be written.
    Regards,
    Pratighya.

    Hi,
    If you want to do a simple calculation like price = Quantity * Revenue for the year 2009. Then the code is
    Data prc type f.
    Data qty type f.
    Data rev type F.
    data d type 0fiscyear.
    prc = {2009,zprice}.
    qty = {2009,zquantity}.
    rev = {2009,zrevenue}.
    = * .
    {2009,zprice} = .
    Here prc,qty,rev are some buffer variables created here. zprice, zquantity, zrevenue are the keyfigures of your Infoprovider. 0fiscyear is the Time Characteristic of your Info Provider.
    Fields to be changed should be Ofiscyear becoz you are restricting the data based on year.
    If you dont want to restrict then the code will be
    Data prc type f.
    Data qty type f.
    Data rev type F.
    prc = .
    qty = .
    rev = .
    prc = qty * rev.
    Regards,
    Pushpa M

  • Maybe you are looking for

    • Can't transfer tunes on iPod to new computer...

      I purchased a new computer and am trying to transfer the music on my iPod to the iTunes library I set up on the new computer. It instructs me to go to "Store / Authorize" which I do. It then says I am now authorized for 2 of 5 libraries. But I still

    • Can't get movies to play

      I have the BlkBry 8100. I have some movies that I would like on my phone.  I've tried encoders but nothing seems to work. HELP! What am I doing wrong Solved! Go to Solution.

    • Lost IP address

      Today for the first time ever my MBP lost internet connection. I thought it was the modem or the router so I restarted both. I've had to do this before no big deal. After everything restarted I checked the network settings and it won't connect. Diggi

    • Help! Can't select an image

      I am no Photoshop expert but I have been using CS6 for a long time. Suddenly I can't select my image. I always clicked on the icon in the layers palette and it was "marching ants". Not working. I figured out a backdoor way yesterday but if someone ca

    • Could not save changes to this script because of a program error. -2706

      OK, this is very odd! Please try the following and let me know your results: 1) Create a new script with the following example code: set testList to {} repeat with i from 1 to 8145 copy i to end of testList end repeat 2) Save the script as an Applica