How to get Year to Date data

Hi all,
I have the following scenario:
Count -- Code -- Date
5 -- DS -- 09/01/2009
5 -- DS --- 15/01/2009
5 -- LO -- 21/01/2009
1 -- IL -- 09/02/2009
5 -- DS -- 09/03/2009
5 -- LO -- 09/04/2009
4 -- DS -- 09/05/2009
5 -- IS -- 09/06/2009
5 -- DS -- 09/07/2009
5 -- IS -- 09/08/2009
3 -- DS -- 09/09/2009
5 -- DS -- 09/10/2009
5 -- LO -- 09/11/2009
2 -- DS -- 09/12/2009
5 -- DS -- 09/01/2010
5 -- LO -- 09/02/2010
4 -- DS -- 09/03/2010
How can I only bring YTD data for 2009 and YTD data for 2010.. means YTD 2009 data till current day of the date e.g., if its 9 March today .. tbe result will bring full jan, feb and till 9th day of march '09 and full jan, feb and till 9th day of march '10
Thanks
Edited by: [email protected] on Mar 9, 2010 11:03 PM
Edited by: [email protected] on Mar 9, 2010 11:06 PM

Hi !
Basic idea is
select to_date('01012009','DDMMYYYY')+level-1
  from dual
connect by level <= to_date('02022009','DDMMYYYY')-to_date('01012009','DDMMYYYY')+1with some "gymnastics" ( union all , case .... ) you will query which will be good for your requirements
T

Similar Messages

  • How can get difference between 2 dates in the form of days

    how can get difference between 2 dates in the form of days

    Hi,
    Check the following program:
    REPORT ZDATEDIFF.
    DATA: EDAYS   LIKE VTBBEWE-ATAGE,
          EMONTHS LIKE VTBBEWE-ATAGE,
          EYEARS  LIKE VTBBEWE-ATAGE.
    PARAMETERS: FROMDATE LIKE VTBBEWE-DBERVON,
                TODATE   LIKE VTBBEWE-DBERBIS DEFAULT SY-DATUM.
    call function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
      exporting
        i_date_from          = FROMDATE
        i_date_to            = TODATE
      I_FLG_SEPARATE       = ' '
      IMPORTING
        E_DAYS               = EDAYS
        E_MONTHS             = EMONTHS
        E_YEARS              = EYEARS.
    WRITE:/ 'Difference in Days   ', EDAYS.
    WRITE:/ 'Difference in Months ', EMONTHS.
    WRITE:/ 'Difference in Years  ', EYEARS.
    INITIALIZATION.
    FROMDATE = SY-DATUM - 60.
    Regards,
    Bhaskar

  • How to get days between two dates

    Hi ,
    How to get days between two dates.
    Regards,
    Ramesh.

    Hi Ramesh,
    REPORT ZDATEDIFF.
    DATA: EDAYS   LIKE VTBBEWE-ATAGE,
          EMONTHS LIKE VTBBEWE-ATAGE,
          EYEARS  LIKE VTBBEWE-ATAGE.
    PARAMETERS: FROMDATE LIKE VTBBEWE-DBERVON,
                TODATE   LIKE VTBBEWE-DBERBIS DEFAULT SY-DATUM.
    call function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
      exporting
        i_date_from          = FROMDATE
        i_date_to            = TODATE
      I_FLG_SEPARATE       = ' '
      IMPORTING
        E_DAYS               = EDAYS
        E_MONTHS             = EMONTHS
        E_YEARS              = EYEARS.
    WRITE:/ 'Difference in Days   ', EDAYS.
    WRITE:/ 'Difference in Months ', EMONTHS.
    WRITE:/ 'Difference in Years  ', EYEARS.
    INITIALIZATION.
    FROMDATE = SY-DATUM - 60.

  • How to get the plsql table data into output cursor

    Hi,
    Could anybody please help me.
    Below is an example of the scenario..
    CREATE OR REPLACE PACKAGE chck IS
    PROCEDURE getdata(dept_no IN VARCHAR2,oc_result_cursor OUT sys_REFCURSOR);
    TYPE get_rec is record (ename varchar2(20),
    eno number(12));
    TYPE t_recs IS TABLE OF get_rec INDEX BY BINARY_INTEGER;
    emp_tab t_recs;
    END chck;
    CREATE OR REPLACE PACKAGE BODY chck AS
    PROCEDURE getdata(dept_no IN VARCHAR2,oc_result_cursor OUT sys_REFCURSOR)
    is
    BEGIN
    select ename, eno
    bulk collect into emp_tab
    from emp;
    open oc_result_cursor for select * from table(emp_tab); -- I believe something is wrong here ....
    END;
    END chck;
    the above package is giving me an error:
    LINE/COL ERROR
    10/29 PL/SQL: SQL Statement ignored
    10/43 PL/SQL: ORA-22905: cannot access rows from a non-nested table
    item
    let me know what needs to be changed
    Thanks
    Manju

    manjukn wrote:
    once i get the data into a plsql table, how to get this plsql table data into the cursor?There is no such thing as a PL/SQL table - it is an array.
    It is nothing at all like a table. It cannot be indexed, partitioned, cluster, etc. It does not exist in the SQL engine as an object that can be referenced. It resides in expensive PGA memory and needs to be copied (lock, stock and barrel) to the SQL engine as a bind variable.
    It is an extremely primitive structure - and should never be confused as being just like a table.
    Its use in SQL statements is also an exception to the rule. Sound and valid technical reasons need to justify why one want to push a PL/SQL array to the SQL engine to run SELECT 's against it.

  • How to get the user entered data?

    Hi all,
    I have created an HTMLB DynPage component.
    In That i have created my input screen with textboxes using response.write method.
    i have added one onConfirm event on which the data whould validate.
    so onConfirm method im trying to get the data with request.getParameter method which returns null...
    how to do...how to get the user entered data to do my validations...can anyone plz advice.
    Thanks,
    Viswes

    Hi
    inputfield or textbox component entered directly using response.write(...) are not htmlb , but html.
    to create portal input field (ie HTMLB), you should do something like
    this in the doProcessBeforeOutput member function
    InputField field1 = new InputField("Id1");
    field1.setSize(8); // 8 characters
    this.getForm().addComponent(field1);
    and in doProcessAfterInput member function
    InputField field1 =
    (InputField) this.getComponentByName("Id1");
    you can then manipulate the content of the field.
    Hope this help,
    Guillaume

  • How to get ArrayCollection's total data after filter

    after i use filterFunction to filter data of some
    ArrayCollection. so how to get the total original data of this
    ArrayCollection?
    NOT use filterFunction = null, because i use the filter data
    to show at the same time!
    thank you!

    You can get the underlying array by accessing the
    ArrayCollection's "source".

  • How to get length of a data field

    Hi Experts,
    How to get length of a data field. For example data field /BIC/0COSTCENTER length is 9. and the entry in the table is /BIC/0COSTCENTER = 1000 only. How to get the lenth of value in the table.
    Any help greatly appreciated. Thanks.
    Best Regards,
    Suresh.

    Below is example  code
    Data: var1(10) type c value '2500',
          var2 type i.
    var2 = Strlen( var1 ).
    write var2.
    <b>Reward Points for helpful answers</b>
    Satish

  • How to get current time and date??

    How to get current time and date from my PC time and date to the java application??
    i use java.util.* package but got error, that is:
    - java.util.* and java.sql.* class are match
    - abstract class cannot be instantiated
    so what can i do, pls guide...thanks...

    There is a method in the System class that will return the current system time. You could also instantiate a Date, Time, Timestamp, or Calendar object, all of which get created with the system time by default.
    Don't import *. Import the specific classes you need.
    Next time, post the actual text of the exceptions/compile errors. If you make people guess, most just won't bother.

  • How to get group when the data source from system instead of UME database

    Hig guys,
    How to get group when the data source comes from backend system instead of UME database?
    I tried to use
    IUMPrincipal RefGroup = WPUMFactory.getGroupFactory().getGroup(groupName);
    But I was not able to get the group. But in "UserAdministrator", I can find this groupName.
    Which kind of API can I use?
    Thanks in advance!
    Regards,
    Liying
    Message was edited by:
            Liying Wang

    Ok,
    try this:
    com.sapportals.portal.security.usermanagement.IGroupFactory ep5GroupFactory = userManagementService.getGroupFactory();
    IGroupFactory groupFactory = UMFactory.getGroupFactory();
    com.sap.security.api.IGroup group = groupFactory.getGroupByUniqueName(groupName);
    IUMPrincipal ep5Principal = ep5GroupFactory.getEP5Group(group);
    This should do the trick,
    Romano
    PS: and thanks for the stars!

  • Hi guys.. anyone can help me? I lost my iphone, how to get back all the data is there?

    I lost my iphone, how to get back all the data is there?

    Thank you for explain kappy..
    how if I want to get my skype message? is it can ? help me..

  • How to get an email when data got inserted

    Hi All,
    Could you please let me know how to get an email when data got inserted into table by using sql/plsql
    Thanks in adavance

    Could you please let me know how to get an email when data got inserted into table by using sql/plsql
    Well that seems pretty straightforward - write some pl/sql to send you an email when that pl/sql inserts data into a table.
    See this Oracle-base article for an example of sending mail.
    http://www.oracle-base.com/articles/misc/email-from-oracle-plsql.php
    Post what you have tried so far. What part of what you have tried doesn't seem to be working?

  • How can get back my backup data from an external element ?

    How can get back my backup data from an external element ?

    See the section titled "restoring data from Time Machine backups" in this Apple support article; that should get you going.
    http://support.apple.com/kb/ht1427
    Regards.

  • How to get Po item Delivery Date ?

    who can tell me how to get PO Item Delivery Date ?
    Thank You!

    hi
    good
    go through these links,hope these ll help you to solve your probelm
    http://web.mit.edu/sapr3/windocs/bpors03m.htm
    http://www.sap.com/southafrica/services/education/pdf/BPP.pdf
    thanks
    mrutyun^

  • Getting year, month and date

    I am getting the current year, month and date as follows:
    public void setDate(Date date) {
    String strDate = "";
    //year
    Calendar cal = Calendar.getInstance();
    cal.setTime(date);
    strDate += cal.get(Calendar.YEAR);
    //month
    strDate += cal.get(Calendar.MONTH) + 1;
    //date
    strDate += cal.get(Calendar.DATE);
    this.date = strDate;
    }This gives me the date in teh format yyyymd.
    i.e for Mar 5 2007, it returns 200735
    How can it retrieve it in yyyymmdd format?
    i.e. Mar 5 2007 must be 20070305

    use the function:
    private String getTwoNumberFormat(int i){
         if (i<10)
              return "0"+i;
         else
              return ""+i;
    }and then call
    //month
    strDate += getTwoNumberFormat(cal.get(Calendar.MONTH)+1);or use SimpleDateFormat :)

  • How to get the week start date from ISO week number

    Hi,
    I have a table with the following stucture
    Year    error    Week1     week2   week3 ......week53
    2012       error1     2           4         2             1
    2012       error2    3          0        1                 1I was hoping to get something like select year, error, week1||'Week start date which is a monday of that week' , week2||'Week start date,again monday',....week53 from table
    Any suggestions please?
    Thanks,
    Sun

    Hi, Sun,
    To see when week N started, add 7 * (N - 1) days to the beginning of the year. (By definition, the beginning of the ISO year is the start of week 1 of the ISO year.)
    To see when week 22 of the current year started:
    SELECT  TRUNC (SYSDATE, 'IYYY') + (7 * (22 - 1))
    FROM    dual
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say what version of Oracle you're using.
    See the forum FAQ {message:id=9360002}

Maybe you are looking for

  • ITunes 11.3 Crashes As Soon As I Plug In iPhone 5s

    Hi, if you dont mind, could you troubleshoot my issue? As soon as I plug my iphone 5s into my macbook, itunes freezes and i have to force close it. 7/14/14 10:35:25.108 PM SyncServer[814]: [0x7f8bea4082f0] |SQLite|Error| Detected out-of-space situati

  • "Layouts" Panel no longer working in "Create" Mode for photobook

    I have been trying to make a photobook. Due to the large size, and therefore suuuper slowness of the computer, I have mostly been opening and working on individual pages only. I generally open the entire photobook only to change the picture layout fo

  • Cannot extract Patch_1.2.​0.0001.exe

    This patch is intended to add support for Signal Express User Defined Steps for use in both LabVIEW 8.0 and LabVIEW 8.2. Its filename is Patch_1.2.0.0001.exe. When I try to execute this file, however, I get a "header corrupt" error despite downloadin

  • Computer to TV connection

    I have a Macbook from about 2008, and want to connect it to the TV the way I've seen done with PCs. I've been told I need a HDMI to VGA cable, but can't seen to find one anywhere. First, is that what I need? Is my relatively older laptop obsolete for

  • How to set % based charges ?

    We are going to have some charges that are related to the quantity shipped and some that aren't.   Also we have some that have a minimum/maximum charge. Typically, if the charge is a % based charge, then it should be based on the quantity shipped.