Arithmetic operations with date characteristics.

Hi gurus....i want to to subtract 2 time characteristics directly in BEx so i can get de difference between 2 dates. how can i do it?
In fact the specific requirement is to subtract from de execution query date a time characteristic.
Is there a sysdate variable that gives me the execution date of the query??? or i have to use a user exit variable to do this?
Thanks and regards.

hi Rafael,
take a look
http://www.sd-solutions.com/documents/SDS_BW_Replacement%20Path%20Variables.html
hope this helps.

Similar Messages

  • Arithmetic operations with time

    Hi all,
    I want to do arithmetic operations with time data types. Like
    d1,d2,d3 are of date types
    long diff = d1.getTime()-d2.getTime()-d3.getTime();
    long hours = diff/(60 * 60 * 1000) % 24);
    long mins = diff / (60 * 1000) % 60;
    long secs =  diff / 1000 % 60;
    When i am entering time for d1 as 4:00:00, d2 as 9:00:00 and d3 as 1:00:00, i am getting hours & mins in negative values.
    Can anyone suggest how to do this operation

    hi sahithi,
    when d1 d2 and d3 are date types how can u enter or set 4:00:00 to it, which is time representation.
    what exactly u are trying to do ...
    and it is obvvious that d1-d2-d3 is 4:00:00 -9:00:00 -1:00:00 here u can see that 9 is greater and its sign is predominant according to this expression. hence diff is negative value. and then as usuall hours and secs are also in negative.
    any how follow below code you can solve yoru issue i hope
    String fromdate = "11/03/14 09:29:58";
        String enddate = "11/03/14 09:33:43";
        Custom date format
        SimpleDateFormat format = new SimpleDateFormat("yy/MM/dd HH:mm:ss");
        Date d1 = null;
        Date d2 = null;
        try {
            d1 = format.parse(dateStart);
            d2 = format.parse(dateStop);
        } catch (ParseException e) {
            e.printStackTrace();
        long diff = d2.getTime() - d1.getTime();
        long diffSeconds = diff / 1000 % 60;  // for seconds
        long diffMinutes = diff / (60 * 1000) % 60; // for minute
        long diffHours = diff / (60 * 60 * 1000); // for hours
    wdComponentAPI.getMessageManager().reportSuccess
    ("Seconds---> " + diffSeconds +"sec");
    wdComponentAPI.getMessageManager().reportSuccess
    ("Minutes---> " + diffMinutes + " min.");
    wdComponentAPI.getMessageManager().reportSuccess
    ("Hours--->" + diffHours + " hrs.");
    Regards
    Govardan

  • Using Modulus (%) arithmetic operator with decimals

    When trying to use the arithmetic operator modulus with decimals there seem to be some errors in the results. Is there a restriction on the number/value of decimals that can be used with this operator? Am I perhaps just using it incorrectly?
    example ...
    Double valA= new Double("12.4");
    Double valB = new Double("1236");
    double result = valB.floatValue() % valA.floatValue();
    System.out.println("valB : " + valB );
    System.out.println("valA: " + valA);
    System.out.println("result : " + result);
    produces :
    valB : 1236.0
    valA : 12.4
    result : 8.40003776550293
    But :
    Double valA= new Double("12.5");
    Double valB = new Double("1236");
    double result = valB.floatValue() % valA.floatValue();
    System.out.println("valB : " + valB );
    System.out.println("valA: " + valA);
    System.out.println("result : " + result);
    produces :
    valB : 1236.0
    valA : 12.5
    result : 11.0

    Floating point arithmetic in general is not exact. The problem is that you are expecting exact results.
    In the second example where you use 12.5 and 1236.0 is just so happens that both of those numbers can be represented exactly, so you do get an exact result.

  • 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

  • Operation with dates

    I need to subtract to a date seconds and that me the result in format dates (ddmmyyhh24miss). This operation in sql.
    Thanks

    You can subtract any unit of time (including seconds) from a date. Just remember that a day = the number 1, so that yesterday is found by the query SELECT SYSDATE-1 FROM DUAL;
    There are 1440 minutes in a day, so if you want now + 10 minutes you would SELECT SYSDATE + 10/1440 FROM DUAL;
    Formatting requires the TO_CHAR function such as SELECT TO_CHAR(SYSDATE - 1/24, 'DD-MON-YYYY HH24:MI:SS) FROM DUAL;
    If you have 9i then look at SYSTIMESTAMP. As you know SYSDATE can give you times to the second. The new
    SYSTIMESTAMP can give you fractional seconds upto 6 decimal places. Oracle 9i also has a new INTERVAL format so you can add/subtract
    an interval of time from a date.
    -Mark

  • Operating with dates

    Hi,
    I would need some help from you, I would have to sub two dates in order to know how many months are between those dates.
    Since I haven't seen any method neither in Calendar nor Date classes I'm doing this:
    long dateIniL = dateIni.getTime();
    long dateToL = nextBDate.getTime();
    long result = dateToL - dateIniL;
    long months = result / 1000 / 60 / 60 / 24 / 30;
    int m = (int) months;
    but, I'm not sure divided by 30 for getting months is ok because there are months with 28,29,30 and 31 days ...
    Do you know a better way to do this?
    Thanks

    That is the problem, not all months are 31 days, so
    to calculate the number of months manually is a
    problem, I think it would have been done already in a
    method or so.No, I think the problem is you haven't made your mind what a month actually is. See, in the common sense, a "month" is one of twelve things: January, February, March, you name it. That's a "month". These are defined periods in the year, independently of the year (except for february). They're not time units.
    On the other hand, one often uses the term "month" to describe a period of approximatively thirty days. But that's approximative. It's not defined.
    To count how many "months" there were between two given dates, you must either:
    a) define a time period (in days or hours or cheeseburgers) that you'll call a "month"
    or b) decide whether to count the real months between the dates, and for that you must decide whether to count the months (real months) strictly between (i.e. exclude the months the dates are in from the count) or to include these months.
    At least that's how I see it.

  • Arithmetic operations using Picklist field values

    Hi,
    I tried to multiply a picklist field value as below and wanted to store the result in a field (datatype = Integer or Number) using a workflow which triggers based on the Trigger Event "Before modified record saved".
    Criticality = [<plFrequency_of_Occurrence_ITAG>] * 10
    It throws an error:
    "Update Criticality : Value too long for field 'ZNum_0' (maximum size 16). (SBL-DAT-00235)(SBL-ODS-00500)"
    Can't we do arithmetic operations on the Picklist fields? I believe this is because the values are being stored as text??
    Do we have a function to convert the character field to numeric before we perform any arithmetic operations?
    Thanks,
    Sriram

    Hi,
    You're right, you can't perform arithmetic operations with a number and a text. That's why you get the error.
    Today, there's no function you can use to convert a text to a number.
    You'll need to create a SR asking for a Change Request.
    Regards,
    Max

  • Formating and operating with integer values

    I am new to XML Publisher.
    I have a task to make a layout using rtf. The problem is that I must do an arithmetical operation using data generated from a system report. I must not modify the report!!!
    The value retrieved from report is of X.Y format which means a time period (X - years, Y - months). So I want to split this value in two - one for years and other for months with a posibility of making arithmetical operations over them. Is it possible?? And if so, cand anybody give me a solution for this...?

    ok, back to the problem. As I red in the XML Publihser Users Guide there is a posibility to transform strings in numbers, but I can't figure out how it works! As speaking of my problem I can not do arithmetical operations with that value (YEARS.MONTHS). I tried the to_number function described in XML Publisher User's Guide (page 7-3) over the vlaue x.y, I tried to change the point (x.y) to a comma (x,y) and again aply to_number function over resulted value, but it doesn't work. What do I do wrong?
    I tried the solution of spliting the x from y, but I run into a problem again. The years part x has a variable length so I can't get the y part. (the substr function didn't worked with negative start position - substr(DATE, -3, 3))
    Generaly I'm a very confused about XML Publisher. There are examples in User's Guide which didn't work for me...
    If anybody has some links with documentation about XML Publisher, other than those from ORACLE, please share them with me.
    10x!

  • VEctor: Problem in arithmetical operation

    The problem with the following code is that when an element is accessed with v.elementAt() the compilation is OK. But if I try to do some arithmetic operation on the element, it won't compile, giving the message -
    VectorDemo.java:36: operator * cannot be applied to java.lang.Object, int
    System.out.println("Result: "+v.elementAt(3)*2);
    Is it because of <Object> type declaration of Vector? If so how to do arithmetic operation with an element of a vector which may have Double, Float or Integer type of elements in the same vector?
    import java.util.*;
    class VectorDemo
         public static void main(String args[])
              Vector<Object> v=new Vector<Object>(3,2);
              System.out.println("Initial size: "+v.size());
              System.out.println("Initial capacity: "+v.capacity());
              v.addElement(new Integer(1));
              v.addElement(new Integer(2));
              v.addElement(new Integer(3));
              v.addElement(new Integer(4));
              System.out.println("Capacity after four additions: "+v.capacity());
              v.addElement(new Double(5.45));
              System.out.println("Current capacity : "+v.capacity());
              v.addElement(new Double(6.08));
              v.addElement(new Integer(7));
              System.out.println("Current capacity : "+v.capacity());
              v.addElement(new Float(9.4));
              v.addElement(new Integer(10));
              System.out.println("Current capacity : "+v.capacity());
              v.addElement(new Integer(11));
              v.addElement(new Integer(12));
              System.out.println("First element : "+v.firstElement());
              System.out.println("Last element : "+v.lastElement());
              System.out.println("Find Result: "+v.elementAt(3));     //<------ if replaced with:
                                    //System.out.println("Find Result: "+v.elementAt(3)*2);
              if(v.contains(new Integer(3)))
                   System.out.println("Vector contains 3.");
              Enumeration vEnum=v.elements();
              System.out.println("\nElements in vector: ");
              while(vEnum.hasMoreElements())
                   System.out.println(vEnum.nextElement()+" ");
              System.out.println();
    }

    Here's the correct code.
    import java.util.*;
    import java.lang.Number;
    class VectorDemo
         public static void main(String args[])
              //initial size is 3, increment is 2
              String s;
              int i=0;
              Vector<Number> v=new Vector<Number>(3,2);
              System.out.println("Initial size: "+v.size());
              System.out.println("Initial capacity: "+v.capacity());
              v.addElement(new Integer(1));
              v.addElement(new Integer(2));
              v.addElement(new Integer(3));
              v.addElement(new Integer(4));
              System.out.println("Capacity after four additions: "+v.capacity());
              v.addElement(new Double(5.45));
              System.out.println("Current capacity : "+v.capacity());
              v.addElement(new Double(6.08));
              v.addElement(new Integer(7));
              System.out.println("Current capacity : "+v.capacity());
              v.addElement(new Float(9.4));
              v.addElement(new Integer(10));
              System.out.println("Current capacity : "+v.capacity());
              v.addElement(new Integer(11));
              v.addElement(new Integer(12));
              System.out.println("First element : "+v.firstElement());
              System.out.println("Last element : "+v.lastElement());
              System.out.println("Result: "+Integer.parseInt(v.elementAt(3).toString())*2);
              if(v.contains(new Integer(3)))
                   System.out.println("Vector contains 3.");
              //enumerate the elements in the vector.
              Enumeration vEnum=v.elements();
              System.out.println("\nElements in vector: ");
              while(vEnum.hasMoreElements())
                   System.out.println(vEnum.nextElement()+" ");
              System.out.println();
    }

  • Error while doing MIRO-Overflow for arithmetical operation (type P) in prog

    Hi ,
    I am getting the error while doing the MIRO  as below-
    Runtime Errors         COMPUTE_BCD_OVERFLOW
    Exception              CX_SY_ARITHMETIC_OVERFLOW
    Date and Time          20.05.2009 10:07:03
    Short text
         Overflow during the arithmetical operation (type P) in program "SAPLMRMC".
    What happened?
         Error in the ABAP Application Program
         The current ABAP program "SAPLMRMC" had to be terminated because it has
         come across a statement that unfortunately cannot be executed.
    What can you do?
         Note down which actions and inputs caused the error.
         To process the problem further, contact you SAP system
         administrator.
         Using Transaction ST22 for ABAP Dump Analysis, you can look
         at and manage termination messages, and you can also
         keep them for a long time.
    Error analysis
         An exception occurred that is explained in detail below.
         The exception, which is assigned to class 'CX_SY_ARITHMETIC_OVERFLOW', was not
          caught in
         procedure "MRM_AMOUNT_QUANTITY_PROPOSE" "(FUNCTION)", nor was it propagated by
          a RAISING clause.
         Since the caller of the procedure could not have anticipated that the
    Please let me know how can this be removed.

    Hi,
    There can be some problem with tolerances set in the customizing.
    In my case, I was getting this error because of delivery date variance. The difference between delivery date maintained in PO and invoice date was huge and hence the multiplication of price of PO and difference  of delivery date was huge and that was the reason for error.
    Similarly in your case also, there will be some tolerance limit problem.
    Please check your tolerance limits set in customizing.
    Regards,
    Mihir Popat

  • ODBC BI Server Bug - arithmetic operation resulted in an overflow

    I am trying to write some really simple .NET code access the Oracle BI Server ODBC driver and it's not working at all.  I've connected fine, however it seems like anything I try to do related to getting database information spits up an error "arithmetic operation resulted in an overflow".
    Here is the code:
    Dim ConnectString As String
    Dim FactoryType As String
    Dim Factory As System.Data.Common.DbProviderFactory
    Dim Connection As System.Data.Common.DbConnection = Nothing
    Dim TablesData As System.Data.DataTable = Nothing
    Dim err As String = ""
    Dim nl As String = Chr(13) + Chr(10)
    Try
        ' Connect to the database via ODBC
        ConnectString = "DSN=BSODBC_7;uid=TheUser10;pwd=************"
        FactoryType = "System.Data.Odbc"
        Factory = System.Data.Common.DbProviderFactories.GetFactory(FactoryType)
        Connection = Factory.CreateConnection
        Connection.ConnectionString = ConnectString
        Connection.Open()
        ' Request a list of tables from the database
        ' ** Tried both with restrictions and without
        ' ERROR on this line:
        ' “Arithmetic operation resulted in an overflow.”
        TablesData = Connection.GetSchema("Tables")
        ' Show the list of tables on the screen in a grid
        ' If it was successful.
        OnScreenGrid.AutoGenerateColumns = True
        OnScreenGrid.DataSource = TablesData
    Catch ex As Exception
        ' Report the error
        err = ex.Message
        If Not (ex.InnerException Is Nothing) Then
            If Not (ex.InnerException.Message Is Nothing) Then
                err = err + nl + nl + ex.InnerException.Message
            End If
        End If
        MsgBox(err, MsgBoxStyle.OkOnly + MsgBoxStyle.Exclamation, "Error")
    Finally
        ' Clean up and Close the DB Connection
        If Not (Connection Is Nothing) Then
            Connection.Close()
            Connection.Dispose()
            Connection = Nothing
        End If
    End Try
    Any Thoughts?  Is this a known bug?  Is there a fix?

    I doubt on line
    OnScreenGrid.DataSource = TablesData
    instead of array as TablesData try to take List object and assign it to OnScreenGrid.DataSource
    just in case check this
    DataGridView.AutoGenerateColumns Property (System.Windows.Forms)
    I might be wrong but just check it

  • Overflow for arithmetical operation (type P) in program.

    Hi experts..
    I had developed a report for showing total receipt and issues and confirmed issue.
    of PQ.
    For all the plant is running fine but only for one plant 2050 its going into dump and error is "Overflow for arithmetical operation (type P) in program." and the code line is
    T_EKET-MNG02 = T_EKET-MNG02 * ( t_mdbs-umrez / t_mdbs-umren ).
    MNG02 IS OF TYPE  Data : "Quan", length =13 , decimal = 3.
    initially : value in Mng02 is =  10       and ratio is 11/8 = 1.375
                  and in the debugging the value is   10*1.375 = 13.75
    but... when i am executing it .. its going into dump and after again checking the MNG02 is showing valude --9765133613.881  and the above error.
    what should i do....
    please help..
    i will award the points for every help...
    thanks

    Hi,
    Are you doing any other calculation for field MNG02 in your program?
    I created a small program with the field and values you have mentioned and it gave me the result 13.75 and no short dump.
    Please check following things:
    When short dump occurs, it shows at which line it has occured. Is it showing that the shortdump has occurs on the line you are talking about here or it is somewhere else.
    Also, when shortdump occurs, it shows a "debugging" button at the top. Hit that button and it will show you exactly where the short dump has occured. What ever this statement is, check what are the values of different variables here.
    Check all these and you might get the answer. Let me know if you still have problem.
    Regards,
    RS

  • Power query from ODBC :"DataSource.Error: Arithmetic operation resulted in an overflow"

    Good day
    Everytime I want to pull data into a query from our servers it gives the error "DataSource.Error: Arithmetic operation resulted in an overflow". What is the reason for this error, and how do I get past this bump.
    Thanks in advance
    Arnoux

    Hey Tristan. Thanks I did that yes.
    For some reason my direct MySQL connection does not want to work.
    I get the following error
    DataSource.Error: MySQL: Unable to find a database provider with invariant name 'MySql.Data.MySqlClient'.
    This error may have been the result of provider-specific client software being required but missing on this computer.  To download client software for this provider, visit the following site and choose at minimum 'MySQL Connector/Net':

  • Overflow during the arithmetical operation (type P) in program "SAPLV61A

    hi,
        I am getting this error in VA01(sales order)
    Runtime error              Compute_bcd_overflow
    Except                       Cx_sy_arithmetic_overflow.
    Overflow during the arithmetical operation (type P) in program "SAPLV61A
    Error in particular line is.
    1388           ADD  xkomv-kwert  TO komp-mwsbp.
    Please give me the solution with detail decsription.How to solve with step by step.

    Hi,
    Instead of directly assigning the value to xkomv-kbetr. Store the value in a temporary variable of type p length 13 decimals 2 . Multiply by 10^n to get the correct result.
    Then assign the temp value to xkomv-kbetr.
    Sample Code
    DATA : lv_temp TYPE P length 13 decimals 2.
    lv_temp = ( xkwert * 10^n ) / komp-mgame. 
    Then assign lv_temp to xkomv-kbetr.
    To get proper value, you have to multiply or divide by 10^n .
    Regards,
    DPM

  • Differences between operational systems data modeling and data warehouse da

    Hello Everyone,
    Can anybody help me understand the differences between operational systems data modeling and data warehouse data modeling>
    Thanks

    Hello A S!
    What you mean is the difference between modelling after normal form like in operational systems (OLTP) e. g. 3NF and modelling a InfoCube in a data warehouse (OLAP)?
    While in a OLTP you want to have data tables free of redundance and ready for transactions meaning writing and reading few records often, in an OLAP-system you need to read a lot of data for every query you do on a database. Often in an OLAP-system you aggregate these amounts of data.
    Therefore you use another principle for these database scheme. This is called star schema. This means that you have one central table (called fact table) which holds the key figures and have keys to another tables with characteristics. These other tables are called dimension tables. They hold combinations of the characteristics. Normally you design it that your dimensions are small, so the access  on the data is more efficent.
    the star scheme in SAP BI is a little more complex than explained here but it follows the same concept.
    Best regards,
    Peter

Maybe you are looking for