Date comparison using between function

we are extracting the data between two dates and time with the below mentioned SQL. this same SQL extract different no of records with the same data on two different AIX server
Both the database on the same version 9.2.0.8.0 and second is replica of first database.
table column RCRE_TIME is date datatype
SELECT AST.OPERATION,
AST.CUST_ID,
AST.RCRE_TIME,
AST.KEY,
HAC.ACCT_CLS_FLG,
FROM HAC,AST
WHERE HAC.FORACID = AST.KEY
AND HAC.ENTITY_CRE_FLG = 'Y'
AND to_date(AST.RCRE_TIME,'DD-MM-YYYY HH24:MI:SS') BETWEEN to_date('12-03-2012 20:22:28','DD-MM-YYYY HH24:MI:SS') AND to_date('13-03-2012 21:25:20','DD-MM-YYYY HH24:MI:SS')
can any one help on the same.
Thanks
RSG

user8448799 wrote:
we are extracting the data between two dates and time with the below mentioned SQL. this same SQL extract different no of records with the same data on two different AIX server
Both the database on the same version 9.2.0.8.0 and second is replica of first database.
table column RCRE_TIME is date datatype
SELECT AST.OPERATION,
AST.CUST_ID,
AST.RCRE_TIME,
AST.KEY,
HAC.ACCT_CLS_FLG,
FROM HAC,AST
WHERE HAC.FORACID = AST.KEY
AND HAC.ENTITY_CRE_FLG = 'Y'
AND to_date(AST.RCRE_TIME,'DD-MM-YYYY HH24:MI:SS') BETWEEN to_date('12-03-2012 20:22:28','DD-MM-YYYY HH24:MI:SS') AND to_date('13-03-2012 21:25:20','DD-MM-YYYY HH24:MI:SS')
can any one help on the same.
Thanks
RSGsame results occur when everything is the same.
different results occurs when something is different.
How can we reproduce what you report?

Similar Messages

  • Generic data extractor using a function module

    Hi All,
    I want to create a generic data extractor using a function module within the BW system. i.e. the extractor will run in BW and and store the data in a cube( in BW). No R/3 is invloved. I proceeded as follows:
    1. Created a structure through se11.
    2. Created a function module. But while defining "E_T_DATA" in the "Tables" section of the function module, I am getting the error "TABLES parameters are obsolete". I defined as follows:
    E_T_DATA TYPE ZBW_EXTRACT 
    ZBW_EXTRACT is the name of the structure.
    What should i do in this case ?
    Thanks,
    Satya

    Hello Satya,
    The message "TABLES parameters are obsolete" is just a warning and not an error. The structure of the interface is strict (defined by SAP). You should opt to proceed even if you receive the warning.
    Hope this clarifies.

  • Problem while Sending data concurrently using Evsnd function.

    Hi All,
    i am trying to send data from input schudule using evsnd function.
    As per a test scenerio.
    User 1: one user( cantains all bas members) , opens the input schudule  , waits for and hour  and do planning for few basmemebers and  then submit the data.
    User 2:another user ( subset of all base members) ,opens input schudule  ,do planning and submits the data.
    Now when  user 1 Sumits the data , it overwrites the value of user 2.
    is there is any way by which we can restrict user 1 of sending those value only that he/she  changed.
    Edited by: Tapeshwar Singh Bagal on Mar 11, 2009 11:02 AM

    First, I'd strongly encourage you to use EVDRE instead of EVSND, as it gives a lot better control over many aspects of the input schedule.
    As to your point, EVDRE definitely will only send back to the server the cells which have changed. It's been a few releases since I used EVSND (and its behavior may have changed some in the meantime), but if I recall correctly, it also does some of this same checking.
    Another option to consider is to make the input schedule smaller (fewer accounts or entities or products or whatever your dimensions), and split it into two pieces, one for each of the business processes that the 2 users are performing.
    If the 2 users are maintaining the same intersection of data, and performing the same business process (acting as a team, for example) then BPC has limited ability to support "checking out for edit" or locking the data for one user, in a way that prevents another user from changing it. The "park n go" feature does this in a way, but it's something that the user needs to do intentionally. That doesn't sound like your User 1 scenario of waiting for an hour before submitting -- probably when they opened it up, they thought it would only take 2 minutes, but then the phone rang, and then an email.... and then finally they finish it an hour or 8 later.

  • Date range using BETWEEN

    I am trying to retrieve records that have a transaction date in a particular range to include the beginning and ending date. Simple enough, I thought. Here is the situation:
    SELECT * FROM TRANFILE WHERE
    TRANDATE BETWEEN &date1 AND &date2
    It picks up the records within the range but not those = to date2. Is that how BETWEEN should work (< date2) or should it pick up the records that are also equal to date2 (<= date2)?
    Thanks, sorry for such a simple question.

    BETWEEN is inclusive.
    If TRANDATE contains hours, minutes and seconds and date2 only the date the you'll only get the records from 0:00:00 on date2.
    Maybe what you meant was :
    SELECT * FROM TRANFILE WHERE
    trunc(TRANDATE) BETWEEN &date1 AND &date2
    or
    SELECT * FROM TRANFILE WHERE
    TRANDATE BETWEEN trunc(&date1) AND trunc(&date2)+1
    AND TRANDATE &lt;&gt; trunc(&date2)+1
    The latter will allow you to use an index on TRANDATE.
    The former could benefit from a function based index on trunc(TRANDATE)

  • Data Comparison using Openscript

    Hi, Is it possible to compare 2 html/xml/pdf page's format and data using Openscript
    Edited by: 887085 on Sep 23, 2011 8:07 PM

    Hello Ash,
    Please check CCDB functionality if it suits you:
    Configuration and Change Database (CCDB) - SAP Solution Manager - SAP Library
    BR,
    K.

  • Global data declaring/using in Function modules

    Hi,
    I have declared an internal table(say ITAB1) in the top include.Appending the values through FM1(function module).
    I am using the same through FM2 (Tables ITAB1).
    ( Function group is same for both FM1 and FM2 )
    but i am not getting the values in the ITAB1.
    Can anyone help me....
    Thanks in advance
    KB

    Bhavani,
    I don't think it works that way. If you are accessing that variable with in that function module you will be able to access that table.
    As you are calling another function module else where, the execution memory is different and the previous variables will not exist any more. However, if you call function2 with function1 it should work.
    The other way could using the EXPORT and IMPORT commands. Then you should be able to access the data.
    Regards,
    Ravi
    Note : Please reward points, if this helps you.

  • Oracle 10g - Problem with Date Ranges using Between

    I am keeping track of patients who have not been contacted during a date range. if a nurse adds an event or note and the note is type 1,3,4 then this is a contact. The following works but if the event or note was made on the same day as the report is run, the current contact is not printed. Any help to improve the query and identify the problem would be appreciated. Also, if you add '1' to' n.created_date_time BETWEEN '10-Jan-2010' AND TRUNC(SYSDATE)' so it is ' n.created_date_time BETWEEN '10-Jan-2010' AND TRUNC(SYSDATE) + 1'. It works. What is wrong?
    SELECT upper(symptom_text),
      COUNT(UNIQUE(c.patient_id)) ,
      COUNT(UNIQUE(
      CASE
        WHEN e.eventdate BETWEEN '10-Jan-2010' AND TRUNC(SYSDATE)
        OR (n.created_date_time BETWEEN '10-Jan-2010' AND TRUNC(SYSDATE)
        AND n.note_type_id                                             IN (1,3,4))
        THEN c.patient_id
        ELSE 0
      END)) - 1
    FROM patient c,
      cust_info ci,
      event e,
      note n
    WHERE c.physician_id = 74
    AND c.patient_id      = ci.patient_id
    AND ci.info_type_id    = 32
    AND ci.symptom_text      IS NOT NULL
    AND c.patient_id      = e.patient_id(+)
    AND c.patient_id      = n.pk_id(+)
    AND n.table_name(+)    = 'patient'
    GROUP BY upper(symptom_text)
    ORDER BY DECODE(upper(symptom_text), 'A+', 1, 'A', 2, 'B', 3, 'C', 4, 'D', 5, 99)I suspect the end date is not inclusive. Fields are Date data types. Thanks for any help.

    Hi,
    achtung wrote:
    Understood. Frank was correct. Do you mean about the dates? Is that issue solved now?
    It would help a lot if you posted some sample data (CREATE TABLE and INSERT statements) and the results you want from that data. Simplify as much as possible. For example, if everything involving the e and n tables is working correctly, forget about them for now. Post a question that only invloves the c and ci tables.
    But, additionally, when a record in the cust_info doesn't exist my contact count is inaccurate. How can you explain this conceptually. I understand the query path is checking for this record due to the predicate. Perhaps the query should be redesigned. Thanks for your input!Again, you can see the results, and you know what they should be. Nobody else has that information. Please post some sample data and the results you want from that data.
    In your earlier message you said
    Could there be a problem if a record does not exist in the ci table?The condition:
    AND ci.symptom_text IS NOT NULL
    filters for this right? Maybe this could be part of the problem. why I'm not seeing records when a note is added to a patient's doc. How would this be technically be explained? You're doing a inner join between c and ci:
        AND c.patient_id      = ci.patient_id
        AND ci.info_type_id   = 32
        AND ci.symptom_text   IS NOT NULL ...Rows from c will be included only if there is a row in ci with the same patiend_id: even more, that matching row in ci must also have info_type_id=32 in a non-NULL symptom_text, otherwise, the row from c will be ignored.
    If you want rows from c to be included even if there is no matching row in ci, then do an outer join, like you're already doing with the e and n tables:
      WHERE c.physician_id = 74
        AND c.patient_id         = ci.patient_id (+)
        AND ci.info_type_id (+)  = 32
        AND ci.symptom_text (+)  IS NOT NULL
        AND c.patient_id         = e.patient_id(+)
        AND c.patient_id         = n.pk_id(+)
        AND n.table_name(+)      = 'patient'

  • Data Comparison using solution manager

    Hi All,
    Can anybody please let me know if there is any tool available in Solution Manager(SP 10) for the following case.
    I need to check if a value of a certain field in a table on ECC has changed by say 10% between two days(or between 2 runs). If for eg the value in today's run is 10, I need to be know if the value has changed to greater than 11 or less than 9 in tomorrows run.
    Can I temporarily store the values of todays run and then compare the value with tomorrows run??
    Regards,
    Ash

    Hello Ash,
    Please check CCDB functionality if it suits you:
    Configuration and Change Database (CCDB) - SAP Solution Manager - SAP Library
    BR,
    K.

  • How to create a generic data extractor using standard function module

    Hi,
    I have to generate report based on Function module(standard FM),client know only Fm Name n they have given FM Name n asked reports based on that, so can any one give me steps to create DS based on that.
    Thanks,
    Swapna

    check this blog
    /people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
    and this pdf:
    Generik extraction: https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a0f46157-e1c4-2910-27aa-e3f4a9c8df33
    Generic delta:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/84bf4d68-0601-0010-13b5-b062adbb3e33
    Edited by: Aduri on Dec 17, 2007 4:04 PM

  • Generic data extractor using function module

    Hi All,
    I want to create a generic data extractor using a function module within the BW system. i.e. the extractor will run in BW and and store the data in a cube( in BW). No R/3 is invloved. I proceeded as follows:
    1. Created a structure through se11.
    2. Created a function module. But while defining "E_T_DATA" in the "Tables" section of the function module, I am getting the error "TABLES parameters are obsolete". I defined as follows:
    E_T_DATA TYPE ZBW_EXTRACT
    ZBW_EXTRACT is the name of the structure.
    What should i do in this case ?
    Thanks,
    Satya

    Hi,
    I went to se80. Copied the function module "RSAX_BIW_GET_DATA_SIMPLE" to my function group. When i tried to change the associated type from "SFLIGHT" to my own structure, it again gives a warning that "TABLES parameters are obsolete!". It does not allow me to either save, check or activate the function module. What should i do ?
    Please reply urgently.
    Thanks,
    Satya

  • Breaking Links to and External Data Connection using the cubevalue() function

    I have spreadsheets that connect to an MSAS cube successfully and pull data in the cells using the CUBEVALUE function.
    Is there a way to perform the equivalent of 'breaking links' to the external database so that the spreadsheet can be distibuted to others that will not have the external database connection set up on their computer/excel environment.
    I find that if i email a spreadsheet with data retreived using cubevalue functions to someone without the external database connection they do not see the values preserved with the spreadsheet and end up with blank or zero cells, etc.
    I have unchecked the box related to 'refresh data when opening file'.
    In a perfect world i would like to remove the db connection and be left with pasted values, similar to breaking links to an external workbook but I am not sure if that is possible.
    I am desperate to find a way to distribute these spreadsheets and be confident that Excel won't be unsuccessfully trying to refresh a connection that isn't on other peoples computer.
    Thanks for any guidance

    Maybe you can upload a sample file to a file sharing site and then share the link with us.
    As you said you have already unchecked the option 'Refresh data when opening the file' within Connection Properties.
    When you send the Excel file to someone without this data connection, they should get the correctly data unless they click the button 'Refresh All'.
    Wind Zhang
    TechNet Community Support

  • BETWEEN FUNCTION WITH IN A DECODE FUNTION IN A CURSOR

    The following below is my query..I have to get the hours,min and seconds from a 'yyyy-mm-dd-24hh.mi.ss' value and check if the time is between 12 am to 6 am , then write it with one value else write an another value..I am trying to use 'BETWEEN' function in decode function but i am getting error.....Can we use BETWEEN function with in decode function or is there any other way
    set serveroutput on
    declare
    cursor cur_dte is select lst_upd_date from EMPLOYESS ;
    begin
    for i in cur_dte loop
    DECODE (substr(trim(i.lst_upd_date),12)) ,between '00.00.00.0000' and '06.00.00.00.0000' ,101,102);
    dbms_output.put_line(i.lst_upd_date);
    end loop;
    end

    First of all. If you are in PL/SQL then CASE is just a more colmplex expression then IF THEN ELSE. I usually prefere If then else, but for some rare cases.
    The other issue is that you convert a datetime value into a string. This is wrong. it opens up all possible kinds of cenversion bugs. Stay with date or timestamp as long as possible.
    The solution depends a little upon the datatype of your lst_upd_date column.
    Here is a pl/sql solution assuming it is DATE.
    The TRUNC function can be used to reduce a datetime to a day or to an hour.
    declare
       cursor cur_dte is select lst_upd_date from employees ;
    begin
       for i in cur_dte loop
         if trunc(i.lst_upd_date,'HH') between trunc(i.lst_upd_date) and trunc(i.lst_upd_date)+6/24 then
            dbms_output.put_line(to_char(i.lst_upd_date,'DD-MON-YYYY HH24:MI:SS'));
         end if;       
       end loop;
    end;
    /But a pure SQL solution is much better.
    Here is how you implement it using CASE in SQL.
    example using pure sql
    select e.*,
            case when trunc(e.lst_upd_date,'HH')
                   between trunc(e.lst_upd_date) and trunc(e.lst_upd_date)+6/24
            then 101
            else 102
            end as "early_morning_check"
    from employees e;And if it is a timestamp column then you could use the EXTRACT function.
    select e.*,
            case when to_number(extract(hour from e.lst_upd_date))
                   between 0 and 6
            then 101
            else 102
            end as "early_morning_check"
    from employees e;You might want to consider if date values like 06:45:00 should be included or not.

  • Error  while creating Generic data source using FM

    Hi Experts,
    I try to create a generic data source using the Function Module via the  transaction RSO2. I got the following error messages.
    " Das Einheitenfeld CURR des Feldes ZPKZA1 der DataSource ZBWN_DS_POLPOSP ist ausgeblendet"
    " Das Einheitenfeld CURR des Feldes ZPKZA2 der DataSource ZBWN_DS_POLPOSP ist ausgeblendet"
    " Das Einheitenfeld CURR des Feldes ZPKZA10 der DataSource ZBWN_DS_POLPOSP ist ausgeblendet"
    "The unit field CURR of the field ZPKZA1 of the DATA SOURCE ZBWN_DS_POLPOSP is not visible/ stopped/ hide".
    for all 10  fields of type CURR.
    How shall i handle this issue..........any suggestions please........
    thanks in advance
    cheers
    sailekha

    Hi,
    Are your CURR fields refereded to a currency field of your structure?? Maybe the problem is that the field containing the currency is refered to other table/structure and it has to be one of your structure fields.
    Hope this helps,
    Regards,
    Carlos.

  • USING BETWEEN CLAUSE WITH 'IN'.

    Can I use between function with IN.
    Example.
    select a.* from emp a, dept b
    where a.deptid=b.deptid
    and a.deptid in (
    a.deptid between '122' and '199', '330'
    Actually its giving an errorr
    ORA-00907: missing right parenthesis*

    This is not a correct syntax. Use multiple between condition with "OR".
    Regards,
    Vidya.

  • Use of Function Module IDOC_INPUT_CREDITOR

    Hi All,
    Could you please let me know the use of the function module IDOC_INPUT_CREDITOR. If i customise this function module by copying to Z_IDOC_INPUT_CREDITOR.. is it possible for me to post the vendor classification data by using the function module.
    Thank You,
    Suresh

    Hi,
    This function module is used to post Vendor realted information through IDOCs. You can copy the same and can create your own but you need to attach this to your own IDOC message type or you can call through your own customized transaction.
    -suresh Revuru

Maybe you are looking for