Changeing the rows into columns..

Hello Experts,
I have a one requirement which is display rows as columns
for Example:
material
plant
quantity
amount
1000
100
30
60
200
50
100
300
60
120
2000
200
50
100
300
60
120
400
32
64
3000
100
40
80
400
20
40
I need output like this below..
material
100
200
300
400
1000
30
50
60
90
100
120
2000
50
60
32
100
120
64
3000
40
20
80
40
I created the ALV table dynamically using at end of event..
but I am getting the
material
100
200
300
400
1000
30
50
60
90
100
120
2000
60
32
120
64
3000
20
40
the values are missing ..?
I wrote like this:
LOOP AT lt_final INTO ls_final.
    ASSIGN COMPONENT 'matnr' OF STRUCTURE <dyn_wa> TO <fs1>.
     <fs1> = ls_final-matnr.
     ASSIGN COMPONENT ls_final-vkorg OF STRUCTURE <dyn_wa> TO <fs1>.
     <fs1> = ls_final-qunaty.
     ASSIGN COMPONENT ls_final-vkorg OF STRUCTURE <dyn_wa> TO <fs1>.
     <fs1> = ls_final-amount.
     AT END OF matnr.
       APPEND <dyn_wa> TO <dyn_table>.
       CLEAR : <dyn_wa>.
     ENDAT.
   ENDLOOP.

I have written a snippet whose output is:
Take a look at the snippet.
TYPES:
BEGIN OF ty,
  a1 TYPE char10,
  a2 TYPE char10,
  a3 TYPE char10,
  a4 TYPE char10,
END OF ty,
BEGIN OF ty2,
  a1  TYPE char10,
  100 TYPE char10,
  200 TYPE char10,
  300 TYPE char10,
  400 TYPE char10,
  no  TYPE char10,
END OF ty2.
DATA: lt TYPE TABLE OF ty,
      ls TYPE ty,
      lt2 TYPE TABLE OF ty2,
      ls2 TYPE ty2,
      lr TYPE REF TO cl_salv_table.
FIELD-SYMBOLS: <lv>   TYPE char10,
               <ls2>  TYPE ty2.
*material   plant   quantity  amount
ls-a1 = 1000.
ls-a2 = 100. ls-a3 = 30. ls-a4 = 60.  APPEND ls TO lt.
ls-a2 = 200. ls-a3 = 50. ls-a4 = 100. APPEND ls TO lt.
ls-a2 = 300. ls-a3 = 60. ls-a4 = 120. APPEND ls TO lt.
ls-a1 = 2000.
ls-a2 = 200. ls-a3 = 50. ls-a4 = 100. APPEND ls TO lt.
ls-a2 = 300. ls-a3 = 60. ls-a4 = 120. APPEND ls TO lt.
ls-a2 = 400. ls-a3 = 32. ls-a4 = 64.  APPEND ls TO lt.
ls-a1 = 3000.
ls-a2 = 100. ls-a3 = 40. ls-a4 = 80.  APPEND ls TO lt.
ls-a2 = 400. ls-a3 = 20. ls-a4 = 40.  APPEND ls TO lt.
TRY.
    LOOP AT lt INTO ls.
*     index 1 for filling quantity in a3 field
      READ TABLE lt2 ASSIGNING <ls2>
          WITH KEY  a1 = ls-a1
                    no = 1.
      IF sy-subrc NE 0.
        APPEND INITIAL LINE TO lt2 ASSIGNING <ls2>.
        <ls2>-a1 = ls-a1. <ls2>-no = 1.
      ENDIF.
      ASSIGN COMPONENT ls-a2 OF STRUCTURE <ls2> TO <lv>.
      <lv> = ls-a3.
*     index 2 for filling quantity in a4 field
      READ TABLE lt2 ASSIGNING <ls2>
          WITH KEY  a1 = ls-a1
                    no = 2.
      IF sy-subrc NE 0.
        APPEND INITIAL LINE TO lt2 ASSIGNING <ls2>.
        <ls2>-a1 = ls-a1. <ls2>-no = 2.
      ENDIF.
      ASSIGN COMPONENT ls-a2 OF STRUCTURE <ls2> TO <lv>.
      <lv> = ls-a4.
    ENDLOOP.
    cl_salv_table=>factory(
      IMPORTING
        r_salv_table   = lr
      CHANGING
        t_table        = lt2
    lr->display( ).
  CATCH cx_root.
ENDTRY.

Similar Messages

  • How can I display the rows into columns.

    How can I display the rows into columns. I mean
    Create table STYLE_M
    (Master varchar2(10), child varchar2(10));
    Insert itno style_m
    ('MASTER1','CHILD1');
    Insert itno style_m
    ('MASTER2','CHILD1');
    Insert itno style_m
    ('MASTER2','CHILD2');
    Insert itno style_m
    ('MASTER3','CHILD1');
    Insert itno style_m
    ('MASTER3','CHILD2');
    Insert itno style_m
    ('MASTER3','CHILD3');
    Note : The Master may have any number of childs.
    I want to display like this..
    Master child1, child2, child3, .......(dynamic)
    MASTER1 CHILD1
    MASTER2 CHILD1 CHILD2
    MASTER3 CHILD1 CHILD2 CHILD3
    Sorry for disturbing you. Please hlp me out if you have any slution.
    Thanks alot.
    Ram Dontineni

    Here's a straight SQL "non-dynamic" approach.
    This would be used if you knew the amount of children.
    SELECT
         master,
         MAX(DECODE(r, 1, child, NULL)) || ' ' || MAX(DECODE(r, 2, child, NULL)) || ' ' || MAX(DECODE(r, 3, child, NULL)) children
    FROM
         SELECT
              master,
              child,
              ROW_NUMBER() OVER(PARTITION BY master ORDER BY child) r
         FROM
              style_m
    GROUP BY
         master
    MASTER     CHILDREN                        
    MASTER1    CHILD1                          
    MASTER2    CHILD1 CHILD2                   
    MASTER3    CHILD1 CHILD2 CHILD3             Since you said that the number of children can vary, I incorporated the same logic into a dynamic query.
    SET AUTOPRINT ON
    VAR x REFCURSOR
    DECLARE
            v_sql           VARCHAR2(1000) := 'SELECT master, ';
            v_group_by      VARCHAR2(200)  := 'FROM (SELECT master, child,  ROW_NUMBER() OVER(PARTITION BY master ORDER BY child) r FROM style_m) GROUP BY master';
            v_count         PLS_INTEGER;
    BEGIN
            SELECT
                    MAX(COUNT(*))
            INTO    v_count
            FROM
                    style_m
            GROUP BY
                    master;
            FOR i IN 1..v_count
            LOOP
                    v_sql := v_sql || 'MAX(DECODE(r, ' || i || ', child, NULL))' || ' || '' '' || ';
            END LOOP;
                    v_sql := RTRIM(v_sql, ' || '' '' ||') ||' children ' || v_group_by;
                    OPEN :x FOR v_sql;
    END;
    PL/SQL procedure successfully completed.
    MASTER     CHILDREN
    MASTER1    CHILD1
    MASTER2    CHILD1 CHILD2
    MASTER3    CHILD1 CHILD2 CHILD3I'll point your other thread to this one.

  • Changing rows into columns

    Hi,
    I am trying to change rows into columns, and I have come up with a package that should do this. However, it doesn't work properly, so am wondering if someone can help me out finding out what is wrong.
    I am using the emp table owned by Scott in an Oracle database, and I want my output to look like this:
    SAL 10 20 30
    800 SMITH
    950 JAMES
    1100 ADAMS
    1250 WARD
    1250 MARTIN
    1300 MILLER
    1500 TURNER
    1600 ALLEN
    2000
    2000 beth
    2000 Anne
    SAL 10 20 30
    2450 CLARK
    2850 BLAKE
    2975 JONES
    3000 SCOTT
    3000 FORD
    5000 KING
    I want the deptno to be the header of the column, except from the first column where I want the salary, and then I want all the employees with the specific salary in the specific department number in the row of the right salary and deptno. I saw on the preview screen that you guys will not see the result like I actually have pasted it in here, but I think you will understand what I want. Out of my result I want to read all the employees in deptno 10,20,30,..... and what the salary is.
    So far I have come up with this:
    create or replace package pivot
    as
    type rc is ref cursor;
    procedure data(p_cursor in out rc );
    end;
    create or replace package body pivot
    as
    procedure data(p_cursor in out rc )
    is
    l_stmt long;
    begin
    l_stmt := 'select sal';
    for x in ( select distinct deptno from emp order by 1 )
    loop
    l_stmt := l_stmt ||
    ', max(decode(deptno,' || x.deptno ||', ename)) "x.deptno"';
    end loop;
    l_stmt := l_stmt || ' from emp group by sal order by sal';
    open p_cursor for l_stmt;
    end;
    end;
    variable x refcursor
    set autoprint on
    exec pivot.data( :x );
    The package gets created without any errors, but when I execute it, it returns the following error:
    SQL> exec pivot.data( :x );
    BEGIN pivot.data( :x ); END;
    ERROR at line 1:
    ORA-00936: missing expression
    ORA-06512: at "SCOTT.PIVOT", line 14
    ORA-06512: at line 1
    And I can't see what is wrong with it. Can anyone help?
    Thank you.
    Regards,
    Anne

    Just like this...and a dbms_output after the open cursor to show you the query begin formed.
    create or replace package body pivot
    as
    procedure data(p_cursor in out rc )
    is
    l_stmt long;
    begin
    l_stmt := 'select sal';
    for x in ( select distinct deptno from emp order by 1 )
    loop
    l_stmt := l_stmt ||
    ', max(decode(deptno,''' || x.deptno ||''', ename)) "'||x.deptno||'"';
    end loop;
    l_stmt := l_stmt || ' from emp group by sal order by sal';
    open p_cursor for l_stmt;
    dbms_output.put_line(l_stmt);
    end;
    end;
    Package body created.SQL> set serveroutput on
    SQL> exec pivot.data(:x);
    select sal, max(decode(deptno,'10', ename)) "10", max(decode(deptno,'20',
    ename)) "20", max(decode(deptno,'30', ename)) "30" from emp group by sal order
    by sal
    PL/SQL procedure successfully completed.
    SAL 10 20 30
    800 SMITH
    950 JAMES
    1100 ADAMS
    1250 WARD
    1300 MILLER
    1500 TURNER
    1600 ALLEN
    2450 CLARK
    2850 BLAKE
    2975 JONES
    3000 SCOTT
    SAL 10 20 30
    5000 KING
    12 rows selected.
    SQL>
    Think that solves the single quote problem. :)

  • Is it possible to switch the rows and columns?

    Is it possible to switch the rows and columns of a table? The reason I ask is that it would be easier for me to input the data with the number at the top of a column and the fields going down. But it would be easier to read the data with the number on the left and the fields going to the right. Is it possible to switch a table in this way?

    mahongue wrote:
    Is it possible to switch the rows and columns of a table? The reason I ask is
    that it would be easier for me to input the data with the number at the top
    of a column and the fields going down. But it would be easier to read the
    data with the number on the left and the fields going to the right. Is it
    possible to switch a table in this way?
    It sounds to me as though you wish to transpose a table so that the original is changed from rows to columns and from columns to rows, as in the following:
    Table 1
        A   B   C
    ========
    1   o   p   q
    2   r   s   t
    3   u   v   w
    Table 2
        A   B   C
    ========
    1   o   r   u
    2   p   s   v
    3   q   t   w
    You are right - it would be nice to have a menu item to magically transpose a selected block of cells. But there isn't one. So...
    One way to solve this is to use the index() and transpose() functions to accomplish row and column cell transposition. If you are going to use a 1:1 cell correspondence and change the header columns and rows also, you can use this:
       =INDEX(TRANSPOSE(Table # :: <range>),ROW(),COLUMN())
    where Table # and <range> is substituted as in the following fashion:
       =INDEX(TRANSPOSE(Table 1 :: $A$1:$C$3),ROW(),COLUMN())
    Create a second table. Copy the modified formula above with the appropriate substitutions, select the range you wish to have your transposition inserted into (must match the transposed cell dimensions of the original range), paste the forumula and voila! the cells will be transposed.
    Cautions:
    o The target table must match the swapped cell length and width dimension. For example, if the original data range is 6 columns wide by 4 rows deep, then the corresponding table or range to hold the transposition must be 4 columns wide by 6 rows deep.
    o If your transposed data block is to be offset from the origin of the new table, then you will need to include a subtractive offset into your cell formula, since in the transpose() function the data in the master data range is referenced from its position with the master range, not its cell position in the table. Such an offset is necessary because this example formula uses the target row and column numbers to arrive at indexed positions.
    For example, if the new data range is to be offset one column to the right and one row below from the target table's origin then you must subtract (-1) from the cell and from the column references in the formula:
      Example:
      =INDEX(TRANSPOSE(Table 3 :: $B$2:$D$4),ROW()-1,COLUMN()-1)
    If someone has a better solution I'd be glad to hear of it.

  • JBO-25014: Another user has changed the row with primary key oracle.jbo.Key

    Hi,
    I am developing a Fusion Web Application using Jdeveloper 11.1.2.1.0. I have a home.jspx page that has a ADF table built on efttBilling View Object. . When you click on one of the rows in the table, it will take you to detail.jspx where you can edit the row and save. When 'save' is clicked, stored procedures are executed to update/insert rows into few tables , and then go back to home.jspx where you need to see updated content for that row.
    To get down to the exact issue, updates are made to the tables on which the efttBilling View Object is built using a stored procedure. Once this is done, I am trying to requery view object to see new content. But I keep getting JBO-25014: Another user has changed the row with primary key oracle.jbo.Key error. Following are the approaches I followed to query new results:
    a. Executed Application Modules Commit Method. Created 'Commit' Action binding and tied it to homePageDef.xml. Called this binding from a view scope bean.
        BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
         OperationBinding operationBinding = bindings.getOperationBinding("Commit");
        Object result = operationBinding.execute();
       if (!operationBinding.getErrors().isEmpty())
        return null;
    b. Marked 'Refresh on Insert' , 'Refresh on Update', 'Change Indicator' checkboxes for all the attributes in the entities associated with efttBilling View Object.
    c. Tried to Requery View Object. Created a refreshViewObject method in Application Module Impl.java file, exposed this method to the client interface and created a invokeMethod Action binding in home.jspx
    Code in Application Module:
      public void refresheftTransactionsforBillingAccountViewObj1View()
        System.out.println("In eftTransactionsforBillingAccountViewObj1");
      findViewObject("eftTransactionsforBillingAccountViewObj1").executeQuery();
    Code in view scope bean
            DCBindingContainer bindings =
           (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
            OperationBinding operation =
            bindings.getOperationBinding("refresheftTransactionsforBillingAccountViewObj1View");
            operation.execute();
    I have searched web, ADF forums and tried methods suggested in there but no sucess.
    Could anyone please provide some insight in this issue. I have been battling with this since quite some time. I can provide you with the log file too.
    Thanks!
    Shai.

    What code does your Commit method have .. can you try using the Commit executable from the AM itself instead ?
    Also -
    Shai wrote:
    'Change Indicator' checkboxes for all the attributes in the entities associated with efttBilling View Object.
    which all attributes you set this property for . it should just be for History columns as such.
    Did you also check if this could be your scenario ?
    Decompiling ADF Binaries: Yet another reason for &quot;JBO-25014: Another user has changed the row with primary key orac…
    OR
    JBO-25014: Another user has changed the row with primary key oracle.jbo.Key
    OR
    Another user has changed the row with primary key -Table changed externally
    Message was edited by: SudiptoDesmukh

  • Adobe form - change particular row into bold

    Hi all,
    I have a requirement in adobe form, which i need to change the font into bold for the particular row in a table. For example i am displaying table which has two columns if the first columns values starts with 'A' then that particular row should be bold .Could you please help me to achieve this .
    Thanks in Advance.
    Col1           Co12
    eeee           123333
    www          545454545
    AAA           44545454
    eee              5454
    ADS            4545        
    sdd               fdfd
    Regards,
    satish

    check here: Re: Dynamic change of font in table
    Otto

  • How can i open a PDF bank statement in numbers so that the rows and columns contain properly aligned data from statement?

    how can i open a PDF bank statement in "numbers" so that the rows and columns contain properly aligned data from statement?

    Numbers can store pdfs pages or clippings but does not directly open pdf files.  To get the bank statement into Numbers as a table I would open the bank statment in Preview (or Skim) or some pdf viewer.
    Then hold the option key while selecting a column of data.
    Then copy
    Then switch to numbers and paste the column into a table
    Then repeat for the other columns in the pdf document
    It would be easier (in my opinion) to download the QFX or CSV version from your bank

  • How can I change the type of column in matrix

    I want to change the type of column in matrix to it_LINKED_BUTTON, so it can show the orange arrow
    I added the column throw marketing documents (rows)
    It's seems the default column type  is it_Edit
    is there a way of changing the column type
    i tried the below code, but it did not work because the type property in a matrix column is readonly
    mtx.Columns.Item(0).Type = SAPbouiCOM.BoFormItemTypes.it_LINKED_BUTTON
    sincerely yours
    Riade Asleh

    i don't want to add a new column
    i want to change the column type of existing column in matrix, becuase it's bind to a field
    beside that, i can not add column , if the matrix has rows in it
    sincerely yours
    Riade Asleh

  • How to change the "name of column" property of an text item in runtime?

    How to change the "name of column" property of an text item in runtime?
    I look the properties of items in help and found nothing about this!
    It's possible?

    Hi,
    an other solution is change the block property QUERY_DATA_SOURCE_TYPE from "Table" to "Sub-query" , than change at run time the property QUERY_DATA_SOURCE_NAME.
    First create block and add items
    The QUERY_DATA_SOURCE_NAME will be for ex. "Select 'A' as col1, 'B' AS col2, 'C' as col3 from dual"
    Set into items the column name property to col1 , col2 ...
    At run time change the query to "Select 'Z' as col1, 'X' as col2 , 'Y' as col3 from dual"
    in this way you can change the source of column value.
    Caution because if you change value type from varchar2 to date you must cast date into varchar2.
    May be that this way is valid only for view data not for insert-update, i don't remember.
    bye
    Message was edited by:
    Killernero

  • Display rows into columns in table

    Hi,
    I have a table name Ebiz_Upgrade_Task_Status. Here in table there are 8 rows of data with
    pro_id,pobj_id,cemli_id and confirmation.
    I am trying to convert all the CONFIRMATION into column wise using the query below
    SELECT
    PRO_ID,
    POBJ_ID,
    CEMLI_ID,
    max(decode(rownum,1,CONFIRMATION,null)) "CP1",
    max(decode(rownum,2,CONFIRMATION,null)) "CP2",
    max(decode(rownum,3,CONFIRMATION,null)) "CP3",
    max(decode(rownum,4,CONFIRMATION,null)) "CP4"
    FROM Ebiz_Upgrade_Task_Status
    GROUP BY PRO_ID,POBJ_ID,CEMLI_ID
    Am able to see first 2 rows of data as columns, and not able to see the next rows. Please suggest me in modifyin the query
    tabel strutuce and data
    pro_id obj_id cemli_id confirmation
    1 2 3 Yes
    1 2 3 No
    1 2 3 NA
    11 22 33 Yes
    11 22 33 NO
    11 22 33 NA
    Please suggest me in modifying the code
    Thanks
    Sudhir

    Thanks for posting more details.
    Using rownum caused your confirmation fields to be null:
    SQL> select * from temp1;
       PRO_ID   POBJ_ID  CEMLI_ID CONFIRMATION
          111       222       333 yes
          111       222       333 no
          111       222       333 na
           11        22        33 na
           11        22        33 no
           11        22        33 yes
    6 rows selected.
    SQL> col cp1 format a10
    SQL> col cp2 format a10
    SQL> col cp3 format a10
    SQL> select pro_id
      2  ,      pobj_id
      3  ,      cemli_id
      4  ,      max(decode(rownum,1,confirmation,null)) "cp1"
      5  ,      max(decode(rownum,2,confirmation,null)) "cp2"
      6  ,      max(decode(rownum,3,confirmation,null)) "cp3"
      7  from   temp1
      8  group by pro_id
      9  ,        pobj_id
    10  ,        cemli_id;
       PRO_ID   POBJ_ID  CEMLI_ID cp1        cp2        cp3
           11        22        33
          111       222       333 yes        no         na
    SQL> select pro_id
      2  ,      pobj_id
      3  ,      cemli_id
      4  ,      max(decode(confirmation, 'yes',confirmation,null)) "cp1"
      5  ,      max(decode(confirmation, 'no',confirmation,null)) "cp2"
      6  ,      max(decode(confirmation, 'na',confirmation,null)) "cp3"
      7  from   temp1
      8  group by pro_id
      9  ,        pobj_id
    10  ,        cemli_id;
       PRO_ID   POBJ_ID  CEMLI_ID cp1        cp2        cp3
           11        22        33 yes        no         na
          111       222       333 yes        no         na
    SQL>

  • Converting Rows into Column in Oracle 10g

    Hi All,                    
    I m using Oracle Version 10.1.0.2.0 - Production                    
    I have requirement to convert rows into column wise as per the following:                    
    My Query is:                    
    WITH t                    
    AS ( SELECT 'A' AS x, 100 AS y FROM DUAL                     
    UNION ALL                    
    SELECT 'B',200 FROM DUAL                    
    SELECT X, Y                    
    FROM t;     
    X Y
    A 100
    B 200
    My Requirement is
    A B
    100 200
    So any one could help me that how I resolve this.
    Regards,
    Prasanta

    Dear frank,
    Thanks for your support,.
    It's working fine for static cases.If the first column is dynamic then how come i will resolve it.
    Example:
    Create table mytab (ID_C Varchar2(15),Value_N Number);
    Records Population into MyTab table is dynamic.
    Insert into mytab values('HO',5000);
    Insert Into mytab values('PG1',2400);
    Insert Into mytab values('PG2',3000);
    Insert Into mytab values('PG3',800);
    Commit;
    SQL> Select * From MyTab;
    IDC_ ValueN_
    HO 5000
    PG1 2400
    PG2 3000
    PG3 800
    Then My expected result will be as follows
    HO PG1 PG2 PG3
    5000 2400 3000 800
    Thanks and Regards,
    Prasanta

  • How to convert row into column

    Hi All,
    My oracle apps version is r12 and db is 10 and i am using Bi publisher version 10g.
    Is it possible to convert row into column in Rtf template,
    My Query is
    SELECT distinct pvs.vendor_site_code,sum(aia.invoice_amount)
    FROM ap_invoices_all aia, po_vendors po, po_vendor_sites_all pvs
    WHERE aia.org_id = pvs.org_id
    AND aia.vendor_id = po.vendor_id
    AND aia.vendor_site_id = pvs.vendor_site_id
    AND aia.org_id=204
    group by pvs.vendor_site_code
    And output is like this
    Vendor sitecode Invoiceamt
    EAM-ERS 79240
    STAR GATE - PAY 3245902.31
    UPS - HQ 10792040.9
    Like this
    So in template i need the output like this
    Vendor sitecode EAM-ERS STAR GATE - PAY UPS - HQ
    Invoiceamt 79240 3245902.31 10792040.9
    I tried to achieve the output using sql query but by hardcoding only i have achieved it, so i have tried to convert directly in RTF template.
    can any one tell me is it possible.
    And if new project is added from the front end ie(now the query will produce 4 rows but now in template i have created only three columns)
    Is it possible to add a new column dynamically.
    Can any one please guide me and tell me is there any example.
    Thanks & regards
    Srikkanth

    Take a look at this post: http://blogs.oracle.com/roller-ui/bsc/spider.jsp?entry=MT%3aENTRY%3a5001
    Thanks,
    Bipuser

  • Summing the Rows and Columns in an Array

    I am importing a 2-dimensional array of integers.(which is held in a 2-dimensional array)
    I need to store the row sums and column sums in separate 1-dimensional arrays.
    I can get the integers in and print out a list along with the grand total(sum of all).
    But, how do I pass each row's and each column's value in to my sumRow and sumCol methods to get the sum for each row and each column?
    Can I do the row and column summing in the same "for" statement where I calculate the "grand total"? Or am I making this more difficult than it is?
    Would appreciate any help.
    This is what I have so far:
    import java.awt.Graphics;
    import java.applet.Applet;
    public class TwoWayTable extends Applet {
         int numRows;
         int numCols;
         int [] [] cell;
         int [] rowSum;
         int [] colSum;
         int grandTotal;
    public TwoWayTable(int [][] data){
    grandTotal = 0;
    cell = new int [data.length][data.length];
    for(int i = 0; i < data.length; i++)
    for(int j = 0; j < data.length; j++){
         cell[i][j] = data[i][j];
    grandTotal += cell[i][j];
         System.out.println(cell[i][j]);
    System.out.println(grandTotal);
    public int sumRow(int [] data2){
         int rowaccumulator=0;
         rowSum = new int[data2.length];
         for(int numRows = 0; numRows < rowSum.length; numRows++){
         rowaccumulator += rowaccumulator + rowSum[numRows];
              return(rowaccumulator);
    public int sumCol(int [] data3){
         int colaccumulator = 0;
         colSum = new int[data3.length];
         for(int numCols = 0; numCols < colSum.length; numCols++){
              colaccumulator += colaccumulator + colSum[numCols];
              return(colaccumulator);

    Thanks for your input.
    I'll make the changes that you suggest.(after this)
    My output prints:
    4 6 3 8 21
    9 1 5 3 18
    13 7 8 11 39
    numbers are right, but I need to format the table
    the output needs to look like this:
    int int int int | rowsum
    int int int int | rowsum
    colsum colsum colsum colsum | total
    How do I do this?
    I have no idea?
    I'm supposed to call a "void setMargins( )" method to line this up, without
    using the exotic formatting in the IO library.
    I'm also supposed to use "public String toString( )"
    This is what I have so far:
    import java.awt.Graphics;
    import java.applet.Applet;
    public class TwoWayTable extends Applet {
    int numRows;
         int numCols;
         int [] [] cell;
         int [] rowSum;
         int [] colSum;
         int grandTotal;
    public TwoWayTable(int [][] data){
    cell = new int [data.length][data.length];     
    for(int i = 0; i < data.length; i++){
    for(int j = 0; j < data.length; j++){
         cell[i][j] = data[i][j];
    calcTotals(cell);
    for(int i = 0; i < cell.length; ++i){
    for(int j = 0; j < cell.length; ++j){
    System.out.print(cell[i][j] + " ");
    System.out.println(rowSum[i] + " ");
    for(int j = 0; j < cell.length-1; ++j){
    System.out.print(colSum[j] + " ");
    System.out.println(colSum[cell.length-1] + " " + (grandTotal));
         public void calcTotals(int [][] data2){
              grandTotal = 0;
              rowSum = new int[data2.length];                         
              colSum = new int[data2.length];                         
              for(int numRows = 0; numRows < data2.length; numRows++){
              for(int numCols = 0; numCols < data2.length; numCols++){
                   grandTotal += data2[numRows][numCols];               
                   rowSum[numRows] += data2[numRows][numCols];
                   colSum[numCols] += data2[numRows][numCols];

  • Another user has changed the row with primary key -Table changed externally

    Hello,
    I am facing the error: "Another user has changed the row with primary key oracle.jbo.Key[94 ]." during the delete operation.
    User case scenario:
    1. Added new row in the table.
    2. Once new row is added to the the table, another application will update few columns in the newly added row based on some logic.
    3. On the same session I am trying to delete the newly added row and getting above mentioned error.
    I have added a "Button" in the table to partialRefresh the table to check the new values of the changed columns.
    I have checked the forum and found many similar errors and tried the following but nothing helped.
    1. By setting "Auto Refresh = True" for the view object.
    Issue faced-> It worked fine but after few add and remove my db is getting to inconsistent state after which, I am not able to do any add/delete from my page.
    Error: "Too many objects match the primary key oracle.jbo.Key". I have checked this and I am not getting this error when "Auto Refresh = False" even after multiple add and remove actions.
    2. By Setting "Auto Refresh" the iterator associated with the page.
    Issue -> Did not work at all.
    Looking forward inputs from gurus.
    Thanks
    Abhijeet

    Finally I found one solution to this problem at: [ http://www.avromroyfaderman.com/2008/05/bring-back-the-hobgoblin-dealing-with-rowinconsistentexception/|http://www.avromroyfaderman.com/2008/05/bring-back-the-hobgoblin-dealing-with-rowinconsistentexception/]
    Simply overriding the lock() method in the entity object resolved issue. Kudos to the author.
    Code:
    public void lock() {
    try {
    super.lock();
    } catch (RowInconsistentException e) {
    refresh(REFRESH_WITH_DB_ONLY_IF_UNCHANGED | REFRESH_CONTAINEES);
    super.lock();
    But, Now my refresh button is not working as depend on the "Auto Refresh = True" to update the table.
    Can anyone tell me how can I refresh the VO of my table from the button.
    Thanks
    Abhijeet.
    P.S: I have already added the partial trigger but it is work not working as the data is cached in the VO. Removing the Cached property for the VO is creating other problems.

  • How to convert rows into columns with decode function

    Hi,
    How to convert rows into columns with the help of decode function in oracle.
    thanks and regards
    P Prakash

    say
    col1 col2
    1 10
    2 20
    3 30
    then use
    select col1,
    sum(decode(col2,10,10)) "new1"
    sum(decode(col2,20,20))"new2"
    sum(decode(col2,30,30))"new3"
    from table_name
    group by col1;
    we used sum u can use ny function if wont u have to give the column name i.e col2 name also
    so i think u got it nw
    regards

Maybe you are looking for

  • Sample Applescript: scraping values from numbers files into a master file

    Hi, I have programming experience in c and other languages, but am new to applescript and so am learning a lot from this forum. My goal is to make a timesheet system for my Dad (for a bday present) where every time he helps a client, he fills out a n

  • Move objects from one tablespace to another

    Hello Running Oracle 10g rel 2 and I would like to move all objects from one tablespace to another. There are Primary Key indexes to other tables in this tablespace. The size grew too large and I want to reduce the size. Thank you.

  • Color dithering on 20" iMac

    Can someone inform me more on this color dithering issue with the 20" iMac. Ever since I bought my early 2008 iMac it appears that hte colors are more washed out then my older 2006 iMac. After some searching online I find that the color rendering on

  • Not able to connect to CRMOD through Oracle Peoplesoft environment.

    We are setting up integration of CRMOD with our internal Peoplesoft Finance application using web services from CRMOD. We are not able to connect to CRMOD through Oracle Peoplesoft integration broker. Pl assist. Peoplesoft development environment is

  • Linking the  Custom infotype 9501(hrp infotype) to HRP1050

    Hi experts,                     specially for ABAP-hr guys.....Can u pls help me in providing me the correct solution for the below:                    The standard Job Evaluation Infotype 1050 should be automatically updated when creations, changes