Formula variable for dates

Hi gurus,
I am trying to fill a formula variable of type date via manual entry, but I cannot find which is the correct way to do it. I can introduce any other type of data (amount, prices...) via manual entry but I can´t do the same with dates. Any help about this??
Thanx.

Hi Ortiz,
You can do it like this:
1. Create one variable based on any date field.
2. In you query In column create 1 selection, restrict any key figure with this variable (created above). In display property set Hide.
3. Create 1 formula variable with processing type customer exit and choose dimension as date.
4. Now in CMOD, write the below code for your formula variable:
Suppose the source variable name is ZDATE1,
Forumla var name is ZFinal_date
Code it like this:
when 'ZFinal_date'.
READ TABLE i_t_var_range INTO wa_value WITH KEY vnam = 'ZDATE1'.
        wa_range-low    = wa_value-low.
        wa_range-opt    = 'EQ'.
        wa_range-sign   = 'I'.
        APPEND wa_range TO e_t_range.
Now u will get the date inputed value in your formula cariable.
5. Create 1 CKF and do the subtraction in there:
if ur key figure name is KF1 then type forumal as:
KF1 - ZFinal_date.
Hopefully u wil get the desired output.
Thanks
Dipika

Similar Messages

  • Formula variable for date in report

    Hi All,
    I have to display the last date value of a particular date in the report.
    For a better understanding,
    I have Customer, Equipment, Service date, Amount
    In the report, I have to display
    Customer, Equipment, Last Service date, Last Service Amount.
    I have created a formula variable (Formula variable for Service date) for Service date with Replacement path.
    Replace Variable with Infoobject, Replace with Key, Dimension dates.
    And in Key figures, I have created a formula (Last Service date) with Last value in the Aggregation using the "Formula variable for Service date".
    The Last Service date is displayed as 'X' in the report since the Service date is not in the row. I cannot have the service date in the row either (not even by hiding the display).
    Kindly tell me how to rectify this problem.
    Thanks and Regards
    Adhira Anand.

    The X is appearing because, with the drill downs you have added, you have more than 1 date value to choose from when you attempt to aggregate.
    Have you tried using APD instead of exception aggregation?
    Have you built the exception aggregation calculated key figure globally or just locally (i.e. as a structure element)? It must be built globally to work properly.

  • Formula Variable for Date/year not possible

    Hi, I have a query where I want to create a formula variable for a year that I can use in a user exit to populate other variables.  When I go to create a formula variable there is not option for a date or year variable.  I only see Amount; Quantity; Price; Number.  Is it possible just to create a formula variable for a year input without having a year time characteristic in the query?
    Thanks!

    I just ended up creating a Formual Variable as a number.  Thank You

  • Formula variable for date calculations with date-characteristics (2004s)

    Hi SDN,
    I'd like to calculate the number of days between to date-characteristics. In 3.5, I was used to create 2 formula variables of the type 'replacement path', with 'date' as the dimension indicator. In my formula, I used the 'proces value as date' function for each variable, and I could perform calculations with them.
    I'm trying to do the same in 2004s. However, I can't create replacement path's with 'date' as a dimension indicator. So I use 'number' instead, but it doesn't work: my query shows 'x'.
    I can use the variables that I created using the 3.5 query designer as a workaround. But I hope there is a better solution.
    If other people experience the same problem, please respond. Then I know it's probably a bug.
    Kind regards,
    Daniel

    Daniel,
    Try to look at the formula variables defined before the upgrade and see what is different to the newly defined. I am guessing just the terminology used is different.
    If not the date value might be blank or something for one of the f-variables used. Try to display the formula variable values as KF in the query results and check what it is showing.
    I hope this helps.
    -Bala

  • Formula variable for a user input DATE value

    Hi All,
    I want to create Formula variable for a user input DATE value as I need to use it in a formula to compare between user entry date & date in the DSO. Does any body has any idea about it?
    I tried to create formula variable with manual entry but then I am not getting DATE option.
    Regards,
    Sonal

    Hi ,
    You have to create a formula variable in the formula.
    The formula variable in the general tab would have the reference characteristic as your date characteristic on which you have created a user entry variable or on which you intend to create a date entry variable.
    Give the proceesing type as replacement path.
    Next in Replacement path mention you would replace the variable with value of another variable.
    Mention the variable name.(This is the actual varaible created on the selection screen),
    Also mention you would replace only from value/to value of the variable.
    Check the following help link
    [Replacement path type formula variable|http://help.sap.com/saphelp_nw70/helpdata/en/e3/e60138fede083de10000009b38f8cf/frameset.htm]
    Hope this helps,
    Best regards,
    Sunmit.

  • Formula variable using date char - unable to use conditions

    Hello Experts,
    I am sure I am making a silly mistake here - but after spending lot of time I am unable to rectify this - please help if you can:
    I basically want the report to show only latest employee actions for a selected period (usually month).
    1. I am using formula variable that is based on 0CALDAY and defined as number.
    2. A calculated keyfigure uses this formula variable. Both calculated keyfigure and CALDAY char are included in the report / navigation.
    3. There is a condition defined using calculated keyfigure. No matter what logic I use, I just cannot use calculated keyfigure to filter records on the report. My original idea was to use Top N - 1 with char combination as 'Employee' to get me the latest employee records for each employee.
    Can anyone help spot where I am going wrong?
    Thanks.

    I haven't looked at that, but as a first guess idea- why not use the picker to get a date, then save it as a number of seconds from a given date?
    See:
    dateWithTimeIntervalSince1970:
    Creates and returns an NSDate object set to the given number of seconds from the first instant of 1 January 1970, GMT.
    + (id)dateWithTimeIntervalSince1970:(NSTimeInterval)seconds
    Or you could store it as a string, but I think the number would be easier.

  • Condition formula variable on date key figure

    Hello, I would be grateful for any help on this
    I want to have a condition that has a user input formula variable
    But the Key Figure on which I want to base the condition is a Date
    And when you create the formula variable it allows only the following Dimensions :
    Amount
    Number
    Price
    Quantity
    ie Date is not one of the allowable Dimensions - is there any way round this apart from an Exit variable ?
    thanks
    Jon

    Hi,
    You have to create a formula variable with replacement path based on the date you want.
    so that you can get the date for calculation.so you can apply condition.
    check the following link
    http://help.sap.com/saphelp_nw04/helpdata/en/03/6ba03cc24efd1de10000000a114084/content.htm
    Regards,
    Ranganath

  • Formula variable - Maximum Date in result output

    Hello Guys,
    Scenario -
    Data in Cube
    *Reseller      Sales Date*
    RS1          01.01.2010
    RS1          01.01.2011
    RS1          01.01.2012
    RS2          01.01.2008
    RS2          01.01.2009
    RS2          01.01.2010
    Required Output - Display one record for each Reseller with recent Date.
    *Reseller      Sales Date*
    RS1          01.01.2012
    RS2          01.01.2010
    What I did till now --->
    Created a Formula and included a Formula Variable (replacement Path ref char - Sales Date) hence I got the date as keyfigure.
    Reseller      Sales Date     Sales Date Formula
    *RS1          01.01.2010     201,00,101*
    *RS1          01.01.2011     201,10,101*
    *RS1          01.01.2012     201,20,101*
    *RS2          01.01.2008     200,80,101*
    *RS2          01.01.2009     200,90,101*
    *RS2          01.01.2010     201,00,101*
    For the Sales Date Formula (Calculation tab - Calculate result as Maximum) to display the result as maximum.
    The issue is that when I remove the Sales Date from Drilldown the Sales Date Formula display X. I was expecting the result row to be displayed i.e  the maximum value for RS1 and RS2.
    Can you guide where I am going wrong... or any other method to achieve the above output is appreciated.
    -Amit

    Hi,
    Through replacement path you can achieve this.
    On row side put *Reseller.
    on Column side create a formula(and  on Aggregation Tab: Exception Aggregation: Last Value, Reference Characteristics: Sales Date)
    and there create formula variable and use replacement path.
    Details
    Type of variable: Formula
    Processing By: Replacement Path
    Reference Characteristics: Sales Date
    Replace variable with: InfoObject
    Replace With: Key
    Dimension: Date

  • Formula Variable: Current Date

    Can somebody let me know the SAP Delievered Current Date Formula Variable Name.
    Cheers!!
    Amit
    9990800302

    Hi.......
    As already said....you can use 0F_ADAY.....
    Usually global variables (as formula) are available for every query (and not specifically to a single provider)...in addition, you can find all the formulas when you build a new object (new formula) in your query (you can choose from formula hierarchy)...
    Check this..........
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/324de5a1-0201-0010-dc9a-a093cde87bb5
    Customer Exit.......
    http://help.sap.com/saphelp_nw04/helpdata/en/f1/0a56f5e09411d2acb90000e829fbfe/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/1d/ca10d858c2e949ba4a152c44f8128a/content.htm
    Regards,
    Debjani.........
    Edited by: Debjani  Mukherjee on Oct 29, 2008 4:47 PM

  • Formula Variable for Current Time

    Friends,
    Is there any standard formula variable available to display Current Time in Report??..like we have 0F_ADAY to display current date..
    Thanks in advance..
    Regards,
    Yog

    I am not sure that standard fomula variable existed for the current time. But
    you can create a formula variable with customer exit processing type. Then write an exit with SY-UZEIT. you will get the current time.
    Hope it helps.
    Veerendra.

  • Replacement path variable for date not working

    We have a formula variable using replacement path (BEx 7.0) for a date field and after that we have calculated key figures to perform date difference calculations.
    This was working perfectly well until recently when the calculated key figures displayed an "X" instead of the value.
    The value seems to appear only when the date fields are drilled down in the report.SO this works like a formula instead.
    Is this just an unnatural case where something just stopped working ?
    We have checked the calculated key figures and the formula variables , they havent been changed in the recent past.
    Is there any other solution you could offer to get date differences without having the date fields in the rows ?
    Edited by: ABCD on Jul 29, 2009 2:28 PM

    How to use Replacement Path Variables to perform Date Calculations
    A Step-by-Step guide
    Have you ever wanted to perform calculations using dates defined as characteristics but have never worked out how it can be done? Replacement Path Variables are the key.
    Using Replacement Path in your Text and Formula variables, replace values held in a characteristic. The Characteristic value variables are replaced by the results of a query at run-time.
    The steps detailed below show a technique to enable a BEx query user to determine the number of days between two dates.
    Scenario:
    The group HR administrator wants a detailed line item report that lists all employee absences in a given period. The report is to show the employee number, the absence start date, together with the end date of the absence and show the number of calendar days the employee was absent.
    The good thing about using this technique is that no redesign work is needed from your technical BW team, no ABAP is involved and best of all, it quick and easy.
    Solution:
    For this example I created an ODS object called Absence that holds basic employee information along with individual absence record data.
    Follow the steps below:
    1.     Open the BEx Query Designer and create a new report on your chosen InfoProvider.
    2.     Drag the Employee, Valid from and Valid to characteristics into the Rows section of the screen.
    If needed, apply data selection restrictions to the characteristics as shown in Figure 1.
    3.     Right click on the Key Figures structure and select New Formula (Figure 1).
    Figure 1
    4.     
    5.     In the new formula window right click on Formula Variable and choose New Variable ( Figure 2 ).
    Figure 2
    6.     
    7.     The Variables Wizard will launch and will require you to specify the variable details.
    ( Click the NEXT button if the Introduction screen appears )
    8.     Enter the variable details on the General Information as shown in Figure 3 .
    Enter the Variable Name , Description and select Replacement Path in the Processing by field.
    Click the Next Button.
    Figure 3
    9.     
    10.     In the Characteristic screen (Figure 4) select the date characteristic that represents the first date to use in the calculation (From Date).
    Click the Next Button.
    Figure 4
    11.     
    12.     In the Replacement Path screen (Figure 5) select Key in the Replace Variable with field. Leave all the other options as they are (The offset values will be set automatically).
    Click the Next Button.
    Figure 5
    13.     
    14.     In the Currencies and Units screen (Figure 6) select Date as the Dimension ID.
    Click the Next button.
    Figure 6
    15.     
    16.     The Save Variable screen (Figure 7) displays a summary of the new variable.
    Click on the Finish button to save the variable.
    Figure 7
    17.     
    18.     Repeat steps 4 to 11 to create a second variable for the second date to be used in the calculation.
    In the example shown, the characteristic 0DATETO is used to create the variable ABSEND (Absence End Date).
    Define the Calculation
    We can now use our two new replacement variables to define our new calculated key figure that generates the number of absence days for each record.
    1.     You will now be back at the New Formula screen (Figure 8). Drag and drop the two new variables into the formula section of the screen and insert the subtract sign (u201C-u201C) between the two.
    2.     Give the new formula a description and click the formula syntax check button  to ensure the formula is valid.
    Figure 8
    3.     
    4.     The new calculated key figure will now show in the columns section of the BEx query designer (Figure 9).
    Figure 9
    5.     
    6.     Save the query and execute it.
    In the example shown the Number of Calendar Days Absent is calculated correctly. See the table of results below.
    Employee     Valid From     Valid To     Number of Calendar
    Days Absent
    50000001     17/04/2004      21/04/2004      4
    50000002     16/07/2004      29/09/2004      13
    50000003     07/01/2004      09/02/2004      33
    50000004     04/08/2004      05/08/2004      1
    Cheers:)
    Vivek

  • Formula Variables for Report Painter

    Dear Experts,
    I have a Report Painter Report which displays month wise report in columns and now i want the report to be displayed based on the period mentioned in selection screen.
    Can someone please advice how do I do the same with use of Formula Variables.
    Regards,
    Rahul

    Go to the selection screen and press F1 and go to technical details to name the name of the screen field. example: 8A-VON (period from) and 8A-BIS (period to).
    In your report designer, you enter the those variable for the "period" characteristic and tick the variable ON/OFF checkbox.

  • Formula Variable for Each Row

    Is there any way to make the formula variable take different values for different rows in a given report?  Our requirement is that each sales division in US will be approved of a certain percentage of rebate that it can use.  In the report one should see the net sales value after considering the % rebate.  For e.g., US has East, West, South, Central and Midwest Sales Divisions.  There are 5 product lines, prod1 to prod5.  The client will maintain a Z table for all the combinations of Sales division and Product line (i.e., East & prod1 - 10%, East & prod2 - 3%...  Midwest & prod5 - 5%).  Actual sales done in each sales division will not have these rebates considered.  So at the corporate level when the report is executed, the query should be able to apply the corresponding values to the actual sales.  Is it possible with BEx?  As far as I know, the user exit is not executed for each row.  Hope I was lucid enough to explain the problem at hand and if anyone has any effective ideas on this issue, please post your thoughts here.  Thanks a ton in advance.
    IS

    Hi,
    I doubt that you'll be able to do it in BEx.
    The easiest way is to include a rebate into your infoprovider.
    Best regards,
    Eugene

  • OLAP variable for data selection

    hi all ,
    can any own explain how the OLAP variable is used for data selection in the info package. how the value is changing in the Variable.
    thanks in advance
    rajan

    Hi Rajan,
    You will not be entering any date value. As Dirk mentions, the value will be filled into the variable by way of an exit, i.e. automatic processing according to some code.
    Like your date variable can get you the first of the previous month from the exit processing.
    Hope this helps...

  • "global"  variables for data slices

    Hello experts,
    Can someone tell me how to create a global variable which can be set for all user of a planning application?
    I want to use this variable to be used by one or two users, so that they can lock the planning data by setting the variable. The variable will be used in a data slice and by changing the value of the variable, they are also able to change the range of the data slice. I thought that I found the solution, but in the end I remembered that variables are user specific and therefore has to be set for each user.
    I hope that one of you has a solution (not using STS) for this problem.
    Kind regards,
    Harald van der Meij

    Hallo Harald
    I see your point and i hope this can help you.
    Create a Variable of type exit which get the values for data freezing.
    For example: Calmonth.
    then in the Function Module, derive Calmonth making the Select from a custom table. give the rights to the two user to maintain the table for lock and unlock the planning.
    Based on entries on the tables, then you can have the value for Calmonth. based on it you freeze or unfreeze the data.
    of course you can use any Characteristic.
    for example:
    you want to freezee from 01.2005 to 10.1005. pass these values to the variable making a select from the custome table (Zfreezing) where you maintain 01.2005 to 10.2005.
    if you need then to reopen the planning, then cahnge the values in the tables and consequentely to the variables.
    the user can maintain entries in the tables.
    When you create the table assign an authorization group and then create a role with it and assing these the two users.
    Regards
    Mike

Maybe you are looking for