List records only in current quarter??

Hi all,
I have to create a report that is smart enough to grab records from the current sysdate back to the beginning of the quarter? Any suggestions on how I can automate my sql to know which quarter it is, and select the appropriate records for the specific quarter?
Thanks in advance!

Sorry. A copy paste error from my side
If you see the errors for the below two selects are different.
SQL>select trunc(sysdate,'E') from dual;
select trunc(sysdate,'E') from dual
ERROR at line 1:
ORA-00600: internal error code, arguments: [], [], [], [], [], [], [], []
SQL>select trunc(sysdate,'G') from dual;
select trunc(sysdate,'G') from dual
ERROR at line 1:
ORA-01821: date format not recognized
Thanks
Ashwin N.

Similar Messages

  • Display Current Quarter and Previous Quarter???

    Hi Gurus,
    I Had a requirement to display only the current Quarter and previous quarter in the report level using single quarter column.
    and my quarter value type is Q1 2013.
    Please anyone help me out on this asap/
    Thanks.

    Hi,
    Using time serious function you can acheive this requirement.
    http://obieetutorialguide.blogspot.in/2012/02/modeling-time-series-function-in-obiee.html
    OBIEE 11g Time Series Function
    or,
    Using presentation variable you can achieve this.
    Re: OBIEE 10g LY YTD returns YTD for past years
    The above thread for year you can change to qtr.
    Hope this help's
    Thanks,
    Satya

  • Display current month records only

    Hi Experts,
    I have the following requirement.
    Report should display current month records only.
    For example If the report is run on 20090324, It should display records from 20090301 to 20090324.
    That means,  report may run on any date of that month, It should display from 01 (of that month) to current date.
    I have a select statement saying
      SELECT * FROM likp
      WHERE wadat_ist BETWEEN month_start_date AND sy-datum          
        AND vkorg IN s_vkorg
        AND vkbur IN s_vkbur
        AND kunnr IN s_kunnr.
    How to calculate date for month_start_date, so that it can display only current month records.
    Thanks in advance
    Rohan

    Hi Kunta, Suhas, Nandi,
    Thank you for your quick reply, I really appreciate it.
    for this current month records, I need to display a check box saying
    Open orders  and shipments with the current month.
    But where as Selection text is accepting 32 characters only. Is there any possibility to overcome this?
    Thanks in advance
    Rohan

  • Returning Records Only for the Current Month

    Hello,
    I have a query that returns records for the current week and I would like to extend it to return records for the current month.
    where TRUNC (START_DATE) < NEXT_DAY (TRUNC (CURRENT_TIMESTAMP) - 1, 'Sat') + 1
    AND TRUNC (END_DATE) > NEXT_DAY (TRUNC (CURRENT_TIMESTAMP) - 1, 'Sat') - 7
    I have two date fields, the first is called 'Start_Date', the second is called 'End_Date'. I would like the query to return all records for the current month including those that may begin prior to or finish post the month as events can begin in one month and end in another. Does anyone know how this is done in a 'Where Clause'?
    Kind Regards,
    Steve Welch

    Actually LAST_DAY(ADD_MONTHS(TRUNC(sysdate),-1))+1 gives you the starting day of the current month, and LAST_DAY(TRUNC(sysdate)) gives you the last day of the current month.
    So the where be
    WHERE TRUNC(START_DATE) >= LAST_DAY(ADD_MONTHS(TRUNC(sysdate),-1))+1 OR TRUNC(END_DATE) <= LAST_DAY(TRUNC(sysdate))
    Start Date >= 1st Day of Month OR End Date <= Last Day of Month, meaning either date is within the current month.

  • Complete Weeks of current Quarter ..

    Hello,
    we have a time table (exp.: D_TIME) listing every day between 1.1.2006 to 1.1.2017
    and i am triying to filter with following criteria ..
    Complete Weeks of the current Quarter (Only weeks wich are from Monday to Sonday included in the current quarter)
    AND < SYSDATE
    The borders of this Filter are correct but in some days teh result is empty ..
    +
    SELECT * D_TIME
    WHERE
    D_TIME.DATE_X BETWEEN NEXT_DAY(TRUNC(TRUNC(trunc(SYSDATE), 'iw'),'Q')-1,'Monday')
    AND TRUNC(trunc(SYSDATE),'iw')-1
    +
    ANY Suggestions .. ? Thanks ..

    Hi,
    To find all the days between the first Monday in this quarter, and the last Sunday before today, inclusive:
    SELECT  *
    FROM     d_time
    WHERE     date_x    BETWEEN TRUNC ( TRUNC (SYSDATE, 'Q') + 6
                           , 'IW'
                AND       TRUNC (SYSDATE, 'IW') - 1
    ;This assumes that d_time.date_x is always midnight (00:00:00).
    When you TRUNCate a date to some longer time division (such as a quarter),that implies TRUNCating to all smaller divisons that are contained in it, so
    TRUNC (d, 'IW') truncates the hours, minutes and seconds; there's no need to say
    TRUNC (TRUNC (d), 'IW').
    NEXT_DAY is very handy, but it depends on NLS_DATE_LANGUAGE. TRUNC (d, 'IW') works the same regardless of your NLS settings.
    This may still retun 0 rows. For example, as of Sunday, October 9, 2001 there had not been a Monday-to-Sunday week that fell entirely in the current quarter. (The week starting on Monday, Octoeber 3 was not yet complete, by a fraction of a day.)
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using.

  • How to calculate the number of days until your next birthday. Only using current month, day and birth month and day.

    I'm trying to calculate the number of days until your next birthday. Only using current month, day and birth month and day. I can get close but i'm way off. When i enter in the next day, the amount of days is supposed to be 364. This is where I am having problems. I know my code is way off. I just need some guidance please!
    Attachments:
    D5.7_1.vi ‏8 KB

    I just had a little fun with the Time Record...
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    D5.7_1_BD.png ‏19 KB

  • Load data only for current month using ABAP Routine

    Hi Everyone,
    I am loading data from R/3 using the 0HR_PA_OS_1 extractor. This requirement is to load the position numbers from R/3. Using the extractor for a given position 28 I get the following dataset results.
    CALMONTH  POSITION
    11-2004           28
    12-2004           28
    01-2005           28
    02-2005           28
          |
    07-2007          28     CURRENT DATE
    Now when I pull data in BW I only want to load the record for most current i.e. 07-2007. I DO NOT want that ALL the records since the day the position was created should be loaded.
    Now I do understand this can be achieved using a ABAP routine in the INFOPACKAGE. Below is the routine that I am using and what it is doing is that it is only bringing in the first record.
    data: l_idx like sy-tabix.
      clear: l_idx.
      read table l_t_range with key
           fieldname = 'CALMONTH'.
      l_idx = sy-tabix.
    Current month only
      l_t_range-low = sy-datum(6).      "Current month
    l_t_range-high.
      l_t_range-option = 'EQ'.                           "equals
    l_t_range-sign = 'I'.
      modify l_t_range index l_idx.
      p_subrc = 0.
    Can anyone suggest a solution as to why this is happening?
    Thanks,
    Rahul

    One explanation would be
    - If there is no CALMONTH selection values specified in the selection tab, l_t_range would be empty. This would mean there would be no line for CALMONTH selection, and the code won't modify the l_t_range.
    If this is true, you need to check sy-subrc after reading from the itab.
    data: l_idx like sy-tabix.
    clear: l_idx.
    read table l_t_range with key fieldname = 'CALMONTH'.
    if sy-subrc = 0.
    l_idx = sy-tabix.
    * Current month only
    l_t_range-low = sy-datum(6). "Current month
    * l_t_range-high.
    l_t_range-option = 'EQ'. "equals
    * l_t_range-sign = 'I'.
    modify l_t_range index l_idx.
    else.   
    move 'CALMONTH' to l_t_range-fieldname.
    l_t_range-low = sy-datum(6).
    l_t_range-sign = 'I'.
    l_t_range-option = 'EQ'.
    append l_t_range.
    endif.
    p_subrc = 0.

  • Query to get objects list for which the current user has 'SELECT' privilege

    Hi,
    I want to get tables and views list for which the current user has 'SELECT' privilege excluding sytem tables and views. The privilege information for the current user is scattered in more than one system views. I have following system views
    USER_TAB_PRIVS_RECD - Object grants for which the current user is the grantee
    ROLE_TAB_PRIVS - describes table privileges granted to roles. Information is provided only about roles to which the user has access.
    If the object privilege is granted explicitly like "GRANT ALL ON TABLE_NAME TO "USERNAME" then this privilege entry goes to USER_TAB_PRIVIS_RECD
    If the object privilege is granted by ROLE. Role is created with certain object privileges. this role is assigned to user "GRANT ROLE_NAME TO "USERNAME"", then this entry goes to ROLE_TAB_PRIVS
    From these findings, I have composed below query
    (SELECT DISTINCT TABLE_NAME FROM USER_TAB_PRIVS_RECD) UNION (SELECT DISTINCT TABLE_NAME FROM ROLE_TAB_PRIVS WHERE PRIVILEGE = 'SELECT')
    Have I got user's all prvilege details? should I look some other system views?
    How to exclude system table privileges details?
    (SELECT DISTINCT TABLE_NAME FROM USER_TAB_PRIVS_RECD) UNION (SELECT DISTINCT TABLE_NAME FROM ROLE_TAB_PRIVS WHERE PRIVILEGE = 'SELECT' AND OWNER NOT IN ('SYS','SYSTEM') Is this right?
    What about Public role in Oracle? Should I consider public role here?
    Oracel Version :11g
    I want make this query to work on Oracle 8i or above version
    Thanks

    >
    I want to get tables and views list for which the current user has 'SELECT' privilege excluding sytem tables and views.
    >
    You will need a hierarchical query to do that.
    Try this script for Listing privileges recursively for Oracle users
    http://www.adp-gmbh.ch/ora/misc/recursively_list_privilege.html

  • Query to find the start and end date of current quarter

    I want a query to give me the start date and end date of current quarter
    I don't want to use TRUNC and ROUND as the 16th day roundoff logic is not required.
    Thanks in advance.

    Hi ,
    I'm quite sure that the year quarters are static.....
    So , you can save them as records of a table , such as:
    QRTY START_DAY END DAY
    ============================
    1 1/1 30/3
    2 1/4 30/6
    3 1/7 30/9
    4 1/10 31/12
    The sysdate(day of the current quarter) must be between a start_day and appropriate end_day of the quarters, concatenated with the sysyear (year of the sysdate).
    So , if the above table is called Quarters ...
    then
    select start_day , end_day
    from quarters
    where to_date(sysdate,'dd/mm/rrrr') between (to_date(trim((start_day||'/'||to_char(sysdate,'rrrr'))),'dd/mm/rrrr'))
    and (to_date(trim((end_day||'/'||to_char(sysdate,'rrrr'))),'dd/mm/rrrr'));
    [b]Result
    START_DAY END_DAY
    1/10 31/12
    Regards,
    Simon
    Message was edited by:
    sgalaxy
    Message was edited by:
    sgalaxy

  • How to Display Current Quarter results in WebI report?

    Hi Guys,
    I have a requirement where a WebI report should open up on current quarter basis by default. I have checked the refresh on Open in the document properties.What changes or formulae do I need to make/create in order to open the report with current quarter results?
    Appreciate any help.
    Thanks & Regards,
    Anila.

    Hi Anila,
    Do you mean if a user is running a report on the first quarter, the report should display data for the first quarter only?
    If yes, here is the solution:
    Create a formula:
    CurrQtr = If (Quarter(CurrentDate())) = MyQuarterObject THEN "Show"
    Then put a ReportFilter CurrQtr=Show
    Regards,
    Ashvin

  • Fetch current Quarter and pass it to custom query

    Hi
    I need to pass the current date and find the quarter in which the date falls.
    The start and end date of the quarter need to be passed as a query parameter, in a custom query in UI designer.
    My query is as follows
    As shown in above screenshot,I have close_dt_upd(datatype Date).This field should have end date of the quarter as a condition.
    Similarly I will have a field start_date which should have Start date of the quarter as condition.
    I got the following table in 1402 documentation.
    But the above transformation rule is not visible in  the query.
    Can anyone tell which namespace to use?
    How can I retrieve the current quarter start and end dates, and then pass them  to the above query?
    Thanks,
    Vijaya Chavan

    Hi,
    the most easiest and straight forward approach is
    - Ckick the "Binding" tab at the bottom of the Visual Editor
    - In the Bindings section click teh green plus icon and choose Generic Bindings | Attribute Value
    - point the iterator selection to the iterator used by the table
    - choose the column's attribute name from the list of attributes
    - Create a method on the ApplicatioNModule IMPL class (should take single argument)
    - expose it as a client interfaces so it shows in the Data Controls panel
    - In the "Binding" tab, create a method binding for this exposed method
    - point the method binding argument to #{bindings.column-attribute-name.inptValue}
    So whenever you need to pass the value on to the AM, you just call the method binding
    OperationBinding oper = (OperationBinding) bindings.get("name of method");
    oper.execute();
    Frank

  • Please reconcile source list records - source list

    Hi,
        I am getting the following error while trying to add a line to the source list - purchasing.
    Please reconcile source list records
    Message no. 06 329
    Diagnosis
         One or more source list records contain(s) conflicting data (e.g. two
         records defined as fixed sources in the same period).
    Procedure
         Make sure your entries are correct.
    But only one line has fixed flag set.
    Data:
    01/01/2005     12/31/2007     BU86     E090
    01/01/2005     12/31/2007     BU86     E090          BTL     4600000429     10
    01/24/2007     03/31/2008     BU86     E090          BTL     4600000459     30
    01/01/2008     03/31/2008     BU86     E090          BTL     4600000459     30
    02/01/2008     03/31/2008     BU86     E090          BTL     4600000459     30
    03/01/2008     03/31/2008     BU86     E090          BTL     4600000459     30
    04/01/2008     12/31/2008     bu86     e090               4600000537     10
    I am trying to add the last row as above.
    Any help? Thanks,

    01/01/2008 03/31/2008 BU86 E090 BTL 4600000459 30
    02/01/2008 03/31/2008 BU86 E090 BTL 4600000459 30
    03/01/2008 03/31/2008 BU86 E090 BTL 4600000459 30
    Why do have the same contract item 3 times in your source list?
    Maybe this causes the error but i am not certain.
    check OSS, there are about 10 notes when searching with 06329

  • Set date Parameters to Default to Current Quarter

    I have 2 date parameters in my report. I would like these parameters to be defaulted to the 1st day of the current quarter and the last day of the current quarter. I need these to be dafaulted because the report is going to be scheduled through BusinessObjects InfoView. I need the flexabilty to allow users to run the report on any date they want, but it needs to default so the scheduling works as expected. Can this be done and if so any assistance would be grateful. Thank you.

    Thomas,
    although you can't set a prompt / parameter to default like this, you can set a record selection to do this...here's how...
    1) in your StartDate and your EndDate parameters set a default value of 1888,08,08
    2) create a new formula called Start with syntax like
    if {?startdate} = date(1888,08,08)
    then
    if month(currentdate) in [1,2,3] then date(year(currentdate),01,01) else
    if month(currentdate) in [4,5,6] then date(year(currentdate),04,01) else
    if month(currentdate) in [7,8,9] then date(year(currentdate),07,01) else
    if month(currentdate) in [10,11,12] then date(year(currentdate),10,01)
    else {?startdate};
    3) create a new formula called End with syntax like
    if {?enddate} = date(1888,08,08)
    then
    if month(currentdate) in [1,2,3] then date(year(currentdate),03,31) else
    if month(currentdate) in [4,5,6] then date(year(currentdate),06,30) else
    if month(currentdate) in [7,8,9] then date(year(currentdate),09,30) else
    if month(currentdate) in [10,11,12] then date(year(currentdate),12,31)
    else {?enddate};
    4) change your record selection formula to something like
    {table.datefield} in {@start} to {@end}
    now if the end user doesn't actually put in custom dates, the record filter will default to the current quarter. if they use custom dates, the those dates will be used.
    of course you will have to edit the above syntax to your parameter names and datefield name. this method will also pass the filter to the database to increase performance.
    cheers,
    jamie

  • Search help list recorder limited

    Hi,
        We created one customize table. One field use the search help function for Customer number.The search help name is DEBI. The search help parameter is KUNNR. The value table is KNA1.It is SAP standard search help name. But it have one limited. It is only list the first 500 records. Could you tell me how to set let the list record more than 500? Thanks.
    best regards
    Park Han

    Hi,
    read this one it will help u.
    To avoid the standard F4 help to be show, insert the event PROCESS ON-VALUE-REQUEST in the  program and add a field
    statement for the field that should trigger the F4 help. In the mdoule called from PROCESS ON-VALUE-REQUEST, call function module
    F4IF_FIELD_VALUE_REQUEST.
    Example 1 - Dynpro
    process before output.
    process after input.
    PROCESS ON VALUE-REQUEST.
      FIELD it_zsd00003-prctr MODULE f4_help_for_pctr.
    MODULE f4_help_for_pctr INPUT.
    NOTE:
    Tabname/fieldname is the name of the table and field
    for which F4 should be shown.
    Dynprog/Dynpnr/Dynprofield are the names of the Progran/Dynpro/Field
    in which the f4 value should be returned.
    Value: The value of the Dynpro fuield when calling the F4 help.
    You can limit the values shown, by inseting a value in this parameter
    e.g  '50*' to show only values beginning with 50
      CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
        EXPORTING
          tabname                   = 'ZSD00003'
          fieldname                 = 'PRCTR'
      SEARCHHELP                = ' '
      SHLPPARAM                 = ' '
          dynpprog                  = 'ZSD00002_BRUGERKONV_LISTE'
          dynpnr                    = '0100'
          dynprofield               = 'IT_ZSD00003-PRCTR'
      STEPL                     = 0
          value                     = '50*'
      MULTIPLE_CHOICE           = ' '
      DISPLAY                   = ' '
      SUPPRESS_RECORDLIST       = ' '
      CALLBACK_PROGRAM          = ' '
      CALLBACK_FORM             = ' '
    TABLES
      RETURN_TAB                =
    EXCEPTIONS
      FIELD_NOT_FOUND           = 1
      NO_HELP_FOR_FIELD         = 2
      INCONSISTENT_HELP         = 3
      NO_VALUES_FOUND           = 4
      OTHERS                    = 5
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDMODULE.                 " F4_help_for_pctr  INPUT
    reward points, if it helpful.
    regards,
    satish.

  • Plsql query to list cases that have failed to create listing records

    i would like to create a query as follows
    Give me all docket_num (whose batch_id's are =11051) from Import_case table
    which do not have listing records on Listing_Table (either they don't exist at all
    or if the do; the create_date in the Listing table is null OR cretae_date on Lsting table not = record_process_date on Import_case table.
    -------- x ---------------
    Import_case Table
    ==============
    1. import_case_id number(38) primary key
    2. batch_id number
    3. record_processed_date date
    4. docket_num varchar2(17)
    case_master Table
    =================
    1. case_master_id number(38) primary key
    2. docket_num varchar2(17)
    Listing Table
    ==========
    1. Listing_id number(38) primary key
    2. case_master_id number(38)
    3. created_date timestamp(6)
    note: case_master table is a link between Import_case Table and Listing table
    where docket_num on import_case table = docket_num on case_master
    and case_master_id on case_master = case_master_id on Listing Table
    Please reply at your earliest. Thanking you. Arvind Modi.

    I have used following query, which gives me list of docket numbers on Import case Table; which don't have Listing records on Listing Table.
    ========================================================
    select
    ic.import_case_id as "IMP_CASE_ID",
    ic.batch_id as "B_ID",
    ic.docket_num as "DOCKET#",
    ic.insert_timestamp as "INS_DT",
    ic.record_processed_timestamp as "REC_PROCESS_DT",
    ic.next_date as "NEXT DT"
    from daoimp.import_case ic
    -- ** insert Batch id ** >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    where ic.batch_id=11051
    -- ** insert Batch id ** <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    minus
    select
    t.import_case_id as "IMP_CASE_ID",
    t.batch_id as "B_ID",
    t.docket_num as "DOCKET#",
    t.insert_timestamp as "INS_DT",
    t.record_processed_timestamp as "REC_PROCESS_DT",
    t.next_date as "NEXT DT"
    from daoimp.import_case t,
    case_master cm,
    listing l
    -- ** insert Batch id ** >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    where t.batch_id=11051
    -- ** insert Batch id ** <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    and
    t.docket_num = cm.docket_num
    and
    cm.case_master_id = l.case_master_id
    ==================================================
    The above query gives correct docket_numbers on Import_case table, but it also needs to include Docket numbers on Import_case Table
    whose Listing records in Listing table contain NULL value in created_date
    OR create_date on Listing table not equal record_process_date on Import_case Table.
    ---- x ----
    Here is the actual request and above is my interpretation of it.
    The goal of the task here is to create a tool. The tool can be run to check for missing listing records that were not created during the import process. When run, the tools returns a result set of records (docket_numbers) from the import case table that although processed on a particular date i.e., (record_process_date) do not have a matching listing record i.e., ( a listing record with a create_date equal to the record_process_date).
    The ONLY VARIABLE PARAMETER NEEDED in this tool is the Batch ID for the import case table.
    ---- x ---
    I am working on some other queries using inner join or outer join or not exists, but no success so far.
    Please call me at my phone number or reply on my e-mail, if you like; so that I can clarify any issues.

Maybe you are looking for