Converting rows to columns in internal tables

hi
i have an internal table with foll strcuture
customer    jan  feb mar   apr jun  july  aug sep oct nov dec 
  a               1     2    3     4     5    6     7    8    9    10   11
b
c
n
i need to form another internal table whose ouput will be
month      custA     cust B     custc   cust d
jan              1
feb               2
mar              3
and so on
is this possible to do ? without dynamic internal table

If you don't know number of records in 1st table in advance you must create dynamic table at runtime.

Similar Messages

  • CONVERT ROWS INTO COLUMNS IN INTERNAL TABLE

    Hi Experts,
    I want to convert rows into coloumns in final internal table.
    How to do that one. Can any one help me its very urgent.
    Regards,
    PBS.

    hi,
    Find the below code for changing rows into colums.
    data: begin of itab1 occurs 0,
    fld,
    end of itab1.
    data: begin of itab2 occurs 0,
    fld1,
    fld2,
    fld3,
    end of itab2.
    itab1-fld = 1.
    append itab1.
    itab1-fld = 2.
    append itab1.
    itab1-fld = 3.
    append itab1.
    read table itab1 index 1.
    if sy-subrc eq 0.
    itab2-fld1 = itab1-fld.
    endif.
    read table itab1 index 2.
    if sy-subrc eq 0.
    itab2-fld2 = itab1-fld.
    endif.
    read table itab1 index 3.
    if sy-subrc eq 0.
    itab2-fld3 = itab1-fld.
    endif.
    append itab2.
    loop at itab1.
    write:/ itab1.
    endloop.
    loop at itab2.
    write:/ itab2.
    endloop.
    refer the below link for further information
    internal table rows to columns
    in the final display list how can i change rows to columns and vice versa

  • How to convert rows to columns of a table?

    I want to convert rows to columns of a table..
    Query in SQL??

    965373 wrote:
    I want to convert rows to columns of a table..
    Query in SQL??PIVOT by Frank Help for a query to add columns
    PIVOT by TomK http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:766825833740

  • How to convert rows to lines in internal table?

    Hi Folks,
    i have an internal table with some rows and would like to convert that table into another internal table with columns.
    Let me give you an example:
    it1:

    b
    c
    d
    it1 should be converted into table it2 and should look like this:
    it2:
    a   b    c    d  
    The problem is that the entries in table it1 are not fixed, so that means that the number of lines is different depending on the query...
    Has anyone an idea?
    Thanks in advance,
    Ralf
    Edited by: Ralf Vath on Oct 17, 2008 11:01 AM

    hi i have an example in the alv ....that the rows are transported into columns...
    REPORT  Z_TRANSPOSEALV                                    .* Type pools declaration for ALV
    TYPE-POOLS: slis.*Declarations for ALV, dynamic table and col no for transpose
    DATA:    l_col    TYPE sy-tabix,
             l_structure   TYPE REF TO data,
             l_dyntable    TYPE REF TO data,
             wa_lvc_cat  TYPE lvc_s_fcat,
             lt_lvc_cat  TYPE lvc_t_fcat,
             lt_fieldcatalogue     TYPE slis_t_fieldcat_alv,
             wa_fieldcat TYPE slis_fieldcat_alv,
             lt_fieldcat TYPE slis_t_fieldcat_alv,
             lt_layout   TYPE slis_layout_alv.*Field symbols declarations
    FIELD-SYMBOLS :
      <header>    TYPE ANY,
      <dynheader> TYPE ANY,
      <dyndata>   TYPE ANY,
      <ls_table>      TYPE ANY,
      <dynamictable>      TYPE STANDARD TABLE,
      <it_table> TYPE STANDARD TABLE.*Input the name of the table
    PARAMETERS p_table TYPE dd02l-tabname OBLIGATORY.*Initialization event
    INITIALIZATION.*Start of selection event
    START-OF-SELECTION.* Create internal table of dynamic type
      CREATE DATA l_dyntable TYPE STANDARD TABLE OF (p_table)
                           WITH NON-UNIQUE DEFAULT KEY.
      ASSIGN l_dyntable->* TO <it_table>.*select statement to select data from the table as input into
    *our dynamic internal table.
    *Here i have restricted only till 5 rows.
    *You can set a variable and give no of rows to be fetched
    *The variable can be set in your select statement  SELECT * INTO CORRESPONDING FIELDS OF TABLE <it_table>
                    FROM (p_table) up to 5 rows.*Fieldcatalogue definitions
      wa_lvc_cat-fieldname = 'COLUMNTEXT'.
      wa_lvc_cat-ref_table = 'LVC_S_DETA'.
      APPEND wa_lvc_cat TO lt_lvc_cat.  wa_fieldcat-fieldname = 'COLUMNTEXT'.
      wa_fieldcat-ref_tabname = 'LVC_S_DETA'.
      wa_fieldcat-key  = 'X'..
      APPEND wa_fieldcat TO lt_fieldcat.  DESCRIBE TABLE <it_table>.  DO sy-tfill TIMES.
      For each line, a column 'VALUEx' is created in the fieldcatalog
      Build Fieldcatalog
        WRITE sy-index TO wa_lvc_cat-fieldname LEFT-JUSTIFIED.
        CONCATENATE 'VALUE' wa_lvc_cat-fieldname
               INTO wa_lvc_cat-fieldname.
        wa_lvc_cat-ref_field = 'VALUE'.
        wa_lvc_cat-ref_table = 'LVC_S_DETA'.
        APPEND wa_lvc_cat TO lt_lvc_cat.
      Build Fieldcatalog
        CLEAR wa_fieldcat.
        wa_fieldcat-fieldname = wa_lvc_cat-fieldname.
        wa_fieldcat-ref_fieldname = 'VALUE'.
        wa_fieldcat-ref_tabname = 'LVC_S_DETA'.
        APPEND wa_fieldcat TO lt_fieldcat.
      ENDDO.* Create dynamic internal table
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = lt_lvc_cat
        IMPORTING
          ep_table        = l_dyntable.  ASSIGN l_dyntable->* TO <dynamictable>.* Create structure as structure of the internal table
      CREATE DATA l_structure LIKE LINE OF <dynamictable>.
      ASSIGN l_structure->* TO <header>.* Create structure = structure of the internal table
      CREATE DATA l_structure LIKE LINE OF <it_table>.
      ASSIGN l_structure->* TO <ls_table>.* Create field catalog from our table structure
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name       = p_table
        CHANGING
          ct_fieldcat            = lt_fieldcatalogue
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.  DESCRIBE TABLE lt_fieldcatalogue.* Fill the internal to display <dynamictable>
      DO sy-tfill TIMES.
        IF sy-index = 1.
          READ TABLE lt_fieldcatalogue INTO wa_fieldcat INDEX 1.
        ENDIF.
      For each field of it_table
        ASSIGN COMPONENT 1 OF STRUCTURE <header> TO <dynheader>.
        IF sy-subrc NE 0. EXIT .ENDIF.
        READ TABLE lt_fieldcatalogue INTO wa_fieldcat INDEX sy-index.
      Fill 1st column
        <dynheader> = wa_fieldcat-seltext_m.
        IF <dynheader> IS INITIAL.
          <dynheader> = wa_fieldcat-fieldname.
        ENDIF.*Filling the other columns
        LOOP AT <it_table> INTO <ls_table>.
          l_col = sy-tabix + 1.
          ASSIGN COMPONENT sy-index OF STRUCTURE <ls_table> TO <dyndata>.
          IF sy-subrc NE 0. EXIT .ENDIF.
          ASSIGN COMPONENT l_col OF STRUCTURE <header> TO
    <dynheader>.
          IF sy-subrc NE 0. EXIT .ENDIF.
          WRITE <dyndata> TO <dynheader> LEFT-JUSTIFIED.
        ENDLOOP.
        APPEND <header> TO <dynamictable>.
      ENDDO.*Layout for ALV output
      lt_layout-zebra = 'X'.
      lt_layout-no_colhead = 'X'..
      lt_layout-colwidth_optimize ='X'.
      lt_layout-window_titlebar = 'ALV GRID TRANSPOSED'.*ALV Grid output for display
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          is_layout   = lt_layout
          it_fieldcat = lt_fieldcat
        TABLES
          t_outtab    = <dynamictable>.

  • ALV rows to column dynamic internal table

    Hello People ,
    I am stuck in a report which displays an output in ALV as follows :-
    bukrs | kntyp | konto | knfix  | period     | element    | emeng  | emein
    1000  | 10      | 1100 | berlin | 11.2011  |      AG      |  0.148    | kgAG
    1000  | 10      | 1100 | berlin | 11.2011  |      AU      | 0.104    | kgAU
    1000  | 10      | 1100 | berlin | 11.2011  |      GA     | 0.207    | kgGA
    And this table has many values corresponding to element AG,AU and GA respectively . For example , there would be many element AG's with many "EMENG" values . Similarly for AU and GA .
    MY question :- I am asked to make AG , AU , GA as 3 different fields which should show the value "EMENG" under respective elements . Like :-
    bukrs | kntyp | konto | knfix  | period     |   AG       |   AU      |  GA     |    emein
    1000  | 10      | 1100 | berlin | 11.2011  |   0.148    |   0.104  |  0.207 |    kgAG
    That should be my output . ( elements replaced by AG , AU and GA which comes from a Metal table ZXXXX where
    metal no. 1 = AU
    metal no. 2 = AG
    metal no. 3 = GA
    If there is any metal added to it would be metal no. 4 ,5,6,7 .... so on ) and then that should be added as a field in our report .. So that has to be DYNAMIC .
    I am unable to move on with problem . Pls suggest ? I am pasting my report here ...
    FORM select_table_gt_bb CHANGING p_gt_bb.
      TABLES : zpam_as .
      DATA : i_zpam_as TYPE TABLE OF zpam_as ,
             wa_zpam_as LIKE LINE OF i_zpam_as ,
             i_tcurr TYPE TABLE OF tcurr ,
             wa_tcurr LIKE LINE OF i_tcurr,
             zt_as TYPE TABLE OF zpam_as.
      SELECT * FROM zpam_as INTO TABLE gt_as
             WHERE bukrs   EQ bukrs
               AND kntyp   IN kntyp
               AND konto   IN konto
               AND knfix   IN knfix
               AND buper   IN buper
               AND element IN element
               AND ameng   IN ameng
               AND ashkz   IN ashkz
               AND emeng   IN emeng
               AND eshkz   IN eshkz
               AND emein   IN emein.
      SELECT * FROM zpam_tcurr INTO TABLE gt_tcurr.
      IF sy-subrc IS INITIAL.
        LOOP AT gt_tcurr INTO gw_tcurr.
         SELECT * FROM tcurr INTO wa_tcurr WHERE fcurr = gw_tcurr-fcurr AND
         tcurr = tcurr.
          ENDSELECT.
          APPEND wa_tcurr TO i_tcurr.
          DELETE ADJACENT DUPLICATES FROM i_tcurr.
        ENDLOOP.
      ENDIF.
      IF i_tcurr IS NOT INITIAL.
        LOOP AT gt_as INTO gw_as.
    CLEAR sy-subrc.
    LOOP AT i_tcurr
    INTO wa_tcurr
    WHERE   fcurr = gw_as-emein.
            gw_as-tcurr = wa_tcurr-tcurr.
            gw_as-ukurs = wa_tcurr-ukurs.
            gw_as-total = abs( gw_as-emeng ) * wa_tcurr-ukurs.
            APPEND gw_as TO zt_as.
          ENDLOOP.
          IF sy-subrc <> 0.
            gw_as-tcurr = 'None'.
            gw_as-ukurs = ''.
            gw_as-total = ''.
            APPEND gw_as TO zt_as.
          ENDIF.
        ENDLOOP.
        REFRESH gt_as.
        LOOP AT zt_as INTO gw_as.
          APPEND gw_as TO gt_as.
        ENDLOOP.
      ENDIF.
    ENDFORM.
    Priority normalized
    Edited by: Rob Burbank on Dec 28, 2011 3:44 PM

    Hey,
    But after understanding my question correctly , you sure that dynamic internal table is the solution for it ?

  • Convert Rows in columns

    Please Help me!!!
    I want to convert rows into columns ,-----
    script:---
    create table jobwork (vrno varchar2(11),job_str varchar2(1000));
    VRNO      JOB_STR
    J101 J111,J112,J113,J114
         J201     J211,J222,J223,J224,J225
         J301     J311,J312
         J401     J411,J422,J423,J425,JJ426,J427
    I want output like :---
    VRNO     JOB_STR
    J101     J111
    J101 J112
    J101 J113
    J101 J114
    J201 J211
    J201 J222
    J201 J223
    J201 J224
    J201 J225
    and so on...........

    942425 wrote:
    Please Help me!!!
    I want to convert rows into columns ,-----Not according to what you posted below. You want to break out a comma separated list.
    This wouldn't be required if the data was stored in a proper relational format (you should look to change the data model).
    942425 wrote:
    script:---
    create table jobwork (vrno varchar2(11),job_str varchar2(1000));
    VRNO      JOB_STR
    J101 J111,J112,J113,J114
         J201     J211,J222,J223,J224,J225
         J301     J311,J312
         J401     J411,J422,J423,J425,JJ426,J427
    I want output like :---
    VRNO     JOB_STR
    J101     J111
    J101 J112
    J101 J113
    J101 J114
    J201 J211
    J201 J222
    J201 J223
    J201 J224
    J201 J225
    and so on...........If we knew your Oracle version I could be more precise, but since I have no idea what version you are on...
    https://www.google.com/#output=search&sclient=psy-ab&q=oracle+break+out+comma+separated+string&oq=oracle+break+out+comm&gs_l=hp.3.0.0i22i30.226.3329.0.4689.21.19.0.2.2.0.190.2042.10j9.19.0...0.0.0..1c.1.16.psy-ab.X1wge4Bavd8&pbx=1&bav=on.2,or.r_qf.&bvm=bv.47534661,d.cGE&fp=e8ac345f62c30ea5&biw=1850&bih=1083
    Will give you the ability to figure out which techniques are applicable for your version.
    Cheers,

  • 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

  • Converting rows to columns using t-sql

    Hi All,
    I have a table with 3 columns, let say ID1 , ID2, Flag
    My Source data looks like this..
    ID1    ID2       Flag
    1         1            0
    1         2            0
    1         3            0
    2         7            0
    2         8            1
    2         9            0
    4         5            0
    Now My output should look like this..
    ID1     Newcol1     NewFlag1     Newcol2     NewFlag2   Newcol3    NewFlag3
    1           1                    0                  
     2                   0                3                
    0
    2           7                    0               
        8                   1                9                
    0
    4           5                    0                  
     null               null            null              null
    Basically I want to convert rows to columns and to get above output I need t-SQL query.
    Thanks in advance
    RH
    sql

    You can do it by this query:
    declare @table table ( ID1 int, ID2 int, Flag int)
    insert @table values ( 1,1,0 ),( 1,2,0 ),( 1,3,0 ),( 2,7,0 ),( 2,8,1 ),( 2,9,0 ),( 4,5,0 )
    WITH cte1
    AS ( SELECT Id1 ,
    ROW_NUMBER() over (partition by ID1 order by ID1 ) as Sequence ,
    ID2 ,
    Flag
    FROM @table
    cte2
    AS ( SELECT Id1 ,
    ColumnTitle + LTRIM(RTRIM(STR(Sequence))) AS ColumnTitle ,
    ColumnData
    FROM cte1 UNPIVOT ( ColumnData FOR ColumnTitle IN ( [ID2], [Flag] ) ) AS UP
    SELECT Id1 ,
    [ID21] FirstID2 ,
    [Flag1] FirstFlag ,
    [ID22] SecondID2 ,
    [Flag2] SecondFlag ,
    [ID23] ThirdID2 ,
    [Flag3] ThirdFlag
    FROM cte2 PIVOT ( MAX(ColumnData) FOR ColumnTitle IN ( [ID21],
    [Flag1],
    [ID22],
    [Flag2],
    [ID23],
    [Flag3] ) ) PV
    If you want to know more detail, please visit my old article about this method:
    T-SQL: PIVOT Ordered pair Columns
    T-SQL e-book by TechNet Wiki Community
    My Blog
    My Articles

  • Select Statement - How do i convert rows to columns

    Hi, i need your help please.
    i have three options: A, B, C in table T_OPTIONS (not more and not less, it is always 3)
    no i can assign articles to this option.
    Article 1, 2, 3, 4
    in the table it looks like this
    ARTICLE_ID T_OPTIONS
    1                   A
    1                   B
    2                   C
    3                    A
    3                    C
    But now i want to have a select statement which convert rows to columns, it has to look like this
    ARTICLE A B C
    1             x x
    2             x
    3             x   x
    Can you help me!?
    Edited by: Dila on 02.08.2012 01:52
    Edited by: Dila on 02.08.2012 01:53

    Dila wrote:
    Hi, i need your help please.
    i have three options: A, B, C in table T_OPTIONS (not more and not less, it is always 3)
    no i can assign articles to this option.
    Article 1, 2, 3, 4
    in the table it looks like this
    ARTICLE_ID T_OPTIONS
    1                   A
    1                   B
    2                   C
    3                    A
    3                    C
    But now i want to have a select statement which convert rows to columns, it has to look like this
    ARTICLE A B C
    1             x x
    2             x
    3             x   x
    Can you help me!?
    Edited by: Dila on 02.08.2012 01:52
    Edited by: Dila on 02.08.2012 01:53Read {message:id=9360002} and {message:id=9360005}
    SQL> ed
    Wrote file afiedt.buf
      1  with sample_data as
      2  (
      3  select 1 ARTICLE_ID,'A' T_OPTIONS from dual union all
      4  select 1, 'B' from dual union all
      5  select 2, 'C' from dual union all
      6  select 3, 'A' from dual union all
      7  select 3, 'C' from dual
      8  )
      9   select article_id,
    10         decode(sum(case
    11                      when t_options = 'A' then 1
    12                      else 0
    13                    end), 0, null,
    14                          'X') A,
    15         decode(sum(case
    16                      when t_options = 'B' then 1
    17                      else 0
    18                    end), 0, null,
    19                          'X') B,
    20         decode(sum(case
    21                      when t_options = 'C' then 1
    22                      else 0
    23                    end), 0, null,
    24                          'X') C
    25  from   sample_data
    26* group  by article_id
    SQL> /
    ARTICLE_ID A B C
             1 X X
             2     X
             3 X   X

  • How to convert rows into column

    Hi,
    can any one help me how to convert rows into column by pl/sql procedure.
    Thanks and Regards

    http://www.oracle.com/technology/oramag/code/tips2004/050304.html
    -- dropping the sample table if exists
    drop table rowstocol
    -- create sample table
    create table rowstocol ( name varchar2(20));
    -- Inserting rows into sample table
    insert into rowstocol values('Amit Zhankar');
    insert into rowstocol values('Piyu Yawalkar');
    insert into rowstocol values('Piyu Yawalkar');
    insert into rowstocol values('Ashish Ghelani');
    insert into rowstocol values('Aditi Zhankar');
    insert into rowstocol values('Tom Kyte');
    insert into rowstocol values('Oracle');
    -- Following query should be run to create a sql. This result sql should be run to convert rows to column.
    -- The following query uses just the tablename (whose data is to be converted) and name of the column (which is to be converted).
    -- Example taken here is table rowstocol, column name.
    SELECT cc
    FROM (select decode(rn ,1 ,'Select ',null) ||' MAX (CASE WHEN dr = '|| rownum||' THEN DECODE (rn,1, col1) END) '||
    decode(rn,maxr,' col1 from ','||'||chr(39)||','||chr(39)||'|| ') cc,rn,maxr
    from (SELECT ROWNUM rn,count(0) over() maxr FROM rowstocol) order by rn) trows
    union all
    select '(SELECT tabs.col1, DENSE_RANK () OVER (ORDER BY col1,rowid) dr,dense_rank() OVER (order by 1) rn
    FROM (SELECT NAME col1 FROM rowstocol) tabs ) group by rn' cc from dual;
    -- The result of this query will do the reqd conversion from row to column.
    -- Replace table rowstocol by your table, column name by your column.
    CC
    Select MAX (CASE WHEN dr = 1 THEN DECODE (rn,1, col1) END) ||','||
    MAX (CASE WHEN dr = 2 THEN DECODE (rn,1, col1) END) ||','||
    MAX (CASE WHEN dr = 3 THEN DECODE (rn,1, col1) END) ||','||
    MAX (CASE WHEN dr = 4 THEN DECODE (rn,1, col1) END) ||','||
    MAX (CASE WHEN dr = 5 THEN DECODE (rn,1, col1) END) ||','||
    MAX (CASE WHEN dr = 6 THEN DECODE (rn,1, col1) END) ||','||
    MAX (CASE WHEN dr = 7 THEN DECODE (rn,1, col1) END) ||','||
    MAX (CASE WHEN dr = 8 THEN DECODE (rn,1, col1) END) col1 from
    (SELECT tabs.col1, DENSE_RANK () OVER (ORDER BY col1,rowid) dr,dense_rank() OVER (order by 1) rn
    FROM (SELECT NAME col1 FROM rowstocol) tabs ) group by rn
    Select MAX (CASE WHEN dr = 1 THEN DECODE (rn,1, col1) END) ||','||
    MAX (CASE WHEN dr = 2 THEN DECODE (rn,1, col1) END) ||','||
    MAX (CASE WHEN dr = 3 THEN DECODE (rn,1, col1) END) ||','||
    MAX (CASE WHEN dr = 4 THEN DECODE (rn,1, col1) END) ||','||
    MAX (CASE WHEN dr = 5 THEN DECODE (rn,1, col1) END) ||','||
    MAX (CASE WHEN dr = 6 THEN DECODE (rn,1, col1) END) ||','||
    MAX (CASE WHEN dr = 7 THEN DECODE (rn,1, col1) END) ||','||
    MAX (CASE WHEN dr = 8 THEN DECODE (rn,1, col1) END) col1 from
    (SELECT tabs.col1, DENSE_RANK () OVER (ORDER BY col1,rowid) dr,dense_rank() OVER (order by 1) rn
    FROM (SELECT NAME col1 FROM rowstocol) tabs ) group by rn;
    COL1
    Aditi Zhankar,Amit Zhankar,Ashish Ghelani,Oracle,Oracle,Piyu Yawalkar,Piyu Yawalkar,Tom Kyte
    Edited by: bhooma on Jan 20, 2009 2:44 AM

  • How to convert rows into columns

    Hi,
    How to convert rows into columns of two different tables.
    These two tables have two common columns namely (shipline,pos).
    Let me know if we have any built in functions to do this.
    thank you very much .
    Edited by: 808542 on Dec 7, 2010 8:35 PM
    Edited by: 808542 on Dec 7, 2010 8:37 PM

    Have you tried this first?
    http://forums.oracle.com/forums/search.jspa?threadID=&q=row+to+column&objID=f75&dateRange=last90days&userID=&numResults=15&rankBy=10001

  • Convert row into columns

    Hello World ,
    I want to make the below table data come in one row
    Name | code | MARK
    AAA | CODE2 | 50
    AAA | CODE1 | 30
    AAA | CODE3 | 22
    BBB | CODE2 | 52
    BBB | CODE3 | 53
    CCC | CODE3 | 11
    AES | CODE1 | 75
    FES | CODE2 | 44
    i want it to be like this
    NAME | CODE1 | CODE2 | CODE3
    AAA | 30 | 30 | 22
    BBB | - | 52 | 53
    CCC | - | - | 11
    is there another way of DECODE?
    Regards

    A very small amount of effort on your side would have found the FAQ thread "How do I convert rows to columns" SQL and PL/SQL FAQ

  • Copy a certain row of data into the next row in a same internal table ??

    HI, guys.
    May i know how to copy a certain row of data into the next row in a same internal table ?? Bcz I plan to update a certain colum of data in the row just now into another value..
    For example:-
    *at first...
    ebeln1   ebelp1   xblnr1
    ebeln2   ebelp2   xblnr2
    ebeln3   ebelp3   xblnr3
    *after that, become...
    ebeln1   ebelp1   xblnr1
    ebeln2   ebelp2   xblnr2
    ebeln2   ebelp2   xblnr4
    ebeln2   ebelp2   xblnr5
    ebeln3   ebelp3   xblnr3
    Thanks in advance.

    hi,
    If you have this kind of requirement then you must be having 2 internal tables ,one existing data and 2nd from which you have to insert the records into 1st table.
    so in this case,
    loop at itab1.
      v_index = sy-tabix.
      loop at itab2 into wa where pri_key = itab1-pri_key.
      v_index = v_index + 1.
      insert  wa into itab index v_index.
      endloop.
    endloop.
    Using this code ,your data records similar to your 1st tables primary key records will get inserted into table.

  • How to Delete a Column in Internal Table

    Hi All,
    Does any one know ,How to Delete a Column in Internal Table?

    Hi,
       For deleting the column in the internal table, you have to eliminate the field which you want to delete.
    loop at itab into wa.
      move corresponding wa to wa1.
    append wa1 to itab1.
    clear wa1.
    clear wa.
    endloop.
    wa1 is the workarea without the field which you want to delete.
    itab1 is the internal table which consists of the deleted column.

  • 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

Maybe you are looking for

  • Problems with app sizes in iTunes and on an iTouch

    My iTouch is showing a large amount of memory for apps (10.5G worth shows on the capacity bar at the bottom of iTunes when iTouch is connected).  However, this seems way too much.  I even went through the app list (shown on iTunes when his iTouch is

  • Creating photo book on iPad

    Hello, I am getting the impression that I can't use my new  iPad for creating photo books from my snapfish/shutterfly accounts?  One of the big reasons I got an iPad was to continue my hobby of making photo books online, having the photo books be cre

  • My Firefox opens to a completely blank screen with no menu bars or anything. I've uninstalled & reinstalled several times with the same problem. Help!

    I opened it this morning with no problems, went to my g-mail account, pulled up an e-mail, clicked to reply, typed my respons, but when I hit send, everything went completely blank. I have no tabs, no menu bars... nothing but the firefox logo on the

  • No sound in iDVD project, how I solved it.

    Not a question but maybe someone will have a similar problem and find this post. I made a combo photo/video iMovie. Then I shared it in iDVD and made a menu. When I previewed the DVD all was fine. When I burned it though, there was no sound outside o

  • Deleting rows from a JTable using DefaultTableModel

    First of all, is it possible to remove a row of information from a table that uses the DefaultTableModel? I have created a table using the default table model as follows:           tblPhoneNumbers = new JTable(new DefaultTableModel(