Change order of columns

hi all,
i have used iterator to decide which columns should be dispalyed and which should remain hidden .
the column sequence(say a,b,c,d) of my internal table (that is finally displayed) is different from the sequence that user wants(say d,c,b,a), so now i have to change the column sequence too.
but i am not able to do so. I have tried hard-coding in iterator itself using "POSITION" , but its not working.
i have also hard coded in layout , but not working.
Please suggest something.
Thanks

Hi Shakey,
as mentioned previously the columns should appear in the same order as they are entered into the P_COLUMNS_DEFINITIONS itab in the GET_COLUMN_DEFINITIONS method of the iterator.
METHOD if_htmlb_tableview_iterator~get_column_definitions.
  FIELD-SYMBOLS: <def> LIKE LINE OF p_column_definitions.
* first column is small icon.
  APPEND INITIAL LINE TO p_column_definitions ASSIGNING <def>.
  <def>-columnname = 'ICON'.
  <def>-title      = ' '.
  APPEND INITIAL LINE TO p_column_definitions ASSIGNING <def>.
  <def>-columnname = 'CARRID'.
  APPEND INITIAL LINE TO p_column_definitions ASSIGNING <def>.
  <def>-columnname = 'CONNID'.
  APPEND INITIAL LINE TO p_column_definitions ASSIGNING <def>.
  <def>-columnname = 'FLDATE'.   <def>-edit = 'X'.
  APPEND INITIAL LINE TO p_column_definitions ASSIGNING <def>.
  <def>-columnname = 'PRICE'.    <def>-edit = 'X'.
  APPEND INITIAL LINE TO p_column_definitions ASSIGNING <def>.
  <def>-columnname = 'CURRENCY'. <def>-edit = 'X'.
  APPEND INITIAL LINE TO p_column_definitions ASSIGNING <def>.
  <def>-columnname = 'PLANETYPE'.
  APPEND INITIAL LINE TO p_column_definitions ASSIGNING <def>.
  <def>-columnname = 'SEATS'.
  <def>-title      = 'Seats'(001).
  <def>-edit       = 'X'.
ENDMETHOD.
So in the above example the columns appear in the order ICON, CARRID, CONNID, FLDATE, PROCE, CURRENCY, PLANETYPE and SEATS.
Cheers
Graham

Similar Messages

  • To change order of columns in a table

    Hi All,
    I have a table with structure like
    idx varchar2(250),
    name varchar2(250),
    dept varchar2(250)
    required
    idx varchar2(250),
    dept varchar2(250),
    name varchar2(250)
    table is created just want to change the order?
    dont want to drop and recreate table?
    Best Regards,
    Lee

    Without dropping and recreating the table:
    SQL> create table mytmp (idx varchar2(250), name varchar2(250), dept varchar2(250));
    Table created.
    SQL> insert into mytmp values ('1','X','Y');
    1 row created.
    SQL> col idx format a10
    SQL> col name format a10
    SQL> col dept format a10
    SQL> select * from mytmp;
    IDX        NAME       DEPT
    1          X          Y
    SQL> alter table mytmp add (newname varchar2(250));
    Table altered.
    SQL> update mytmp set newname = name;
    1 row updated.
    SQL> alter table mytmp drop (name);
    Table altered.
    SQL> alter table mytmp add (name varchar2(250));
    Table altered.
    SQL> update mytmp set name = newname;
    1 row updated.
    SQL> alter table mytmp drop (newname);
    Table altered.
    SQL> select * from mytmp;
    IDX        DEPT       NAME
    1          Y          X
    SQL>... although ... as others have said... why do you want to do this?

  • How to change order of columns in SAP Query

    Hi,
    I am working on SAP Query for first time using txn SQ01. Have some doubts on it.
    ->  If i want to change the order of the fields in the output in an existing sap query, i could not find any
       way other than deselecting the fields and again selecting them in the order they want to be. Is there any
       other way for this ? By the way, can we create an SAP query without an info set.
    Thanks in Advance.

    Hi Prasad,
    Please take notice of the [Forum Rules of Engagement |https://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement] ]
    here you can read
    Step 3: Provide Feedback and an Update
    Finally, it's nice to follow up with a brief update if you found the solution. People may try to help not because they know the answer, but because they are interested in solving the same problem; or people may just encounter the same issue in the future and be searching the archives. It's a good way to give back to the community, irrespective of whether you are a beginner or an expert.
    We are interested not so much that but much more how you solved your question.
    Thank you for cooperation.
    Clemens

  • Change the order of columns in a report

    hi all.
    i can't change the order of columns in a report not just by altering the select statement. where can i change it?
    thanks.

    hi master
    sir i use 6i report i see full report but i culd not found
    report region and report attributes
    sir please give me step or idea or tree where report region and report attrinutes"
    thanking you
    aamir

  • How do I change the order of columns in the responses table?

    How do i change the order of columns in the responses table in FormsCentral?  The default setting puts them in reverse order!

    Hi,
    The issue with the default ordering of columns in the response table is something that we hope to address in the next update to FormsCentral. In the meantime, you can reorder the columns by selecting them then click/drag using the gray area above the column name. As shown below, an orange marker will show you where the columns will be placed when you release the mouse button.
    Sorry for the inconvenience.
    Regards,
    Brian

  • Finder - changing sort order in column view

    Anyone know a way to change the sort order when using the COLUMN view in Finder? It's defaulting to alpha and I'd like to change it so when I'm viewing a particular folder the contents are displayed by Date Modified like I can when using the other views.
    THANKS!

    Hi VFRJOEY,
    there is no way to change the sort order in column-view. This was under discussion since the very first release of MacOS X but never made it into any one of the releases.
    If this answered your question please consider granting some stars: Why reward points?

  • Changing the order of columns in a table

    Can anyone tell me how to change the order of column in a table.
    I want a new column to be added in a table in 2nd position.
    Is there any way out for it?

    1) Does this have something to do with security? If not, it really ought to be posted in a more appropriate forum (Database - General for example).
    2) Why? If you care about the order of columns in a table, you're almost certainly doing something wrong. You can control the order of columns in a view, however, so you can put a view layer on top of the table to present the columns in a friendly fashion.
    3) Not without recreating the table. You can use the DBMS_REDEFINITION package to recreate the table with zero or minimal downtime but behind the scenes, you're really just creating a new table, copying the data over, dropping the old table, and renaming the new table to use the old table's name. DBMS_REDEFINITION does some extra work to track changes so that the original table can be available until the last possible moment.
    Justin

  • How does order of columns change when I create dimension?

    I created dimension from 3 tables, but order columns in each tables changed. And when I use drilldown in Dashboards and go to next level, all columns show in wrong order how in dimension. What should I do to change order columns in dimension?

    OK, this is a "stab in the dark" about what you're experiencing, but take a look at this: First, note the order you wish the columns to appear when doing a drilldown. Now, when you drill down, note which columns appear first (leftmost) as compared to the other columns that seem to not appear in the proper order. When the disorder appears, are there data in the left columns and no data in the columns towards the right? Here's what it seems OBI does (at least in my experience).
    If all the columns have data, the order in the drilldown will appear as expected. Let's say you have 15 columns. (There's a reason I chose this many columns.) What happens if columns 1 -5 (in your sort order) have no data, but column 6 does? OBI will put that column first at the far left. If then columns 7-9, say, have no data, but column 10 does, then column 10 will appear second. If columns 11- 15 have data, then the final order will be: 6, 10, 11- 15, 1-5, 7-9.
    As long as there are some sort of data, the column will appear in the proper order. But if a column has no data, then a column that does takes precedence. Why this behavior?
    Suppose that of the 15 columns, only column 15 had data. The number of columns would make the report very wide. Would the user wish to scroll all the way to the right just to see the one column of data? Instead, it will be column 1 with columns 2-14 following. The user would then be able to see the column with data without having to scroll. If they understood this behavior, they would know that if column 15 is appearing first, there is no need to scroll to the right.
    Again, this is my experience and it seems to explain it. (I, too, pulled my hair in frustration trying to figure this out). See if this applies to you and let me know.
    Note: The "strange" behavior appears at the lowest level drilldown. It seems to maintain the proper level at higher levels. (So in my experience, I drill from region>branch>details and it is in the detail level that I get the column disorder.)
    Edited by: LC143 on Oct 24, 2008 8:56 AM
    Edited by: LC143 on Oct 24, 2008 9:09 AM

  • Change Order of key figures

    Hi Gurus,
    We are using BI 7.0. & MS excel 2003 & 2007 both.
    I've designed a query with 10 Key figures.
    After execution, based on Key figures I have Added Local Formula in query.
    Now I want to change the order of Key Figures and bring Newly added Local Formula column at 3rd position.
    I've tried using Select Filter... and changed the order of column as I want, but this doesn't work.
    I can drag the column & drop it at desired position. It's working that way in office 2003.
    But in office 2007, Drag and Drop not working at all. Even for characteristics also.
    Is this problem with BEx Excel Patch? I've installed excel patch for both 2003 & 2007. But still not working properly.
    Please suggest. If you know latest patch available for office 2003 & 2007, please suggest.
    Thanks.

    HI,
    I am on BI7, Excel 2007
    Drag and Drop Functionality for both Char & KF is working fine including the placement of Local Formula.
    seems you need to check with the Basis Team for proper installation of the BEx Excel patch
    Regards
    ReddY A

  • Group Left report: problem in order the columns

    Hi,
    I have a Group Left report in report6i with group A and Group B. Group A has columns AAA, BBB, CCC, DDD, EEE, FFF and Group B has coulmn YYY, ZZZ.
    The problem is report does not take order by clause. It sort the report by first column of Group A, does not reflect my order by clause.
    I created laxical variable in order to change order by clause dynamically.
    Any suggestion?
    Thanks in advance
    Dip

    Hi,
    I have a Group Left report in report6i with group A and Group B. Group A has columns AAA, BBB, CCC, DDD, EEE, FFF and Group B has coulmn YYY, ZZZ.
    The problem is report does not take order by clause. It sort the report by first column of Group A, does not reflect my order by clause.
    I created laxical variable in order to change order by clause dynamically.
    Any suggestion?
    Thanks in advance
    Dip

  • Help with fuzzy search (doesn't work if change order of certain 2 letters)

    Hi,
    need some help with fuzzy search. It's pretty simple - we use fuzzy search on varchar2 columns that contain first name and last_name. The problem is that i don't really understand why it can't find name in some cases.
    Say i want to search for 'Taekpaul'. Then
    where CONTAINS(first_name,'fuzzy(TAEKPAUL)',1) > 0 - works
    where CONTAINS(first_name,'fuzzy(TAEKPALU)',1) > 0 - works (changed order of the 2 last letters)
    where CONTAINS(first_name,'fuzzy(TEAKPAUL)',1) > 0 - doesn't work, finds 'Tejpaul' that is completely unrelated (changed 2nd, 3rd order)
    How can i make it find 'Taekpaul' even if i search for TEAKPAUL? Is it related to index? Like Text index should be created with some different parameters?
    Thanks!
    Edited by: Maitreya2 on Mar 3, 2010 2:08 PM

    Thanks, adding '!' worked :)
    Do you know where i can read more about '!' and other special characters? I think i didn't see anything like that here: http://download.oracle.com/docs/cd/B14117_01/text.101/b10730/cqoper.htm#BABBJGFJ
    I also started using JARO_WINKLER_SIMILARITY function that is actually better i think for what i do. But it's very buggy - sometimes Oracle crashes and kills connection when you try to use it.
    Ahha, it's here: http://download.oracle.com/docs/cd/B19306_01/text.102/b14218/cqspcl.htm
    So, ! is soundex. Whatever it means..
    Edited by: Maitreya2 on Mar 5, 2010 12:14 PM

  • EA2 - strange column order in "Columns" tab

    Hi,
    when I click on a table in the left panel, I'd expect the columns in the "Columns" tab appear in the same order as the table has been defined (i.e. ordered by column id). But instead the columns are ordered by primary key. Of course I can doubleclick the column id heading to get the correct order, but when I switch to another table the columns are again sorted by primary key.
    If I didn't miss a preference, I'd suggest to change this behaviour to column id sorting by default.

    Sorry I missed that. Here's the query we use on that:
    with pri_cols as ( SELECT cols.column_name column_name, cols.position column_position
                                                           FROM all_constraints cons, all_cons_columns cols
                                                           WHERE cons.constraint_type = 'P'
                                                           AND cons.constraint_name = cols.constraint_name
                                                           AND cons.owner = cols.owner
                                                           and cols.table_name = :OBJECT_NAME
                                                           and cons.owner = :OBJECT_OWNER
                                                           ORDER BY cols.table_name, cols.position )
    select c.column_name, case when data_type = 'CHAR' then data_type||'('||c.char_length||decode(char_used,'B',' BYTE','C',' CHAR',null)||')'
                                       when data_type = 'VARCHAR' then data_type||'('||c.char_length||decode(char_used,'B',' BYTE','C',' CHAR',null)||')'
                                       when data_type = 'VARCHAR2' then data_type||'('||c.char_length||decode(char_used,'B',' BYTE','C',' CHAR',null)||')'
                                       when data_type = 'NCHAR' then data_type||'('||c.char_length||decode(char_used,'B',' BYTE','C',' CHAR',null)||')'
                                       when data_type = 'NUMBER' then
                                                 case when c.data_precision is null then 'NUMBER'
                                                 else data_type||'('||c.data_precision||','||c.data_SCALE||')' end
                                       when data_type = 'NVARCHAR' then data_type||'('||c.char_length||decode(char_used,'B',' BYTE','C',' CHAR',null)||')'
                                       when data_type = 'NVARCHAR2' then data_type||'('||c.char_length||decode(char_used,'B',' BYTE','C',' CHAR',null)||')'
                                       else data_type end data_type,
    decode(nullable,'Y','Yes','No') nullable,
    c.DATA_DEFAULT,column_id, sub.column_position pk,com.comments     
    from sys.all_tab_Columns c,
    sys.all_col_comments com,
    pri_cols sub
    where c.column_name = sub.column_name(+)
    and c.owner = :OBJECT_OWNER
    and c.table_name = :OBJECT_NAME
    and c.table_name = com.table_name
    and c.owner = com.owner
    and c.column_name = com.column_name     
    order by sub.column_position nulls last,column_id
    It's supposed to place the pk columns in order followed by the other columns by column_id.

  • SQL Query to re-order the columns

    Hello All,
    I want to know if it is possible to re-order the columns of a table once the rows has been inserted in all the columns.
    So for e.g I have initially a table containing 3 columns COL1, COL2 & COL3.
    Now after data has been inserted into the table, I want to re-order the columns like COL3, COL2, COl1 or may be COL2, COL1, COL3 etc keeping the data intact.
    Cheers,
    Parag

    Parag Kalra wrote:
    I want to know if it is possible to re-order the columns of a table once the rows has been inserted in all the columns.
    So for e.g I have initially a table containing 3 columns COL1, COL2 & COL3.
    Now after data has been inserted into the table, I want to re-order the columns like COL3, COL2, COl1 or may be COL2, COL1, COL3 etc keeping the data intact.Why? What is your reason for wanting to do this? What do you want to achieve by it? If we understand the actual problem, then we may be able to provide some usable suggestions.
    The reason why your request makes very little sense is that the physical sequence of columns in a row in a datablock, has no impact on you as developer writing code.
    Why? Because you control the order in which you want to select columns. You control the order in which you insert columns. You control the order in which you update columns.
    SQL allows you the programmer to specify the sequence of columns, and subset of columns, that you want to use in your SQL.
    Why would you want to change the physical table definition, and rewrite the entire table on disk (using very expensive I/O) to reorder the physical column sequence?

  • 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. :)

  • Bad practice to assume ordering of columns using *  ??

    I am using Pro*C -- embedded sql
    I have a table with 60 columns and it is partitioned by datetime. It is constantly getting new rows via an array insert, inserting 10 to 100 million rows a day depending on the installation.
    I am currently using select * for the querying.
    I am inserting an array:
    exec sql for :cnt insert into x values (...);
    Is it more efficient or bad practice to assume the ordering of columns. Is it better to list the columns explicitly in the select/insert?
    thanks, lisa

    Yes.
    Imagine if you have added a new column to the table and that column has a default value assigned for older applications (only newer applications will use this added column, old applications should still work), you do not have to re-visit the old application code to change all those insert statements. Only new applications will need to care about what value to put into this newly added column.
    This helps avoid unnecessary changes to existing applications if the new column(s) is added to support new applications only.

Maybe you are looking for

  • How do I recover lost tabs when Session Restore and the option to load previously closed tabs aren't available?

    Hi there, I have been having a hell of a time over the last couple days days to recover my lost tabs in Firefox, which vanished yesterday morning (Restore Previous Session and Restore Closed Tabs were both greyed out). Actually, my add-ons have also

  • How to use serveroutput commands in plsql

    Hi, I have to create spool file inside my procedure how is it possible to use it? Is there any way. Will dynamic statements will work E.g CREATE OR REPLACE PROCEDURE SP_PROC1 AS BEGIN SET SERVEROUPUT ON; SPOOL D:\ABCD.LOG; SET SERVEROUTPUT OFF; SPOOL

  • How to send (Dunning) reminder before due dates.

    Hi , As per the customer requirement, i have to send a dunning reminder before due (10,5,2) days. Let me know if there is any standards available or any alternate solution. Regards KC Edited by: SAPFINANCE on Jul 7, 2010 3:23 AM

  • HT201401 my imessage isnt working correctly?

    My imessage is on but says is waiting to be activated and not allowing me to send imessages and its very frustrating that all my messages are sending as text messages..

  • G5 won't read my new memory cards now?

    Ok, so after going through a whole mess of getting the wrong memory cards (see this post: http://discussions.apple.com/message.jspa?messageID=8321578), I ordered new ones (which fit in just fine), but now that I've inserted them, the computer isn't r