A Column in a query which can be expand

Hi guru,
i would like to build  a query in which i can expand and close columns.
The first column will have the Age( <= 20[5, 10, 15, 20]), the other columns ´will be 5, 10, 15, 20.(This columns can be expand oder close.)
How can build a report which shows me the age 20 with the number of empoloyee when it il close and when it is open each agecategory till twenty.
Thanks for your help.
Gilo

Hi,
You can try to create a structure with the char and specific selections that you like. Right click the structure and choose Hierarchy Display. See here for details:
http://help.sap.com/saphelp_nw04/helpdata/en/4d/e2bebb41da1d42917100471b364efa/content.htm
Hope this helps...

Similar Messages

  • Lowest value in CKF column in a query which uses structures.

    Hi Experts:
    I have the following user requirement.
    There is a need to find the least value of the values in a calculated key figure in the columns
    In rows I have structure and 6 structure elements. The structure elements are 0plant restricted with one plant each.
    Plant / Period Spend / Period Volume / $/case / Best of Best
    1000 / 1000     /   20 / 50 /20
    2000 / 2000 / 100 /20/20
    3000/ 3000/ 70 / 50 /43 /20
    The column $/case is a calculated key figure and I need the best of best column to contain the lowest value of the $/Case column
    This Best of Best column needs to be used in another calculated key figure.
    Anyone who has solution will be awarded with SDN points.
    N

    Hello,
             You can try out by creating a CKF and set the properties for that calculated keyfigure best of best with calculate single value as minimum and also result also minimum, then you can use this ckf in another ckf. if not going to be used globally you can try out by using formulas.

  • Add Forecasting column to a Query

    Hi,
    The user wants to add a forecasting column to a query that has the actual and plan costs. He wants the option to change the values of this column in the query. Can I use any planning cubes for this?
    My plan is to make a copy of the cube that has the the budget data, but make it real time. Add a column in the query with this cube. Make this column editable.
    Will this work? Will the history of the changes be stored in the cube, or is it a overwrite function?
    Any input will be appreciated.
    Thanks
    Sam

    Hi,
    Yes you are on the right path. Using real time cubes, you can build an input ready query using which user can make manual entries. But you need not copy your budget data (not to be edited) to real time cube. Its better to keep it and the plan data in real time cube seperatel; build a multiprovider over both the cubes and build your planning application over the multi.
    Regarding storing history of changes, it does get preserved in planning cube, but you need to check if the default planning functionality satisfies your reporting requirements. If not, you might need to implement this in your planning model.

  • QUERY WHICH COUNTS NUMBER OF TIMES WORDS/LETTER APPEAR IN SENTENCE - Thanks

    I have this query below
    it gives the number of times a txn is hign comfort and Approved
    .. nyumber of times txn is meduim comfort and approved etc.
    There is a futher line whihc shows the number of times txn is blacklisted BL COUNT.
    I am trying to get line of query which can show me the number of times txn is approved, is high comfort and blcklisted ( the same applies for
    wl - watch listed)
    The query i am using
    SUM
    (CASE
    WHEN cc.Comment
    LIKE ('BL(%') and cc.Comment
    LIKE ('Approved%')
    AND cc.Comment
    LIKE ('%ComfortLevel=High Comfort%')
     THEN 1
    ELSE 0 END)AS hbcl  - NO RESULTS BEING GIVEN
    pLEASE CAN ANYONE HELP,. THANKS
    QUERY
    USE RiskManagementReporting
    GO
    DECLARE
    @StartDate DATETIME,
    @EndDate DATETIME
    SET @StartDate
    = '2014-01-01 00:00:00'
    SET @EndDate
    = '2014-03-31 23:59:59'
    SELECT
    CONVERT
    (VARCHAR(10),
    mt.OPacket_TransactionTime, 102)
    AS [Date],
    SUM
    (CASE
    WHEN cc.Comment
    LIKE ('Approved%')
    AND cc.Comment
    LIKE ('%ComfortLevel=High Comfort%')
    THEN 1 ELSE 0
    END) AS [A - HighC],
    SUM
    (CASE
    WHEN cc.Comment
    LIKE ('Approved%')
    AND cc.Comment
    LIKE ('%ComfortLevel=Medium Comfort%')
    THEN 1 ELSE 0
    END) AS [A - MediumC],
    SUM
    (CASE
    WHEN cc.Comment
    LIKE ('Approved%')
    AND cc.Comment
    LIKE ('%ComfortLevel=Low Comfort%')
    THEN 1 ELSE 0
    END) AS [A - LowC],
    SUM
    (CASE
    WHEN cc.Comment
    LIKE ('Declined%')
    AND cc.Comment
    LIKE ('%ComfortLevel=Low Risk%')
    THEN 1 ELSE 0
    END) AS [D - LowR],
    SUM
    (CASE
    WHEN cc.Comment
    LIKE ('Declined%')
    AND cc.Comment
    LIKE ('%ComfortLevel=Medium Risk%')
    THEN 1 ELSE 0
    END) AS [D - MediumR],
    SUM
    (CASE
    WHEN cc.Comment
    LIKE ('Declined%')
    AND cc.Comment
    LIKE ('%ComfortLevel=High Risk%')
    THEN 1 ELSE 0
    END) AS [D - HighR],
    SUM
    (CASE
    WHEN cc.Comment
    LIKE ('BL(%')
    THEN 1 ELSE 0
    END) AS [BL Count],
    SUM
    (CASE
    WHEN cc.Comment
    LIKE ('WL(%')
    THEN 1 ELSE 0
    END) AS [WL Count],
    SUM
    (CASE
    WHEN cc.Comment
    LIKE ('Marked as Touched%')
    THEN 1 ELSE 0
    END) AS [Touched by DRT],
    COUNT
    (mt.csnTransactionId)
    AS [Sent to DRT]
    FROM MatchedTransaction mt
    WITH (NOLOCK)
    LEFT
    JOIN CustomerComment cc
    WITH (NOLOCK)
    ON (mt.csnTransactionId
    = cc.SenderMTCN
    AND cc.InsertDate
    BETWEEN @StartDate AND
    DATEADD (D, 1, @EndDate)

    I have adjusted this as  
    SUM
    (CASE
    WHEN cc.Comment
    LIKE ('Approved%')
    AND cc.Comment
    LIKE ('%ComfortLevel=High Comfort%')
    AND cc.Comment
    LIKE ('%BL(%')THEN 1
    ELSE 0 END)
    AS hcbl,
    Still no result

  • Bex Query which uses Dynamic columns to display actuals

    Hi Bex experts,
    I have a query issue/question.
    I currently have a Bex query which shows me the the planned values for each period, spanning 6 years into the future. My Key figure columns are defined as follows:
    Value type  = '020'
    Version  = mandatory variable, entered at execution.
    Posting period (FISCPER3)  = These columns are fixed values using periods 1 to 12 for each column.
    Fiscal year (0FISCYEAR) = Each column contains SAP exit for current year, and using the offset +1, +2, +3, +4 etc, when I define the future years coulmns.
    Currency = fixed 'USD'.
    Fiscal year variant = fixed 'Z4'
    The above works fine for plan data.
    I want to now include is:
    Seperate 'Dynamic columns' to show only actuals for period ranges from period one to the previous period (or current period minus 1). Each period should have it's own column for actuals.
    The dynamic actuals columns should be grouped together to the left of the plan columns.
    Actuals are only for current year, so I will still use the SAP EXIT for current year in the column definition.
    Example: If I am currently in period 10, the query should show me actuals from period 1 to period 9 in seperate columns, then continue to show me my plan values columns that I have in place already.
    How can I construct these actuals columns in to my existing query. If you have possible screens shots.
    Thanks, and maximum points will be alotted.

    The way I have approached this you may not like as it involves quite a bit of coding
    12 CKFs
    each CKF adds up 2 RKFs
    So 24 RKFs
    example Column 6 CKF
    Adds Column 6 RKF Actual and Column 6 RKF Plan
    Column 6 RKF Actual contains Actual version + key figure + Period variable column 6 Actual
    Column 6 RKF Plan contains Plan version + key figure + Period Variable column 6 Plan
    Period variable column 6 Actual
    is a cmod variable which reads the entered date
    if the period of entered date is LE 6
    then return period 6 into "Period variable column 6 Actual"
    else put 0 into "Period variable column 6 Actual"
    Period variable column 6 Plan
    is a cmod variable which reads the entered date
    if the period of entered date is LE 6
    then return period 0 into "Period variable column 6 Plan"
    else put 6 into "Period variable column 6 Plan"
    Now what happens is that if you enter period 6 in your selection screen all the Actuals of columns greater than 6 all have period 0 put into their selection so return 0 and all the columns less than or equal to 6 return the values for the fiscal period (ie column 1 gets period 1)
    And in addition all the Plans columns return the value of their column ie for their period for those greater than 6 and for those less than 6 they all return 0
    It's convulted - but you get the idea - and yes it works
    There may be a better way to do it - and I am open to suggestions
    (this does assume that NOTHING is posted to period 0 otherwise it won't work)

  • How Can i add "DateDiff(day, T0.DueDate" as a column in this query?

    How Can i add "DateDiff(day, T0.DueDate" as a column in this query?
    SELECT T1.CardCode, T1.CardName, T1.CreditLine, T0.RefDate, T0.Ref1 'Document Number',
          CASE  WHEN T0.TransType=13 THEN 'Invoice'
               WHEN T0.TransType=14 THEN 'Credit Note'
               WHEN T0.TransType=30 THEN 'Journal'
               WHEN T0.TransType=24 THEN 'Receipt'
               END AS 'Document Type',
          T0.DueDate, (T0.Debit- T0.Credit) 'Balance'
          ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')<=-1),0) 'Future'
          ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>=0 and DateDiff(day, T0.DueDate,'[%1]')<=30),0) 'Current'
          ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>30 and DateDiff(day, T0.DueDate,'[%1]')<=60),0) '31-60 Days'
          ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>60 and DateDiff(day, T0.DueDate,'[%1]')<=90),0) '61-90 Days'
          ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>90 and DateDiff(day, T0.DueDate,'[%1]')<=120),0) '91-120 Days'
          ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>=121),0) '121+ Days'
    FROM JDT1 T0 INNER JOIN OCRD T1 ON T0.ShortName = T1.CardCode
    WHERE (T0.MthDate IS NULL OR T0.MthDate > [%1]) AND T0.RefDate <= [%1] AND T1.CardType = 'C'
    ORDER BY T1.CardCode, T0.DueDate, T0.Ref1

    Hi,
    As you mentioned not possible to assign the dynamic column in the query.
    will give you example for generate a dynamic column name in SQL query, using this example you can achieve your requirement.
    DECLARE @cols AS NVARCHAR(MAX),
        @query  AS NVARCHAR(MAX)
    select @cols = STUFF((SELECT distinct ',' + QUOTENAME(C.Name) 
                        from [History]
                FOR XML PATH(''), TYPE
                ).value('.', 'NVARCHAR(MAX)')
            ,1,1,'')
    set @query = 'SELECT [Date],' + @cols +'
                 from
                    select [Date], Name, Value
                    from [History]
                 ) x
                pivot
                    max(value)
                    for Name in (' + @cols + ')
                ) p '
    execute(@query)

  • Hideing a Column in ALV Table which is Displaying the POWL Query data

    Hi SDNers,
    I want to hide a column of ALV Table which is displaying my POWL Query data in it and hideing should be based on the Role as well. i.e few of the role the column shoudl be hidden and few of the roles should have the Column visible.
    waiting for the Valueble Answers.
    Thanks & Regards,
    Govindu

    Hai Kris,
        I took help from ur link and i declared a global attribute request_number.
    and i created an event handler ON_ALV_INSERT and did the follwing coding for giving default value wen ever am inserting new row.
    FIELD-SYMBOLS: <wa_row> LIKE LINE OF r_param->t_inserted_rows.
      DATA bill_details TYPE REF TO zdom_bill_detail.
      LOOP AT r_param->t_inserted_rows ASSIGNING <wa_row>.
        bill_details ?= <wa_row>-r_value.
        IF bill_details->REQ_NUMBER IS INITIAL.
      DATA lo_nd_bill_detail TYPE REF TO if_wd_context_node.
      DATA lo_el_bill_detail TYPE REF TO if_wd_context_element.
      DATA ls_bill_detail TYPE wd_this->Element_bill_detail.
    navigate from <CONTEXT> to <BILL_DETAIL> via lead selection
      lo_nd_bill_detail = wd_context->get_child_node( name = wd_this->wdctx_bill_detail ).
    lo_el_bill_detail = lo_nd_bill_detail->get_element( index = <wa_row>-index ).
          lo_el_bill_detail->set_attribute(
            EXPORTING
              name  = 'REQ_NUMBER'
              value = wd_comp_controller->request_number
    Wen am  setting the value of wd_comp_controller->request_number to my context attribute am getting NULL object ref error.
    lo_el_bill_detail->set_attribute(
        name =  `REQ_NUMBER`
        value = wd_comp_controller->request_number ).
    Pls give some suggestions,
    Thanks in Advance,
    Nalla.B

  • ESS Error- Data source contains no columns which can be displayed

    Hi
      After the application of support packs, an error is observed in ESS applications where the data/content has to be displayed in tabular format.
      On accessing Personal Data application, error message is displayed -
       Error Occured
       Data source contains no columns which can be displayed
       Screenshot is also attached for reference.
       Please help in resolving the issue.
    Regards
    Shaily

    Hi all!
    I have the same problem, any ideas how to analyze and solve the problem?
    Regards
    Peter Meyer

  • Web ADI Error when using column from table which can be NULL as parameter

    Hi
    We have a custom integrator which queries the records and downloads into excel sheet. There is parameter list attached to it. One of the parameter is on a field which can have NULL. When we try running the ADI , we are getting the error :
    Fatal error: Please have your system administrator view the bne.log file.
    java.lang.NullPointerException
    Please contact your support representative
    Please help.
    Regards,
    Pradeep.

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Stefan Misch ([email protected]):
    Yep - if you try:
    create unique index XAK2_A_ARTIKEL
    on A_ARTIKEL(CUST_ID, EXTERNAL_ID);
    I get error ORA-01452, because of duplicate keys. I verified, that within a each CUST_ID, there is no duplicate non-null EXTERNAL_ID, but there are lots of rows for each CUST_ID where EXTERNAL_ID is NULL.
    Thanks for your help.
    Stefan<HR></BLOCKQUOTE>
    Create a view on your table, that you will use for inserts.
    Then, create a trigger INSTEAD OF INSERT on your view. You can perform the checks for uniqueness in it...
    Hope this will help...
    Thomas.
    null

  • NEED HELP IN REDUCING THE LENGTH OF QUERY WHICH IS ATTACHED IN A FILE PL_SQ

    Hi Everyone,
    THANKS FOR POSTING THE REPLIES FOR MY LAST THREAD. THAT REALLY HELPED. I CAME BACK AGAIN BECAUSE I NEED HELP FROM THIS FORUM IN REDUING THE LENGTH OF MY QUERY WHICH I HAD GIVEN BELOW. i DIDN'T HAD THE CHOICE OF ATTACHING A FILE OF MY DATA HERE.ITS VERY HUGE DATA SO I AM NOT ABLE TO PROVIDE ATLEAST SAMPLE DATA BECAUSE THE COLUMNS ARE OVERLAPPING IF I AM PASTING THE DATA HERE. I HOPE IT WILL BE UNDERSTANDABLE. THE QUERY WHICH I WROTE IS TOO LONG AND TAKING HOURS TOGETHER TO RUN AND DISPLAY RESULT. IT WOULD BE A GREAT FAVOUR TO ME IF ANYONE CAN REDUCE THE LINES IN MY QUERY AND MAKE IT RUN FAST....PLEASE I WAS NOT KNOWING THE WAY HOW TO MAKE IT SHORT. IT HAS MANY LOGICS IN IT... :? PLEASE SUGGEST ME IF THERE IS ANY OPTION FOR ATTACHING A FILE SO THAT I CAN SEND MY SAMPLE DATA...
    select pt.product code,
    pt.product status,
    pt.store code,
    pt.store status,
    pr.scheduled date,
    pr.actual date,
    pl.scheduled date,
    pl.actual date,
    ps.scheduled date,
    ps.actual date,
    fo.scheduled date,
    fo.actual date,
    fb.scheduled date,
    fb.actual date,
    fod.scheduled date,
    fod.actual date,
    lo.scheduled date,
    lo.actual date,
    lom.scheduled date,
    lom.actual date,
    lod.scheduled date,
    lod.actual date,
    /*pr*/
    case
    WHEN pt.store status = 'Cancelled' OR
    pt.store status = 'Stopped' THEN
    cast('N/A' AS nvarchar2(30))
    WHEN pt.store status = 'Completed' OR
    pt.store status = 'Active' THEN
    NVL2(pr.scheduled date,
    cast(pr.scheduled date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'Planned' THEN
    NVL2(pr.scheduled date,
    cast(pr.scheduled date AS nvarchar2(30)),
    'Null')
    end as DER_pr_SHC,
    case
    when pt.store status = 'Cancelled' OR
    pt.store status = 'Stopped' THEN
    cast('N/A' AS nvarchar2(30))
    WHEN pt.store status = 'Completed' THEN
    NVL2(pr.actual date,
    cast(pr.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'Active' and
    pr.scheduled date is null THEN
    NVL2(pr.actual date,
    cast(pr.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'Active' and
    pr.scheduled date < CURRENT_DATE THEN
    NVL2(pr.actual date,
    cast(pr.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'Active' and
    pr.scheduled date >= CURRENT_DATE THEN
    NVL2(pr.actual date,
    cast(pr.actual date AS nvarchar2(30)),
    'N/A')
    when pt.store status = 'Planned' and
    pr.scheduled date is null THEN
    NVL2(pr.actual date,
    cast(pr.actual date AS nvarchar2(30)),
    'N/A')
    when pt.store status = 'Planned' and
    pr.scheduled date < CURRENT_DATE THEN
    NVL2(pr.actual date,
    cast(pr.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'Planned' and
    pr.scheduled date >= CURRENT_DATE THEN
    NVL2(pr.actual date,
    cast(pr.actual date AS nvarchar2(30)),
    'N/A')
    end as DER_pr_ACT,
    /*pl*/
    case
    WHEN pt.store status = 'Cancelled' OR
    pt.store status = 'Stopped' THEN
    cast('N/A' AS nvarchar2(30))
    WHEN pt.store status = 'Completed' OR
    pt.store status = 'Active' THEN
    NVL2(pl.scheduled date,
    cast(pl.scheduled date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'Planned' THEN
    NVL2(pl.scheduled date,
    cast(pl.scheduled date AS nvarchar2(30)),
    'Null')
    end as DER_pl_SHC,
    case
    when pt.store status = 'Cancelled' OR
    pt.store status = 'Stopped' THEN
    cast('N/A' AS nvarchar2(30))
    WHEN pt.store status = 'Completed' THEN
    NVL2(pl.actual date,
    cast(pl.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'Active' and
    pl.scheduled date is null THEN
    NVL2(pl.actual date,
    cast(pl.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'Active' and
    pl.scheduled date < CURRENT_DATE THEN
    NVL2(pl.actual date,
    cast(pl.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'Active' and
    pl.scheduled date >= CURRENT_DATE THEN
    NVL2(pl.actual date,
    cast(pl.actual date AS nvarchar2(30)),
    'N/A')
    when pt.store status = 'Planned' and
    pl.scheduled date is null THEN
    NVL2(pl.actual date,
    cast(pl.actual date AS nvarchar2(30)),
    'N/A')
    when pt.store status = 'Planned' and
    pl.scheduled date < CURRENT_DATE THEN
    NVL2(pl.actual date,
    cast(pl.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'Planned' and
    pl.scheduled date >= CURRENT_DATE THEN
    NVL2(pl.actual date,
    cast(pl.actual date AS nvarchar2(30)),
    'N/A')
    end as DER_pl_ACT,
    /*ps*/
    case
    WHEN pt.store status = 'Cancelled' OR
    pt.store status = 'Stopped' THEN
    cast('N/A' AS nvarchar2(30))
    WHEN pt.store status = 'Completed' OR
    pt.store status = 'Active' THEN
    NVL2(ps.scheduled date,
    cast(ps.scheduled date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'planned' THEN
    NVL2(ps.scheduled date,
    cast(ps.scheduled date AS nvarchar2(30)),
    'Null')
    end as DER_ps_SHC,
    case
    when pt.store status = 'Cancelled' OR
    pt.store status = 'Stopped' THEN
    cast('N/A' AS nvarchar2(30))
    WHEN pt.store status = 'Completed' THEN
    NVL2(ps.actual date,
    cast(ps.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'Active' and
    ps.scheduled date is null THEN
    NVL2(ps.actual date,
    cast(ps.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'Active' and
    ps.scheduled date < CURRENT_DATE THEN
    NVL2(ps.actual date,
    cast(ps.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'Active' and
    ps.scheduled date >= CURRENT_DATE THEN
    NVL2(ps.actual date,
    cast(ps.actual date AS nvarchar2(30)),
    'N/A')
    when pt.store status = 'planned' and
    ps.scheduled date is null THEN
    NVL2(ps.actual date,
    cast(ps.actual date AS nvarchar2(30)),
    'N/A')
    when pt.store status = 'planned' and
    ps.scheduled date < CURRENT_DATE THEN
    NVL2(ps.actual date,
    cast(ps.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'planned' and
    ps.scheduled date >= CURRENT_DATE THEN
    NVL2(ps.actual date,
    cast(ps.actual date AS nvarchar2(30)),
    'N/A')
    end as DER_ps_ACT,
    /*fo*/
    case
    WHEN pt.store status = 'Cancelled' OR
    pt.store status = 'Stopped' THEN
    cast('N/A' AS nvarchar2(30))
    WHEN pt.store status = 'Completed' OR
    pt.store status = 'Active' THEN
    NVL2(fo.scheduled date,
    cast(fo.scheduled date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'planned' THEN
    NVL2(fo.scheduled date,
    cast(fo.scheduled date AS nvarchar2(30)),
    'Null')
    end as DER_fo_SHC,
    case
    when pt.store status = 'Cancelled' OR
    pt.store status = 'Stopped' THEN
    cast('N/A' AS nvarchar2(30))
    WHEN pt.store status = 'Completed' THEN
    NVL2(fo.actual date,
    cast(fo.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'Active' and
    fo.scheduled date is null THEN
    NVL2(fo.actual date,
    cast(fo.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'Active' and
    fo.scheduled date < CURRENT_DATE THEN
    NVL2(fo.actual date,
    cast(fo.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'Active' and
    fo.scheduled date >= CURRENT_DATE THEN
    NVL2(fo.actual date,
    cast(fo.actual date AS nvarchar2(30)),
    'N/A')
    when pt.store status = 'planned' and
    fo.scheduled date is null THEN
    NVL2(fo.actual date,
    cast(fo.actual date AS nvarchar2(30)),
    'N/A')
    when pt.store status = 'planned' and
    fo.scheduled date < CURRENT_DATE THEN
    NVL2(fo.actual date,
    cast(fo.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'planned' and
    fo.scheduled date >= CURRENT_DATE THEN
    NVL2(fo.actual date,
    cast(fo.actual date AS nvarchar2(30)),
    'N/A')
    end as DER_fo_ACT,
    /*fb*/
    case
    WHEN pt.store status = 'Cancelled' OR
    pt.store status = 'Stopped' THEN
    cast('N/A' AS nvarchar2(30))
    WHEN pt.store status = 'Completed' OR
    pt.store status = 'Active' THEN
    NVL2(fb.scheduled date,
    cast(fb.scheduled date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'planned' THEN
    NVL2(fb.scheduled date,
    cast(fb.scheduled date AS nvarchar2(30)),
    'Null')
    end as DER_fb_SHC,
    case
    when pt.store status = 'Cancelled' OR
    pt.store status = 'Stopped' THEN
    cast('N/A' AS nvarchar2(30))
    WHEN pt.store status = 'Completed' THEN
    NVL2(fb.actual date,
    cast(fb.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'Active' and
    fb.scheduled date is null THEN
    NVL2(fb.actual date,
    cast(fb.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'Active' and
    fb.scheduled date < CURRENT_DATE THEN
    NVL2(fb.actual date,
    cast(fb.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'Active' and
    fb.scheduled date >= CURRENT_DATE THEN
    NVL2(fb.actual date,
    cast(fb.actual date AS nvarchar2(30)),
    'N/A')
    when pt.store status = 'planned' and
    fb.scheduled date is null THEN
    NVL2(fb.actual date,
    cast(fb.actual date AS nvarchar2(30)),
    'N/A')
    when pt.store status = 'planned' and
    fb.scheduled date < CURRENT_DATE THEN
    NVL2(fb.actual date,
    cast(fb.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'planned' and
    fb.scheduled date >= CURRENT_DATE THEN
    NVL2(fb.actual date,
    cast(fb.actual date AS nvarchar2(30)),
    'N/A')
    end as DER_fb_ACT,
    /*fod*/
    case
    WHEN pt.store status = 'Cancelled' OR
    pt.store status = 'Stopped' THEN
    cast('N/A' AS nvarchar2(30))
    WHEN pt.store status = 'Compldeted' OR
    pt.store status = 'Active' THEN
    NVL2(fod.scheduled date,
    cast(fod.scheduled date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'pldanned' THEN
    NVL2(fod.scheduled date,
    cast(fod.scheduled date AS nvarchar2(30)),
    'Null')
    end as DER_fod_SHC,
    case
    when pt.store status = 'Cancelled' OR
    pt.store status = 'Stopped' THEN
    cast('N/A' AS nvarchar2(30))
    WHEN pt.store status = 'Completed' THEN
    NVL2(fod.actual date,
    cast(fod.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'Active' and
    fod.scheduled date is null THEN
    NVL2(fod.actual date,
    cast(fod.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'Active' and
    fod.scheduled date < CURRENT_DATE THEN
    NVL2(fod.actual date,
    cast(fod.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'Active' and
    fod.scheduled date >= CURRENT_DATE THEN
    NVL2(fod.actual date,
    cast(fod.actual date AS nvarchar2(30)),
    'N/A')
    when pt.store status = 'planned' and
    fod.scheduled date is null THEN
    NVL2(fod.actual date,
    cast(fod.actual date AS nvarchar2(30)),
    'N/A')
    when pt.store status = 'planned' and
    fod.scheduled date < CURRENT_DATE THEN
    NVL2(fod.actual date,
    cast(fod.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'planned' and
    fod.scheduled date >= CURRENT_DATE THEN
    NVL2(fod.actual date,
    cast(fod.actual date AS nvarchar2(30)),
    'N/A')
    end as DER_fod_ACT,
    /*lo*/
    case
    WHEN pt.store status = 'Cancelled' OR
    pt.store status = 'Stopped' THEN
    cast('N/A' AS nvarchar2(30))
    WHEN pt.store status = 'Completed' OR
    pt.store status = 'Active' THEN
    NVL2(lo.scheduled date,
    cast(lo.scheduled date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'planned' THEN
    NVL2(lo.scheduled date,
    cast(lo.scheduled date AS nvarchar2(30)),
    'Null')
    end as DER_lo_SHC,
    case
    when pt.store status = 'Cancelled' OR
    pt.store status = 'Stopped' THEN
    cast('N/A' AS nvarchar2(30))
    WHEN pt.store status = 'Completed' THEN
    NVL2(lo.actual date,
    cast(lo.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'Active' and
    lo.scheduled date is null THEN
    NVL2(lo.actual date,
    cast(lo.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'Active' and
    lo.scheduled date < CURRENT_DATE THEN
    NVL2(lo.actual date,
    cast(lo.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'Active' and
    lo.scheduled date >= CURRENT_DATE THEN
    NVL2(lo.actual date,
    cast(lo.actual date AS nvarchar2(30)),
    'N/A')
    when pt.store status = 'planned' and
    lo.scheduled date is null THEN
    NVL2(lo.actual date,
    cast(lo.actual date AS nvarchar2(30)),
    'N/A')
    when pt.store status = 'planned' and
    lo.scheduled date < CURRENT_DATE THEN
    NVL2(lo.actual date,
    cast(lo.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'planned' and
    lo.scheduled date >= CURRENT_DATE THEN
    NVL2(lo.actual date,
    cast(lo.actual date AS nvarchar2(30)),
    'N/A')
    end as DER_lo_ACT,
    /*lom*/
    case
    WHEN pt.store status = 'Cancelled' OR
    pt.store status = 'Stopped' THEN
    cast('N/A' AS nvarchar2(30))
    WHEN pt.store status = 'Completed' OR
    pt.store status = 'Active' THEN
    NVL2(lom.scheduled date,
    cast(lom.scheduled date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'planned' THEN
    NVL2(lom.scheduled date,
    cast(lom.scheduled date AS nvarchar2(30)),
    'Null')
    end as DER_lom_SHC,
    case
    when pt.store status = 'Cancelled' OR
    pt.store status = 'Stopped' THEN
    cast('N/A' AS nvarchar2(30))
    WHEN pt.store status = 'Completed' THEN
    NVL2(lom.actual date,
    cast(lom.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'Active' and
    lom.scheduled date is null THEN
    NVL2(lom.actual date,
    cast(lom.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'Active' and
    lom.scheduled date < CURRENT_DATE THEN
    NVL2(lom.actual date,
    cast(lom.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'Active' and
    lom.scheduled date >= CURRENT_DATE THEN
    NVL2(lom.actual date,
    cast(lom.actual date AS nvarchar2(30)),
    'N/A')
    when pt.store status = 'planned' and
    lom.scheduled date is null THEN
    NVL2(lom.actual date,
    cast(lom.actual date AS nvarchar2(30)),
    'N/A')
    when pt.store status = 'planned' and
    lom.scheduled date < CURRENT_DATE THEN
    NVL2(lom.actual date,
    cast(lom.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'planned' and
    lom.scheduled date >= CURRENT_DATE THEN
    NVL2(lom.actual date,
    cast(lom.actual date AS nvarchar2(30)),
    'N/A')
    end as DER_lom_ACT,
    /*lod*/
    case
    WHEN pt.store status = 'Cancelled' OR
    pt.store status = 'Stopped' THEN
    cast('N/A' AS nvarchar2(30))
    WHEN pt.store status = 'Completed' OR
    pt.store status = 'Active' THEN
    NVL2(lod.scheduled date,
    cast(lod.scheduled date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'planned' THEN
    NVL2(lod.scheduled date,
    cast(lod.scheduled date AS nvarchar2(30)),
    'Null')
    end as DER_lod_SHC,
    case
    when pt.store status = 'Cancelled' OR
    pt.store status = 'Stopped' THEN
    cast('N/A' AS nvarchar2(30))
    WHEN pt.store status = 'Completed' THEN
    NVL2(lod.actual date,
    cast(lod.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'Active' and
    lod.scheduled date is null THEN
    NVL2(lod.actual date,
    cast(lod.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'Active' and
    lod.scheduled date < CURRENT_DATE THEN
    NVL2(lod.actual date,
    cast(lod.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'Active' and
    lod.scheduled date >= CURRENT_DATE THEN
    NVL2(lod.actual date,
    cast(lod.actual date AS nvarchar2(30)),
    'N/A')
    when pt.store status = 'planned' and
    lod.scheduled date is null THEN
    NVL2(lod.actual date,
    cast(lod.actual date AS nvarchar2(30)),
    'N/A')
    when pt.store status = 'planned' and
    lod.scheduled date < CURRENT_DATE THEN
    NVL2(lod.actual date,
    cast(lod.actual date AS nvarchar2(30)),
    'Null')
    when pt.store status = 'planned' and
    lod.scheduled date >= CURRENT_DATE THEN
    NVL2(lod.actual date,
    cast(lod.actual date AS nvarchar2(30)),
    'N/A')
    end as DER_lod_ACT
    from
    product table pt,
    event table pr,
    event table pl,
    event table ps,
    event table fo,
    event table fb,
    event table fod,
    event table lo,
    event table lom,
    event table lod
    where
    pt.product code = pr.product code
    and pt.store code = pr.store code
    and pt.product code = pl.product code
    and pt.store code = pl.store code
    and pt.product code = fo.product code
    and pt.store code = fo.store code
    and pt.product code = fb.product code
    and pt.store code = fb.store code
    and pt.product code = fod.product code
    and pt.store code = fod.store code
    and pt.product code = lo.product code
    and pt.store code = lo.store code
    and pt.product code = lom.product code
    and pt.store code = lom.store code
    and pt.product code = lod.product code
    and pt.store code = lod.store code
    and pr.product code=pl.product code
    and pl.store code=ps.store code
    and ps.product code=fo.product code
    and fo.store code=fb.store code
    and fb.product code=fod.product code
    and fod.store code=lo.store code
    and lo.product code=lom.product code
    and lom.store code=lod.store code
    and pr.event code=1001
    and pl.event code=1002
    and ps.event code=1003
    and fo.event code=1004
    and fb.event code=1005
    and fod.event code=1006
    and lo.event code=1007
    and lom.event code=1008
    and lod.event code=1009
    order by product code,store code;
    THANKS IN ADVANCE FOR SPARING YOUR TIME IN UNDERSTANDING MY PROVLEM....
    REGARDS,
    MYTHRI.

    986300 wrote:
    from
    product table pt,
    event table pr,
    event table pl,
    event table ps,
    event table fo,
    event table fb,
    event table fod,
    event table lo,
    event table lom,
    event table lodabove is NOT valid SQL syntax

  • Adding a new column to af:query on af:table

    Hi,
    I have an ADF table added to a jspx page as below:
    <af:table value="#{bindings.RuleLibraryVO1.collectionModel}" var="row"
    rows="#{bindings.RuleLibraryVO1.rangeSize}"
    emptyText="#{bindings.RuleLibraryVO1.viewable ? coregccomplianceuiBundle.MSG_NO_DATA_DISPLAY : coregccomplianceuiBundle.MSG_ACCESS_DENIED}"
    fetchSize="#{bindings.RuleLibraryVO1.rangeSize}"
    rowBandingInterval="25" rowSelection="multiple" id="ruleLib"
    binding="#{viewScope.rule_librarybean.rulet}"
    columnStretching="column:c4"
    selectionListener="#{bindings.RuleLibraryVO1.collectionModel.makeCurrent}"
    summary="#{coregccomplianceuiBundle.RULE_LIB_SUMMARY}"
    disableColumnReordering="true">
    <f:facet name="contextMenu">
    <af:popup id="Ctablemenup" contentDelivery="immediate">
    <af:menu id="_menuActionp">
    <af:group id="g5p">
    <af:commandMenuItem ......
    </af:commandMenuItem>
    </af:group>
    </af:menu>
    </af:popup>
    </f:facet>
    <af:column id="c6" width="10" rowHeader="true"/>
    <af:column sortProperty="IsSystem" sortable="true"
    headerText="#{coregccomplianceuiBundle.BLANKTEXT}" id="c13"
    rowHeader="unstyled" width="16">
    <af:switcher id="sw1" facetName="#{row.IsSystem}" defaultFacet="1">
    <f:facet name="1">
    <af:panelGroupLayout id="pg1" layout="horizontal">
    <af:image source="/images/lock_ena.png" id="cil1"
    shortDesc="#{coregccomplianceuiBundle.SYSTEM_DEFINED_COMPLIANCE_RULE}"/>
    </af:panelGroupLayout>
    </f:facet>
    <f:facet name="0">
    <af:panelGroupLayout id="pg1-1" layout="horizontal">
    <af:image source="/images/blank.gif" id="ot11"
    shortDesc="#{coregccomplianceuiBundle.USER_DEFINED_COMPLIANCE_RULE}"/>
    <!--
    <af:outputText value="#{coregccomplianceuiBundle.BLANKTEXT}" id="ot11"
    shortDesc="#{coregccomplianceuiBundle.USER_DEFINED_COMPLIANCE_RULE}"/>
    -->
    </af:panelGroupLayout>
    </f:facet>
    </af:switcher>
    </af:column>
    <af:column sortProperty="RuleDname" sortable="true"
    headerText="#{bindings.RuleLibraryVO1.hints.RuleDname.label}"
    id="c3" width="200" rowHeader="unstyled">
    <af:commandLink action="#{viewScope.rule_librarybean.handleDetails}"
    text="#{row.RuleDname}" id="ot1l"/>
    <!--
    <af:outputText value="#{row.RuleDname}" id="ot1"/>
    -->
    </af:column>
    <af:column sortProperty="TargetTypeDisplayName" sortable="true"
    headerText="#{bindings.RuleLibraryVO1.hints.TargetTypeDisplayName.label}"
    id="c2" width="150">
    <af:outputText value="#{row.TargetTypeDisplayName}" id="soc1"/>
    </af:column>
    <af:column sortProperty="Description" sortable="true"
    headerText="#{bindings.RuleLibraryVO1.hints.Description.label}"
    id="c4" noWrap="false">
    <af:outputText value="#{row.Description}" id="ot3"/>
    </af:column>
    <af:column sortProperty="RuleTypeUI" sortable="true"
    headerText="#{bindings.RuleLibraryVO1.hints.RuleTypeUI.label}"
    id="c1" width="150">
    <af:outputText value="#{row.RuleTypeUI}" id="ot2"/>
    </af:column>
    <af:column sortProperty="LifeCyleStateUI" sortable="true"
    headerText="#{bindings.RuleLibraryVO1.hints.LifeCyleStateUI.label}"
    id="c5" width="150">
    <af:outputText value="#{row.LifeCyleStateUI}" id="ot4"/>
    </af:column>
    <af:column headerText="#{bindings.RuleLibraryVO1.hints.Keywords.label}"
    id="c7" sortProperty="Keywords" sortable="true"
    noWrap="false">
    <af:inputText value="#{row.Keywords}" id="ot5" label="#{coregccomplianceuiBundle.BLANKTEXT}"
    readOnly="true"/>
    </af:column>
    <af:column headerText="#{bindings.RuleLibraryVO1.hints.Author.label}"
    id="c8" sortProperty="Author" sortable="true">
    <af:outputText value="#{row.Author}" id="ot6"/>
    </af:column>
    <af:column headerText="#{bindings.RuleLibraryVO1.hints.SeverityUI.label}"
    id="c9" visible="false">
    <af:outputText value="#{row.SeverityUI}" id="ot7"/>
    </af:column>
    <af:column headerText="#{bindings.RuleLibraryVO1.hints.LastUpdatedBy.label}"
    id="c10" visible="false">
    <af:outputText value="#{row.LastUpdatedBy}" id="ot8"/>
    </af:column>
    <af:column headerText="#{bindings.RuleLibraryVO1.hints.LastUpdatedDate.label}"
    id="c11" sortProperty="LastUpdatedDate" sortable="true">
    <af:outputText value="#{row.LastUpdatedDate}" id="ot9">
    <af:convertDateTime type="both" dateStyle="medium"
    timeStyle="full"/>
    </af:outputText>
    </af:column>
    <af:column headerText="#{bindings.RuleLibraryVO1.hints.Owner.label}"
    id="c12" visible="false">
    <af:outputText value="#{row.Owner}" id="ot10"/>
    </af:column>
    </af:table>
    I also have a search option added to the page as:
    <af:query id="qryId2"
    headerText="#{coregccomplianceuiBundle.COMPLIANCE_SEARCH}"
    disclosed="false"
    value="#{bindings.RuleLibraryVOCriteriaQuery.queryDescriptor}"
    model="#{bindings.RuleLibraryVOCriteriaQuery.queryModel}"
    queryListener="#{bindings.RuleLibraryVOCriteriaQuery.processQuery}"
    queryOperationListener="#{bindings.RuleLibraryVOCriteriaQuery.processQueryOperation}"
    resultComponentId="::pc1:ruleLib" rows="3" maxColumns="2"
    saveQueryMode="hidden"/>
    The VO Criteria that is used by this search query is having 5 columns which are searchable now i want to add one more column which can be searched.
    I have added the colum to VO Criteria query
    But then also the 6th search column is not visible in UI.
    Can anyone suggest what am i missing???

    1) Check if the corresponding VO attribute is defined as "Queryable"
    2) Check if the Rendered Mode of the corresponding criterion of the VO Criteria is "All" (the Rendered Mode is defined in the "Hints" page of the VO Criteria dialog box, select the criterion in order to see its Rendered Mode)
    Dimitar

  • Improving query which is using IN clause

    Hi,
    I am currently using a query which has IN (1.2.3....N) clause in where condition.
    The table has more than 100000 records in it. I have a set of 20 values which I pass inside this IN clause.
    The column which is used for IN clause is indexed.
    Can I use anything other than IN clause for this purpose?
    What is better way?
    Thanks,
    Plad

    > Can I use anything other than IN clause for this purpose? > What is better way?
    Sure you could use something else, but the IN clause would perfectly suit your needs. And the one who has to maintain the code after you are gone, will be glad you used IN, because it is as clear as you can get.
    If you are hinting at the fact that the query is too slow, then please read [url http://forums.oracle.com/forums/thread.jspa?threadID=501834&tstart=0]this thread and try to find out how many rows out of the 100K satisfy your IN predicate.
    Regards,
    Rob.

  • Make entry disabled column in a query input column

    Hi,
    I would like to disable a column to entry by the user in a query which is input enabled query.
    The requirement is
    Original and Current budgets are being copied from ECC (in Funds Management) - Let us say 0 and 1
    remaining versions 2 - 12 are changeable versions from April to Feb. for changing.
    Version 2 will be copied from version 1 (which is a current budget)
    Then the users will make changes in IP to the version 2 and will retracted back to ECC.
    Once the version 2 is retracted back to ECC, it will locked and version 2 will be copied to version 3 in IP.
    Then the users will make changes to version 3 in IP and the same will be retracted back to ECC.
    The same sequence will continue till version 12.
    This version 12 will be approved in ECC and will become Original Budget in ECC.
    The whole cycle continues again for the next year.
    If anybody can give some inputs on this, it would be much appreciated.
    Regards,
    Ravi

    Hi,
    I would do this by developing data slices together with a concept that locks versions depending on the activities you have (e.g. closing a version and retracting it => this version is added to the "locked versions").
    Hope that helps?
    Regards,
    Andreas

  • ADD a column in a query

    Hi
    I want to add a column in my query.
    This column is the sum of the net value and the tax ..please how can I do this without refering to ABAP development..
    thanks in advance

    This is not an SD question and you might want to use Search (and include other forums) in the future.
    There is no ABAP needed for such basic calculations in queries. In SQ01, this can be done in the 'Select field' screen (it's the 3rd screen where you select which fields will be included in the query.
    First, assign short names to your Net Value and Tax fields. Go to the menu Edit -> Short Names -> Turn On/off. This should open another column to the right from the field names. Enter the names, say NET and TAX.
    Then create a new local field. Same menu, Edit -> Local field -> Create. Give the field some name (TOTAL), assign a type ('Same field as -> use Net field or whatever is suitable). Enter formula NET + TAX and save.

  • Reducing number of columns in case query

    Hi all,
    I am operating on 10G R/2.
    I have a query which produces the columns with the number of counts.
    SUM (CASE WHEN LTRIM(RTRIM(W_O)) ='ROKOLBIN' THEN 1 ELSE 0 END) AS "O_ROKOLBIN",
    SUM (CASE WHEN LTRIM(RTRIM(W_I)) = 'ROKOLBIN'THEN 1 ELSE 0 END) AS "I_ROKOLBIN",
    sum(case when LTRIM(RTRIM(W_O)) ='GULURU' then 1 else 0 end) as "O_GULURU",
    sum(case when LTRIM(RTRIM(W_I)) ='GULURU' then 1 else 0 end) as "I_GULURU",
    sum(case when LTRIM(RTRIM(W_ON ))='PURE' then 1 else 0 end) as "O_PURE",
    I would like to reduce teh number of columns to 2,
    One column is for Division.Division can be either O_ROKOLBIN,I_ROKOLBIN,O_GULURU,I_GULURU,O_PURE
    The other column is Subtotal.Subtotal are teh sums as above ,SUM (CASE WHEN LTRIM(RTRIM(W_O)) ='ROKOLBIN' THEN 1 .
    Can anyone advie how can I acheiev this.
    Thanks.

    Hi,
    CrackerJack wrote:
    Hi all,
    Thank you for your wonderful ideas,
    I took it onboard and redesigned the query to add the dates.
    <pre>
    SELECT
    DATE_DIVISION week_start_date ,
    next_day ( DATE_DIVISION - 7, 'Sunday' ) + 6 week_end_date ,
    to_number(to_char(DATE_DIVISION,'WW') )week_no ,
    'I_'||W_I AS DIVISION ,
    COUNT(W_I) CNT
    FROM TEST A
    </pre>I get an error when I run that. Don't you need to say TEST_A, with an underscore?
    <pre>
    GROUP BY DATE_DIVISION, next_day ( DATE_DIVISION - 7, 'Sunday' ) + 6, to_number(to_char(DATE_DIVISION,'WW') ), 'I_'||W_I
    </pre>
    At the moment query is coming up like this:
    12-Jan-10     14-Jan-10     2     I_GULURU     1
    12-Jan-10     14-Jan-10     2     I_GULURU     1
    12-Jan-10     14-Jan-10     2     I_PURE     1
    12-Jan-10     14-Jan-10     2     I_PURE     1
    12-Jan-10     14-Jan-10     2     I_GULURU     1
    12-Jan-10     14-Jan-10     2     I_GULURU     2
    12-Jan-10     14-Jan-10     2     I_GULURU     1
    12-Jan-10     14-Jan-10     2     I_ROKOLBIN     1
    12-Jan-10     14-Jan-10     2     I_GULURU     1
    12-Jan-10     14-Jan-10     2     I_ROKOLBIN     1
    12-Jan-10     14-Jan-10     2     I_PURE     1
    12-Jan-10     14-Jan-10     2     I_GULURU     1I don't think you're getting this output from the sample data you posted. The dates in the sample data are all in February. It would really help if you posted the actual data, and the results you want from that data. In this case, I suspect the whole problem is that the dates in your real data (unlike your sample data) all have different times. If that's so, use TRUNC (date_division), instead of date_division, like this:
    SELECT    TRUNC (date_division)     AS week_start_date
    ,       next_day ( TRUNC (date_division) - 1
                 , 'Saturday'
                    )           AS week_end_date
    ,       TO_CHAR ( date_division
                , 'FMWW'
                )          AS week_no
    ,       'I_' || w_i           AS division
    ,       COUNT (w_i)           AS cnt
    FROM        test_a
    GROUP BY  TRUNC (date_division)
    ,       TO_CHAR ( date_division
                , 'FMWW'
    ,       w_i
    ;

Maybe you are looking for