Display sum in matrix format

Hi all,
I have a table contains data in following format
year style jan feb mar
2001 a 10 5 6
2002 a 5 5 6
2003 a 10 10 6
2004 a 5 6 6
for this detail I want to create view that should have a structure as following
style 2001 2002 2003 2004
a 21 16 26 17
any clue how I can achive this?

scott@ORA92> -- test table and test data:
scott@ORA92> SELECT * FROM your_table
  2  /
      YEAR S        JAN        FEB        MAR
      2001 a         10          5          6
      2002 a          5          5          6
      2003 a         10         10          6
      2004 a          5          6          6
scott@ORA92> -- create view:
scott@ORA92> CREATE OR REPLACE VIEW your_view AS
  2  SELECT style,
  3           SUM (DECODE (year, 2001, jan + feb + mar)) AS "2001",
  4           SUM (DECODE (year, 2002, jan + feb + mar)) AS "2002",
  5           SUM (DECODE (year, 2003, jan + feb + mar)) AS "2003",
  6           SUM (DECODE (year, 2004, jan + feb + mar)) AS "2004"
  7  FROM   your_table
  8  GROUP  BY style
  9  /
View created.
scott@ORA92> -- select from view:
scott@ORA92> SELECT * FROM your_view
  2  /
S       2001       2002       2003       2004
a         21         16         26         17

Similar Messages

  • Module Pool for displaying the Grid values in Matrix format

    Hi Experts,
    I have one requirement which as follows,
    In Module pool program i need to display the Grid Values in Matrix format i.e,
    Row = Color
    Column = Size
    Like what we can see in Sales order or Purchase Order if you click Grid Entries Button.
    Can you Please Help me out.
    Thanks n Advance.
    Logu

    Hi
    the sources ate the function groups WMMB and WMMA.
    In a new release you should find the function module MGW_UTILITIES_MATRIX_SHELL_RA
    the report RWRFMATCHARVAL is a good example
    Regards
    Björn

  • Module Pool to Display the Values in Matrix Format

    Hi Experts,
    I have one requirement which as follows,
    In Module pool program i need to display the  Values in Matrix format i.e,
    Row = Color
    Column = Size
    Can you Please Help me out.
    Thanks n Advance.
    Logu

    create your internal table dynamically (with number of columns corresponding to number of sizes)
    this is done easily with class CL_ALV_TABLE_CREATE method CREATE_DYNAMIC_TABLE
    then use the internal table for ALV output

  • To display Days Hours Mins Format based on business hours

    Hi,
    I want to display Days Hours Mins Format.
    I am Having two columns Like below,
    Col1 (in days)    col2 (In Hours : Mins)
    3days  4:5 
    In this first have to  add Col1 and Col2 (Here one day is equals to
    9 hours ) so the addition is 31.5
    from this 31.5 i should display 3 Days 4 Hours 30 Mins because 31.5 contains 3 (9 hours) days 4 Hours and .5 is equals to 30 mins.
    Kindly please help me in this,
    thanks in advance.
    GVRSPK VENI

    Hello gvespk,
    Regarding your description, are you looking for some sample as below?
    DECLARE @T TABLE
    ID VARCHAR(99),
    SubID INT,
    Days INT,
    Hours FLOAT
    INSERT INTO @T VALUES
    ('abz', 1, 2, null)
    ,('abz', 2, null, 3 )
    ,('abz', 3, 3, 4 )
    ,('abz', 4, null, null )
    ,('abz', 5, 2, null )
    ,('abz', 6, 1, 5 )
    ,('abz', 7, null, 2 )
    ,('abz', 8, null, null )
    ,('abz', 9, 2, 3 )
    ,('abz', 10, null, 2.5 );
    SELECT SUM(DAYS)+FLOOR(SUM(HOURS)/9) DAYS
    , FLOOR(SUM(HOURS)-FLOOR(SUM(HOURS)/9)*9) AS HOURS
    , (SUM(HOURS)-FLOOR(SUM(HOURS)))*60 MINUTES FROM @T
    DAYS HOURS MINUTES
    12 1 30
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • Idoc-xi-file scenario.  how to display file in html format

    I am not sure whether this is a valid question.........but want to confirm as it was asked by somebody
    In idoc-xi-file scenario.......  how to display file in html format ??
    Thanks in advance
    Kumar

    Hi Vijayakumar,
    Thanks for your reply !! You mean to say I got to use XSLT mapping and also .htm and .html extension together to produce the html file ?? or it is sufficient to use any one of them to produce the html file ??
    Regards
    Kumar

  • Display data to matrix using LoadFromDataSource

    Hello all,
    I tried to display data to matrix.
    I used matrix object's LoadFromDatasouce.
    But it didn't display data at all.
    Pls help me!!
    creationPackage.ObjectType = "EVOSS_BUSTR"      
    creationPackage.UniqueID = "TEST
    creationPackage.FormType = "TEST"
    creationPackage.BorderStyle =  SAPbouiCOM.BoFormTypes.ft_Fixed
    Set oForm = SBO_Application.Forms.AddEx(creationPackage)
    sTableName = "@EVOSS_BUSTR"   
        oForm.Title = sTitle
        oForm.Height = 300
        oForm.Width = 350
        oForm.DataSources.DBDataSources.Add ("sTableName")
        Set oItem = oForm.Items.Add("1", it_BUTTON)
        oItem.Left = 5
        oItem.Width = 65
        oItem.Top = 240
        oItem.Height = 19
        Set oButton = oItem.Specific
        oButton.Type = bt_Caption
        Set oItem = oForm.Items.Add("2", it_BUTTON)
        oItem.Left = 75
        oItem.Width = 65
        oItem.Top = 240
        oItem.Height = 19
        Set oButton = oItem.Specific
        oButton.Type = bt_Caption
        'Adding a matrix
        Set oItem = oForm.Items.Add("TEST, it_MATRIX)
        oItem.Left = 5
        oItem.Width = 340
        oItem.Top = 10
        oItem.Height = 200
        oItem.AffectsFormMode = True
        Set oMatrix = oItem.Specific
        Set oColumns = oMatrix.Columns
        'Adding col 1
        Set oColumn = oColumns.Add("ColNb", it_EDIT)
        oColumn.TitleObject.Caption = "#"
        oColumn.Width = 20
        oColumn.Editable = False
        'oColumn.DataBind.SetBound True, "", "#"
        'Adding col 2
        Set oColumn = oColumns.Add("EVOSS_Code", it_EDIT)
        oColumn.TitleObject.Caption = "Code"
        oColumn.Width = 80
        oColumn.Editable = True
        oColumn.DataBind.SetBound True, sTableName, "Code"
        'Adding col 3
        Set oColumn = oColumns.Add("EVOSS_Name", it_EDIT)
        oColumn.TitleObject.Caption = "Name"
        oColumn.Width = 220
        oColumn.Editable = True
        oColumn.DataBind.SetBound True, sTableName, "Name"
        oMatrix.AddRow
        Set oColumn = oMatrix.Columns.Item("EVOSS_Code")
        Set eItemCode = oColumn.Cells.Item(1).Specific
    '   oForm.Mode = fm_FIND_MODE
    '   oForm.DataBrowser.BrowseBy = "EVOSS_Code"
        'oMatrix.SelectionMode = ms_None
         oForm.Visible = True
         add_line = True
         oMatrix.LoadFromDataSource

    Hello.
    For load a data to a matrix you need call a Query method of the dbdatasource to obtain data from the database.
    By.

  • Need to display in a table format

    Hi,
    From my database i need to get the values for , UserName and Password and display in a table format .
    I could get the values from the database using
    Statement stmt = con.createStatement();
    ResultSet rs = stmt.executeQuery("select * from Login");
    while(rs.next()){
    out.println(" <br> ");
    out.println(rs.getString("username");
    out.println(rs.getString("password");
    }it works fine and displays like below......
    user1  pwd1
    user2 pwd2
    .....    ...May i know how to get it in a tabular format as an output
    pls provide sample code for it.
    I would be thankful to u guys,
    Thanks & Regards,
    Raghu.

    From my database i need to get the values for ,
    UserName and Password and display in a table format
    .Really, really bad idea.
    There is never any need, in any implementation to display or even keep actual passwords.
    >
    May i know how to get it in a tabular format as an
    outputAs in a GUI? Then that is a GUI question not a JDBC one.
    Something else? Then you need to explain exactly what the destination is and what defines it as 'tabular'.

  • Problem in Displaying image in HTML format for BI Publisher (OTM)

    Hello,
    We are using OTM 6.2 and we are developing the IB reports to the customer.
    I am getting dificulty while displaying the image in HTML format. I used image in JPEG format. When i am running the report, It displayed only in PDF format, but not in HTML and Excel format.
    Please do the needful help in this regards.
    Thanks & Regards,
    Siva Donthi

    Hi Kavipriya,
    i have gone thru all your threads on a similar sort of issue which i am facing now, However i m bit struck as i m newbie.
    Issue:i am insering a static picture from the c drive into the header section of the rtf template and when previewing the rtf template on the BI publisher the jpg image disappears. i have tried adding the url into the format picture -->alt tab.Still no signs of improvement.
    However if just placing the jpg image on header section without using the wrap text it gets displayed.But if i use wrap text on the image ,it disappears.
    could you guide me please in fixing this issue .
    Appreciate your timely response and your co-operation
    Thanks
    Joe

  • Display Sum Total Of Listview Items

    Can anyone help me with displaying Sum Total of Listview Items in a label. I tried this:
    Dim dblTotal as Double = 0
    Dim dblTemp As Double
    For Each lvItem As ListViewItem In lvwTemps.Items
    If Double.TryParse(lvItem.SubItems(2).Text, dblTemp) Then
    dblTotal += dblTemp
    End If
    Next
    Label2.Text = dblTotal
    but it's just giving me 0 in the label 

    Hi
    Seems like you might have a second VB Editor open? In any case, save the Project, close down VB and rerun will probably fix it.
    Regards Les, Livingston, Scotland
    Yes, that worked but it gives me an unreal number .. 
    You'll need to take the unit into consideration and convert all values to the same unit, for example, MB:
    Dim dblTotal As Double = 0
    Dim dblTemp As Double
    For Each lvItem As ListViewItem In lvwTemps.Items
    Dim values() As String = lvItem.SubItems(2).Text.Split(" "c)
    If Double.TryParse(values(0), dblTemp) Then
    If values(1) = "MB" Then
    dblTemp *= 1000000
    ElseIf values(1) = "KB" Then
    dblTemp *= 1000
    End If
    dblTotal += (dblTemp / 1000000)
    End If
    Next
    Label2.Text = dblTotal
    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

  • Display Report output in Matrix format

    Hi
      I want to display normal report output in somewhat this manner.
    I will have one change requrest number and many transport requests will be assigned to that change request number, and to the transport requests many objects will be assigned.
    I have to display the output in this format:
    Change Request 1  |   Tr No.1 |  Tr No.2 |  Tr No.1 | and so on....
    Obj1
    Obj2
    Obj3
    Change Request 1  |   Tr No.1 |  Tr No.2 |  Tr No.1 | and so on....
    Obj1
    Obj2
    Obj3
    Like this it should go on.
    I have done the coding part, how to display the data in the above format i am not getting any idea, please help me out if you have any ideas.
    Thanks & Regards
    Haritha.

    Hi Vijay,
      First of all thank you for the response.
    I am retrieving the data from different tables and putting all the data in one internal table called i_final. Below is the declaration of that internal table and how i have populated the data to that. I am using control break statements to display the data but the data is coming in the next line.
    Please see the final internal table:
    1. Declaration:
    Data:Begin of i_final occurs 0,
           ccsnr like ysts-ccsnr,
           trkorr like ysts-trkorr,
           obj_name like e071-obj_name,
           check_box(1),
           status LIKE YSCS-STATUS,
          End of i_final.
    2. Populating different internal tables data to this table:
      loop at i_ccno.
        i_final-ccsnr = i_ccno-ccsnr.
        i_final-trkorr = i_ccno-trkorr.
        read table i_status with key trkorr = i_ccno-trkorr.
        if sy-subrc = 0.
          i_final-status = i_status-status.
        endif.
        read table i_obj_name with key trkorr = i_ccno-trkorr.
        if sy-subrc = 0.
          i_final-obj_name = i_obj_name-obj_name.
        endif.
        append i_final.
        clear i_final.
      endloop.
    3. Using Control break statements to display the data.
      sort i_final by ccsnr.
      loop at i_final.
         at new ccsnr.
           write:/2 i_final-ccsnr.
         endat.
           write:20 i_final-trkorr.
           uline.
      endloop.
    But the output is coming like this:
    CHG0003785  HSDK933109
                          HSDK933111
                          HSDK933113
                          HSDK933143
                          HSDK933268
    But i want the output like this:
    CHG0003785 | HSDK933109  |  HSDK933111  |   HSDK933113
    Thanks & Regards
    Haritha.

  • Displaying a report in matrix format

    Hi,
      I want to display my report in the below given format, i have tried many ways but i didnt get the correct output. Please help.
    I will one Change Request and some Transport Requests will be assigned to it and some objects which belong to that transport requests will be displayed below.
    Now I have put 'X' mark to the objects which belong to the transport requests. There can be one or more objects for a particular transport request.
    The data should be displayed like this.
      SNO                                TR1                        TR2                       TR3
    Obj1                                    X                                                         X
    Obj2                                    X
    Obj3                                                                  X                           X
    Obj4                                   X                             X                           X
    Obj5                                                                 X
    TR above means Transport Request.
    Objects can be either programs, tables, function modules etc.,
    I have given just an example, the data should be displayed in the above manner, could anyone please help.
    Thanks & Regards
    Haritha.

    Hi
    U should have an internal table like this:
    .DATA: BEGIN OF ITAB OCCURS 0,
            OBJECT_NAME TYPE TADIR-OBJ_NAME,
            TR1 TYPE FLAG,
            TR2 TYPE FLAG,
            TR3 TYPE FLAG,
            TR4 TYPE FLAG,
            TR5 TYPE FLAG,
            TRN TYPE FLAG,
          END   OF ITAB.
    The first field is the abap object name, the others are the flag for the requets: the header of every TR* field will be the number of the request.
    Now the problem is to understand how many transport u want to need to manage in your report: because if you need to manage N requests, your internal table ITAB will be a "statical" internal table with N fields type TR, else u need to use the dynamic internal table.
    Max
    Edited by: max bianchi on Nov 17, 2008 4:42 PM
    Edited by: max bianchi on Nov 17, 2008 4:55 PM

  • Displaying Months in Matrix Report like Jan-01  Feb-01

    How can I display Months like Jan-01 Feb-01 in Matrix Report of Oracle Report 6i.
    I tried using to_char(myDate,'Mon-YY') but it displayed months in Alphabetical Order like Apr-01 Aug-01 and so on.
    I need something like this.
    Item Jan-01 Feb-01 Mar-01 Apr-01
    Item-A 100 200 300 400
    Item-B 100 200 300 400
    Best Regards,
    Luqman

    Dear Dan,
    Thanks for your suggestion.
    My problem is to display Oracle Data (Hiredate Field of Oracle Scott.Emp Table) in Matrix Report of Oracle Report Version R6i in the format of :
    Dec-80,Feb-81 etc. as under:-
    EmpNo Dec-80 Feb-81 Apr-81 May-81
    7369 800
    7499 1600
    7521 1250
    7566 2975
    7698 2850
    The query I tried in Sql Statement Window of Oracle Report R6i is as under:-
    select empno,sal,to_char(hiredate,'Mon-YY') from emp
    order by to_char(hiredate,'YY-MM')
    The above query shows correct exactly what I need, when run in Oracle Sql Plus but in Matrix Report, it seems its Order By clause not working.
    Your suggesion is related to change the format of today's date and not with Oracle Data, I presume.
    I will appreciate if you please let me know directly at my E-Mail: [email protected] if you find any solution for my above problem.
    Best Regards,
    Luqman

  • Is there a How To on column sum totals, break formatting, 4 tabular reports

    Hi,
    I haven't needed to do a grand totals for a column until now. I see that there is built in BREAK FORMATTING. I looked for a how to on it but found none.
    Anyone have a good reference to explain basics? customizations?
    Thanks, Bill

    Hi there,
    If your column alignment is right the Sum will be right too in bold.
    Break Formatting/Display this text when printing report sums
    You can do [h4]Total of Something[h4] or use Style, for instance.
    Same with “Display this text on report breaks using #SUM_COLUMN_HEADER# substitutions”. [h4] #SUM_COLUMN_HEADER# [h4] for instance.
    I hope this would help.
    Konstantin

  • How to display numbers in triangle format

    Hi All,
    How do I display numbers in the following format;
    1
    1 2
    1 2 3
    1 2 3 4
    Your help will be more appreciated.
    Thank you.

    I couldn't resist:
    SQL> var N number
    SQL> exec :n := 10;
    PL/SQL procedure successfully completed.
    SQL> -- plane
    SQL> select * from (
      2  select lpad(' '||(case when level between :N/2 - (:N * 0.1) and :N/2 + (:N * 0.1)
      3                 then lpad('*',:N*2.5 - level - abs(:N/2-level),'*')
      4      end) --"left wing"
      5      ,50-level, ' ')
      6    || ltrim(sys_connect_by_path(level,' '))
      7    || (case when level between :N/2 - (:N * 0.1) and :N/2 + (:N * 0.1)
      8              then rpad('*',:N*2.5 - level - abs(:N/2-level),'*')
      9      end) -- "right wing"
    10    n
    11  from dual 
    12  connect by level <= :N
    13  order by level);
                                                     1
                                                    1 2
                                                   1 2 3
                              ********************1 2 3 4********************
                             ********************1 2 3 4 5********************
                              ******************1 2 3 4 5 6******************
                                               1 2 3 4 5 6 7
                                              1 2 3 4 5 6 7 8
                                             1 2 3 4 5 6 7 8 9
                                            1 2 3 4 5 6 7 8 9 10
    10 rows selected.
    SQL> exec :n := 6;
    PL/SQL procedure successfully completed.
    SQL> r
      1  select * from (
      2  select lpad(' '||(case when level between :N/2 - (:N * 0.1) and :N/2 + (:N * 0.1)
      3                 then lpad('*',:N*2.5 - level - abs(:N/2-level),'*')
      4      end) --"left wing"
      5      ,50-level, ' ')
      6    || ltrim(sys_connect_by_path(level,' '))
      7    || (case when level between :N/2 - (:N * 0.1) and :N/2 + (:N * 0.1)
      8              then rpad('*',:N*2.5 - level - abs(:N/2-level),'*')
      9      end) -- "right wing"
    10    n
    11  from dual
    12  connect by level <= :N
    13* order by level)
                                                     1
                                                    1 2
                                       ************1 2 3************
                                                  1 2 3 4
                                                 1 2 3 4 5
                                                1 2 3 4 5 6
    6 rows selected.
    SQL>

  • Date not being displayed in the custom format

    Hi ,
      I have a problem wherein i am unable to change the format of the date.
    I need the date to be in the format 'January 10,2010.' however the date is being displayed as '1/10/10'. I have tried all options for the date formatting. I specified the custom format as 'MMMM D,YYYY' as mentioned in the SAP Library. I am trying to use the std custom options like YYYY-MM-DD, the date is not being dispalyed in the custom format provided by SAP either.
    I have binded date from the context, used the Current Date field provided by SAP.  Nothing works.
    Its not working on the new form. However the old forms have the same kind of formatting and are being displayed as desired.
    Please suggest as to what the issue could be.
    Thanks,
    Soumya.

    Hi All,
    Even I'm encountering the same issue. I'm trying to control the outputted date format programmatically.Please have a look.
    data: v_int_date like sy-datum,
            v_ext_date(10).
    v_int_date = '20110201'
    write v_int_date to v_ext_date MM/DD/YYYY.
    Here I've tried to convert the date to external format using a fixed format(MM/DD/YYYY). But still it's getting outputted in the format DD/MM/YYYY only as that's the way its defined in the User Master!
    Is there any solution for this? How can I 'override' defaults in the SAP User Master?
    Thanks,
    Mahesh

Maybe you are looking for

  • DVD burn issue

    I have Premiere Elements 13 and up till now have had no problem burning DVDs. Now it says the DVD burn is interrupted and advises me to use the ISO image instead.

  • Remote user received a "deny log on locally" policy - and is now locked out

    Hello, A traveling user who received a "deny log on locally" policy remotely. He was accidentally added to a wrong group and is now locked out.  What are the steps to clear this policy?  We have a backup local admin account I can remote into. I appre

  • Yosemite 10.10.3 How do I transfer "photos" into Adobe Photoshop Elements?

    With the new Yosemite update (10.10.3) I can no longer transfer my photographs into Adobe Photoshop Elements by the previously expedient  'click and drag' method. Neither am I able to import or export them. Does anyone have a suggestion as to how to

  • ITunes shuts down when iPhone is connected.

    I can open my iTunes and listen to music, browse the store, everything. As soon as I connect my iPhone I get a message saying iTunes has stopped working and the program closes. There is some DEP warning coming up from Windows (vista 64bit), I can not

  • I have 2 accounts that need to be merged!

    So when i first started shopping at Best Buy, I decided to make my first My Best Buy Rewards account. Once I started working at Best Buy, I forgot that I had the previous accounts. Also for some reason, due to my accidental mistake when first hired,