FOX Formula definition

Greetings All!!!
I am recieving an error
Types of parameter RATE (P) and variable RATE1(F) are inconsistent ..
I am using following FOX code
DATA FISC_VAR TYPE 0FISCVARNT.
DATA FISCYEAR TYPE 0FISCYEAR.
DATA RATE1 TYPE F.
FOREACH FISCYEAR.
CALL FUNCTION ZPLAN_SYS_VAR
  EXPORTINg
    CURRENT_YEAR = FISCYEAR
    FISCAL_VAR =FISC_VAR
  IMPORTING
    RATE = RATE1.
ENDFOR.
Where the type of field RATE in FM is Decimel 17 long and 3 decimal place.
Please treat this on priority

Hi Pratyush /Andrey..
Thanks for the suggestion,I realized that the RATE type in FM and in FOX are not same.Moreover the field where I want to return the value of RATE is CURR type in target and DEC in source field.
This assignment can't happen through FOX,we need to have same data type in order to assign the values.
Surbhi

Similar Messages

  • 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.

  • How to display my FOX formula result on the layout

    Hi Guru's,
    I have created one Fox Formula for OTB using the given below calculation
    Planned Open-To-Buy (Retail Price) = Sales / Retail Value +  Last Planned Stock (Retail Value) - Open Purchase Orders (Retail Value with Tax) - GR Posting Date / Vendor RtlT + Promotion Sales / Retail .
    When I am executing my Planning function (using BPS0) then it is working fine. It is showing the correct OTB value.
    I have insterted this FOX function into my layout using UPSPM tcode. When I execute the OTB calc function from UPSPM then correct data gets saved into my real-time cube. However OTB data is not getting displayed on my layout.
    Is there something else which I am supposed to do to display the result on the final layout ?
    Thanks,
    Ashu gupta.

    Hii Guys,
    Thanks a lot for your inputs. My issue has been resolved. I was not able to get the FOX formula output on the layout as the formula was not giving unique record. I have removed version char from my level and flds for selection. Now everything is working fine.
    Thanka again for your valuable time.

  • Variable used in FOx formula should get value from user

    Hi Gurus,
    In my fox formula I want to multiply a keyfigure (say quantity) with a factor. For example if the factor is 10 then all records should get multiplied by 10.
    But the requirement is user shpuld be able to give the factor that should be multiplied. That is the l_factor used in the fox function should be a variable which gets value from user. I know we can give variables in filter and planning functions in IP. But can we give values in Fox formula.
    I would really appreciate the time and effort.
    Thanking you,
    Jerry Jerome

    Hello,
    May be you can try this solution.
    I think you have create a dummy character info-object(Z_Number) of same data type interget number.Create variable for Z_Number and restrict in filter(ZV_NUM).
    DATA Z_MAT TYPE 0Material.
    DATA Z_NUM TYPE Z_NUMBER.
    DATA Z_NUM_READ TYPE I.(Declate same as data type for Z_Number)
    Z_NUM = VARV(ZV_NUM).
    FORACH Z_MAT.
    Z_NUM_READ = Z_NUM.
    {Z_KF1,Z_MAT} = Z_NUM_READ * {Z_KF1,Z_MAT}.
    ENDFOR.

  • How to change the variable value in fox formula?

    Hi All,
        Please help me achieve this scenario,
             in the variable selection screen , i wil give some i/p like, calyear(0calyear) = 2008.
          In planing function using FOX formula, i must be able change the variable value to 2009.
      Will it be possible to achieve this, can we change a variable value using FOX formula, if possible
    please let me knw how to achieve this.
    Thanks n Regards,
    Priya.

    Hi Priyadarshini,
    i dont know what is your requirement exactly.If you can give a better explanation of ur requirement we can help you. But to answer your question yes we can get new values for the variable in the planning function.
    for this you need to couple the planning function together with the planning filter in a planning sequence. This planning filter should have the variable that you wanted to change. In the WAD when you want to call this planning sequence there is an option to call variable screen. If you enable this, it will pop up the variable screen to get this value again.
    Guess this was helpful.
    Regards.
    Shafi.

  • Fox formula - Copy variable value to a characteristic in IP

    Hi All,
    I have to copy the value of a variable to a characteristic in Fox formula in IP. In this scenario I am forecasting data using copy function. Whenever new data is copied I need to save it as a new version. So in the fox formula I have mentioned only 'version' as the field to be changed. I get the value of version automatically from a function module. In BPS I think it is possible but I am using IP.
    Example.
    Copied data
    Customer Material Version Year Qty
    c1            m1          0           2012  10
    c2            m2          0           2012  20
    c3            m3          0           2012   15
    This is the reference data got as a result of copy function. In the code I get the version computed from a function module in variable fm_version.
    I wrote the logic like this.
    data lv_version type version.
    foreach lv_version.
    {0quant_b, lv_version} = {0quant_b, fm_version}
    endfor.
    When it is execute it is showing error as records changed and deleted.
    Is it the correct method or is there any other workaround.
    I would realyt appreciate your time and effort.
    Thanking you,
    Jerry Jerome

    Hello,
    You can use either standard copy function or fox formula.
    So here I need to make the version as 1 since it is forecasted for the first time. I am trying to do it with a fox formula. In the fox formula I am trying to change the characteristic value of version from 0 to 1.
    You can not change the characteristic value of version from 0 to 1. The copy function or fox formula will copy the key figures from version 0 to 1.
    For example:
    The transaction data contains data like -
    customer     material            year     version    qty
    c1                 m1            2012     0           10
    c2                 m2            2012     0            5
    After copy you will get both version like this
    customer     material            year     version    qty
    c1                 m1            2012        0        10
    c2                 m2            2012        0         5
    c1                 m1            2012        1        10
    c2                 m2            2012        1         5
    Thanks.
    With regards,
    Anand Kumar

  • How to implement this planning function using Fox formula

    Hello,
    I am new to Fox.
    I want to implement this complex logic in a planning function
    i have A (Kf X from infoprovider Z_A), B (Kf Y from infoprovider Z_B) & moreover there is one more condition,
    If current FISCPER > variable value of FISCPER
    KF Z = KF Z1 (from Cube C1)
    Else KF Z = KF Z2 (from Cube C2).
    for a particular calender week,
    X =   ( Y * Z ) / (summation of (Y * Z)  for each week of the whole year)
    I know it is complex.
    but i have to implement this in a planning function.
    The aggreagtion level is built on a multiprovider having A, B , C1 & C2.
    Can someone help me out with the FOX formula for this? or is there any better way to do this.
    Thanks john

    Hi Gerardo,
    Thanks for that.
    I have tried something similiar to it
    DATA CHA_CALWEEK TYPE 0CALWEEK.
    DATA CHA_COMP_CODE TYPE 0COMP_CODE.
    DATA CHA_FISCPER TYPE 0FISCPER.
    DATA VAR_PERIOD  TYPE 0FISCPER.
    DATA SUM_YEAR TYPE F.
    DATA TEMP_D TYPE F.
    DATA SUM_WEEK TYPE F.
    CURRENCY IS LOCAL CURRENCY. FOR DATA SELECTION TO BE RIGHT, NECESSARY TO DERIVE FROM CC.
    DATA UN_LOC_CURRCY TYPE 0LOC_CURRCY.
    UN_LOC_CURRCY = VARV(Z_U_I100).
    CHA_COMP_CODE = VARV(Z_U_I100).
    To Calculate the D
    VAR_PERIOD = VARV(Z_U_I010).
    SUM_YEAR = 0.
    TEMP_D =0.
    IF CHA_FISCPER > VAR_PERIOD.
    TEMP_D = {ZSA_BUD2X,CHA_COMP_CODE,CHA_FISCPER,YBUDG_01X,CHA_CALWEEK}.
    FOREACH CHA_CALWEEK.
    SUM_YEAR = SUM_YEAR + TEMP_D * {ZCREENTSV,CHA_COMP_CODE,CHA_FISCPER,ZIP_RREF1} .
    ENDFOR.
    ELSE.
    TEMP_D = ({ZSAEXCUSV,CHA_COMP_CODE,CHA_FISCPER,YRT_C02X} - {ZCREENTSV,CHA_COMP_CODE,CHA_FISCPER,YRT_C02X}).
    FOREACH CHA_CALWEEK.
    SUM_YEAR = SUM_YEAR + TEMP_D * {ZIP_INDEX,CHA_COMP_CODE,CHA_FISCPER,ZIP_RREF1}) .
    ENDFOR.
    ENDIF.
    But i am getting a syntax error
    Formula error: } expected
      Syntax error in row 21, column 20
    i have marke line21 in bold. above.
    I feel it is correct, still wonder why i am getting this error.
    can you pls help ?

  • Set global variable in FOX formula

    Hi all,
    Does anybody know how to change the value of a global variable inside a FOX formula?.
    I can get its value and assign to a local variable but I would like to set the global value after reading a keyfigure and make some calculations.
    is it possible? maybe with some ABAP function call?
    Thanks for your help!

    Include characteristic HIRE in your 'fields to be changed' of planning function and in FOX write:
    DATA L_HIRE TYPE HIRE.
    DATA EXISTBPSID TYPE ZTA_BPSID.
    DATA BPSIDNO TYPE ZTA_BPSID.
    BPSIDNO = VARV(BPSTAS2).
    FOREACH L_HIRE.
    IF EXISTBPSID = '#'.
    {L_HIRE,BPSIDNO} = {L_HIRE,EXISTBPSID}.
    BPSIDNO = BPSIDNO + 0000000001.
    ENDIF.
    ENDFOR.

  • 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 using ABAP function in fox formula ?

    Hello,
    I want to launch standard function :"RSW_CURRENCY_TRANSLATION" by Fox formula. I declare this function in SAP Table :rsplf_fdir, and I can call this function by fox, with all parameters.
    But when I want to use it, I've a problem with the first parameter : "Formula error: Type RSR_CTTNM is not permitted"
    What's the solution ?
    Best regards,

    Hi Cyril,
    I read the fact that you have chosen to use CURC instead of the Function Module.
    Did you fix your exchange rate type in your CURC formula: For example:
    CURC (LCAMT,12312008,EURP,LCUR,GCUR).
    Or did you make into a variable, that can be chosen at run time?
    I'm asking because I'm trying to make the 'exchange rate type' in this formula to be more dynamic (like a local variable).For example:
    DATA EXRATE TYPE 0RTYPE.
    DATA EXRATE_V TYPE 0RTYPE.
    EXRATE_V = VARV(EXCHRATE).
    {0AMOUNT,GCUR, GCTYPE,FYPERIOD,VERSION,COSTELM,INT_ORDER} = CURC (LCAMT,12312008,EXRATE_V,LCUR,GCUR).
    But the system returns the error meesage that it doesn't recognise 'EXRATE_V' even though i have declared it earlier on. So I have a fear that the system is expecting me to enter a fixed exchnage rate type that exists in RSCUR, in this formula..!!  Is that true??
    I don't want it to be fixed in the formula, it should be chosen at time of planning. How do you have yours right now? Do you know why I get this error message, and what I need to do to in the FOX formula, to make sure it can be populated at run time?
    Thanks for your help and information in advance.

  • How to convert a string from upper case to lower case in FOX formula

    Hi Experts,
    How to convert a string from upper case to lower case in FOX formula?
    Thanks,
    Cheers!!!
    PANKAJ

    The last result.append( c ) should be:
    result.append( Character.toLowerCase(c) );

  • Using BPS numberic variables in the FOX formula???

    Hi all,
    Can someone tell me how to use one variable (<b>the variable type is 'numberic'</b>) in the FOX formula? Thank you.
    FOX formula example:
    <b>Inventory $= inventory unit * inventory (per unit) * depreciation monthS (<u>this is a numberic variable</u>.</b>
    J.

    Hi John,
       You can use the VARV function to get the value of the numeric variable in FOX.
       Lets say your variable for depreciation months is ZDEPMTS.In your FOX, you
       can say: Inventory $= inventory unit * inventory (per unit) * VARV(ZDEPMTS).
       Hope this helps.
    Cheers
    Srini

  • 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.

  • Message in fox formula

    Hi,
    I have a fox formula, I write a red message code
    MM = VARI(ZVALID, 1).
    IF MM <> #.
    MESSAGE E001(ZBW).
    ELSE.
    if the variable A has not the value # send the message.
    That works fine, but the message appears by each subset,  and also appear other messages in green/yellow color.
    how can I write the code to send only one red message, and not one message by each subset or green/yellow messages?
    Regards
    Victoria

    Hi Victoria,
    to show this message only one time it is needful to put all characteristics of your planning level in the fields to be changed of the corresponding planning function. This means, that the system will generate only one data-package including all data of your planning-level-selection and now the fox-coding is called only <b>one</b> time !
    In GUI it is not so easy to suppress the green and yellow system-SAP-messages, in the Web-Interface-Builder you can supress all messages with a special method.
    Bye Gil

  • Maybe you are looking for

    • How can i accentuate whites and blacks in photoshop b/w ,no acr?

      Hi how can i accentuate whites and blacks in photoshop in black and white photos? i tried silver evef 2 and there is a feature to boost whites and blacks http://www.niksoftware.com/silverefexpro/usa/entry.php?view=usa/features.html#amplify_blac ks_an

    • Upgrade Oracle 10g AS 10.1.2.0.2  to 10.1.2.3 on Windows

      Hi Friends, I am using Oracle 10g AS 10.1.2.0.2 on windows and i would like to upgrade it to 10.1.2.3. Please provide me the Document for this. Regards, DB

    • Using NLB over Application Server in SharePoint 2010?

      I have two application server that I need to load balance using Microsoft NLB. My queries: 1) Just load balancing the Application Server will load balance the SharePoint service as well?   2) How would service application on application server would

    • Opening a CD with photos saved as JPG.

      Hello I've looked through all the "error -43" files I could find. When I insert a Cd that has photos saved from around 2005, most likely from a computer running windows ... I open the picture folder on the Cd, there are no picture icons, so I ask it

    • Lost Adapters in Adapter Monitor

      Hi, buddies, We've applied install guide SR1 and Release 3.0 SPS18. But in our adapter monitor, there's two adapter engine, both of which contain only the "JPR adapter" with green status and no other adapters. Anyone who can help us? B'Rgds,