Change of columns sequence

Is there a possibility to add a new column to a table NOT at the end of the table?
The only way I can think of is to update the COLUMN_ID in the data dictionary table USER_TAB_COLUMNS, which is probably not a very good idea.
Thanks
Bernhard Slominski

Add the column (at the end of the column list).
Rename the table (e.g. RENAME EMP TO EMP#;).
Create a view (with the old name of the table) on the renamed table, with a column sequence as you like (e.g. CREATE VIEW EMP AS SELECT col1,colnew,col2 FROM EMP#;).
Work with the view instead of the table.
By the way, your software should never rely on the column sequence.

Similar Messages

  • How can we change the column sequence from 1st to 7th position

    Hi
    I have a table in which I have a column naming DNAME and it is is on the first position I want to change its position to 7 that is the last one. The table is huge filled with data.
    Is there ant way in which I can cange the position of the column with out recreating in into another table and then renaming it.
    Thanks

    Hello,
    The sequence of a column in a table is meaningless and you should treat it as such. The column ordering you see when you run a "select * from ..." query is based on the physical implementation of the table, which is completely separate from the logical interpretation, and should not be relied on in a programmatic context. It should essentially be viewed as "random" and prone to change with the physical storage properties of the table (although this is not always the case, there is no assurance of this).
    One way to do this (which happens to be the easiest and least resource-intensive in this case) is to create a view (derived relation) of the base table, with the columns ordered in the specific sequence you desire. But really, the column ordering here is still meaningless, and the only time your application should rely on the order is when you specifically list the columns you require in a query -- but NEVER a "select *".
    cheers,
    Anthony

  • Change column sequence for screen variant FB50

    Hi Experts,
    I am able to hide unwanted fields in screen variant for items for tcode fb50 by creating screen variant and i also selected adopt column sequence check box.when  i go tcode shd0 and clicked screen variant that i already created and click with processing button i can get FB50 tcode screen there i can change column sequence by drag and drop .is it correct way to change the column sequence? but i am unaware how to save the changes i made.
    Please let me know how to proceed to change the column sequence and save it.
    Thanks&Regards,
    narasimha.

    Hi Faheem,
    After changing the column sequence i clicked configuration button and click save button and again clicked Configuration and selected Administrative button there i can see the column sequence change and clicked activate button .now if i close and reopen the transaction my column sequence is same with out changes that i made .
    you asked me to save the changes where i can do exactly ? Could you please tell in briefway from scratch so that i can trace where i done mistake.
    Thanking you in advance.
    Regards,
    narasimha.

  • Changing Column Sequence

    Hi,
    How to change the column sequence with out recreating a table?
    Exapmle :
    SQL> desc emp
    Name Null? Type
    EMPNO NOT NULL NUMBER(4)
    ENAME VARCHAR2(10)
    JOB VARCHAR2(9)
    MGR NUMBER(4)
    HIREDATE DATE
    SAL NUMBER(7,2)
    COMM NUMBER(7,2)
    DEPTNO NUMBER(2)
    SQL>
    Expected:
    SQL> desc emp
    Name Null? Type
    EMPNO NOT NULL NUMBER(4)
    DEPTNO NUMBER(2)
    ENAME VARCHAR2(10)
    JOB VARCHAR2(9)
    MGR NUMBER(4)
    HIREDATE DATE
    SAL NUMBER(7,2)
    COMM NUMBER(7,2)
    SQL>
    Regards

    I would not even dream of doing such thing on a production database :(How about DBMS_REDEFINITION? It allows us to do redefinition stuff online.
    A little example:
    SQL> create table emp
      2    (empno number primary key,
      3     empname varchar2(30),
      4     deptno number,
      5     address varchar2(50));
    Table created.
    SQL> insert into emp
      2  select rownum,
      3         'EMPLOYEE ' || rownum,
      4         mod(rownum, 10) + 1,
      5         'ADDRESS ' || rownum
      6    from dual
      7  connect by level <= 100;
    100 rows created.
    SQL> commit;
    Commit complete.
    SQL> desc emp
    Name                                                  Null?    Type
    EMPNO                                                 NOT NULL NUMBER
    EMPNAME                                                        VARCHAR2(30)
    DEPTNO                                                         NUMBER
    ADDRESS                                                        VARCHAR2(50)
    SQL> exec dbms_redefinition.can_redef_table(user ,'EMP', dbms_redefinition.cons_use_pk)
    PL/SQL procedure successfully completed.
    SQL> create table emp_new
      2    (empno number primary key,
      3     deptno number,
      4     empname varchar2(30),
      5     address varchar2(50));
    Table created.
    SQL> exec dbms_redefinition.start_redef_table(user, 'EMP', 'EMP_NEW', options_flag => dbms_redefinition.cons_use_pk)
    PL/SQL procedure successfully completed.
    SQL> exec dbms_redefinition.finish_redef_table(user, 'EMP', 'EMP_NEW')
    PL/SQL procedure successfully completed.
    SQL> desc emp
    Name                                                  Null?    Type
    EMPNO                                                 NOT NULL NUMBER
    DEPTNO                                                         NUMBER
    EMPNAME                                                        VARCHAR2(30)
    ADDRESS                                                        VARCHAR2(50)
    SQL> set linesize 1000
    SQL>
    SQL> select * from emp where rownum <= 5;
         EMPNO     DEPTNO EMPNAME                        ADDRESS
             1          2 EMPLOYEE 1                     ADDRESS 1
             2          3 EMPLOYEE 2                     ADDRESS 2
             3          4 EMPLOYEE 3                     ADDRESS 3
             4          5 EMPLOYEE 4                     ADDRESS 4
             5          6 EMPLOYEE 5                     ADDRESS 5
    SQL> drop table emp_new;
    Table dropped.Regards.

  • SAP Query column sequence for Totalling fields

    Hi all
    We have a custom query in 4.6C in which the output displays only the total of Totaling fields maintained in the sequence Amount > Withholding Tax > Net Amount  (all currency related fields).
    However after upgrade to ECC 6.0, we notice that we are no longer able to sequence the output list to Amount > Withholding Tax > Net Amount
    Though we maintain the Totaling fields in the sequence Amount > Withholding Tax > Net Amount , the list is generated in the sequence Amount > Net Amount > Withholding Tax  and the sequence is changed accordingly in the Basic List after a test display of the Output.
    Is anyone aware if the sequencing control is removed in ECC based for the Totaling Fields?
    Kindly help share.
    Thanks in Advance
    Vinodh S

    Hi Faheem,
    After changing the column sequence i clicked configuration button and click save button and again clicked Configuration and selected Administrative button there i can see the column sequence change and clicked activate button .now if i close and reopen the transaction my column sequence is same with out changes that i made .
    you asked me to save the changes where i can do exactly ? Could you please tell in briefway from scratch so that i can trace where i done mistake.
    Thanking you in advance.
    Regards,
    narasimha.

  • Table column sequence

    Hello WD-Experts,
    I have bind a table into WD dynpro using table UI-Element. The data will shown perfectly.
    My issue: I like to change the sequence of the different columns.
    Example:
    col1 col2 col3
    col3 col1 col2
    Changing the columns by track and drop is just visible in the ROOTUIELEMENTCONTAINER, but not in the layout itself.
    Has anybody an idea how i can change the column sequence?
    Thank you very much in advance.
    regards
    Axel

    Hi Axel,
    We can change the sequence of table column. For this Chose the Edit Mode for your view. Navigate to your Table UI element. Click on it so it shows you all the Columns. Now select a column u wish to move and just right click on that . u will see a option called up and down . With this u ws will move ur column in upper and downward direction. So by this u can change the sequence of any column in ur table.
    Regards
    Manoj kumar

  • Changed column sequence in Portal

    Hi,
    I have the following query:
                                  columns 0FISCPER
                                               Key Figures
                                                 0AMOUNT
    rows
    ZCUSTGR
    0GLACCOUNT
    - standard sorting options
    When I run query in BEx analyzer the sequence of the columns is fine. (001.2009, 002.2009 etc.)
    When I run it in portal (Web Application, Web Analyzer) the column sequence is changed.
    It seems like it is sorted by overall result in rows.
    Do you have any idea why such a thing happens?
    Thanks,
    Marek Krzeminski

    Hi,
    the sequence in the portal should be the same than in the bex analyzer. Can you give us some more details? Maybe you can try this with a very simple query - sometimes it makes it is easier to understand where the error is coming from. Maybe it also helps if you provide us with an example?
    Best regards,
    Janine

  • Change column sequence in MIRO layout.

    Hello All,
                         Can we change column sequence  in existing layout of miro.Please tell me.I am using OLMRLIST ,but can't make a change.
    Regards & Thanks
    Raj Jin

    HAi,
    Use 7_6310 as screen varient and change the layout and save.
    Regards,
    BSK

  • Can I change the Column Name without losing data and change the sequence

    Dear Experts,
    I want to change the column name without changing the sequence and dont want lose the data.

    Oracle Version : ?
    Example Based on 10g.
    SQL> conn scott/tiger
    Connected.
    SQL> create table col1 as select * from all_objects where rownum <= 100;
    Table created.
    SQL> alter table col1  add constraints col1_pk_objid primary key(object_id);
    Table altered.
    SQL> desc col1
    Name                                      Null?    Type
    OWNER                                              VARCHAR2(30)
    OBJECT_NAME                                        VARCHAR2(30)
    SUBOBJECT_NAME                                     VARCHAR2(30)
    OBJECT_ID                                 NOT NULL NUMBER
    DATA_OBJECT_ID                                     NUMBER
    OBJECT_TYPE                                        VARCHAR2(19)
    CREATED                                            DATE
    LAST_DDL_TIME                                      DATE
    TIMESTAMP                                          VARCHAR2(19)
    STATUS                                             VARCHAR2(7)
    TEMPORARY                                          VARCHAR2(1)
    GENERATED                                          VARCHAR2(1)
    SECONDARY                                          VARCHAR2(1)
    SQL> alter table col1 rename column object_id to object_no;
    Table altered.
    SQL> desc col1;
    Name                                      Null?    Type
    OWNER                                              VARCHAR2(30)
    OBJECT_NAME                                        VARCHAR2(30)
    SUBOBJECT_NAME                                     VARCHAR2(30)
    OBJECT_NO                                 NOT NULL NUMBER
    DATA_OBJECT_ID                                     NUMBER
    OBJECT_TYPE                                        VARCHAR2(19)
    CREATED                                            DATE
    LAST_DDL_TIME                                      DATE
    TIMESTAMP                                          VARCHAR2(19)
    STATUS                                             VARCHAR2(7)
    TEMPORARY                                          VARCHAR2(1)
    GENERATED                                          VARCHAR2(1)
    SECONDARY                                          VARCHAR2(1)
    SQL> column column_name format a30
      1  select column_name,constraint_name
      2  from user_cons_columns
      3  where table_name = 'COL1'
      4* and owner = 'SCOTT'
    COLUMN_NAME                    CONSTRAINT_NAME
    OBJECT_NO                      COL1_PK_OBJID
    SQL>
    also go through
    http://www.dizwell.com/prod/node/65
    Message was edited by:
    user52

  • WDA Table: Getting column sequence as it really is for the user

    Hi Folks!
    I need the current sequence of table columns as it really is for the user. He may have personalized his table: he may have removed some columns and may have changed the sequence of some columns. And this is what I need to know.
    But unfortunately so far I could only get the column sequence as it is defined in the View Layout using this coding:
      DATA lo_table TYPE REF TO cl_wd_table.
      DATA lo_table_columns TYPE cl_wd_table_column=>tt_table_column.
      DATA lo_table_column TYPE REF TO cl_wd_table_column.
      DATA lt_abstr_table_columns TYPE STANDARD TABLE OF REF TO cl_wd_abstr_table_column.
      DATA ls_abstr_table_column TYPE REF TO cl_wd_abstr_table_column.
      lo_table ?= wd_this->mv_view->get_element( 'RLTAB' ).
      lt_abstr_table_columns = lo_table->get_grouped_columns( ).
      LOOP AT lt_abstr_table_columns INTO ls_abstr_table_column.
        lo_table_column ?= ls_abstr_table_column.
      ENDLOOP.
    Thus: How to get the table column information as they are currently outside in the reald user world (only visible columns in the displayed sequence).
    Background: I need this information, because I want to export the table to excel and/or print it in exactly the state the user currently sees it (in personalized state).
    Thanx and points for any useful hints - ideally coding snippets!
    Regards,
    Volker

    Hi both!
    1) I have searched the framework like a mad man an dI think I will dream of all these IF_WD... and CL_WD... most having the useful information in protected or even private areas. A fact I cannot really understand.
    2) Although some kind of "criminal" I trewd to go the way in the second answer by creating child classes for cl_wd_abstr_table_column and cl_wd_table_column both containing the protected attribute PERSINDEX I need.
    I added a public class get_pers_index to the child classes. So far so good.
    But when I try to type-cast SAP standard instance to my instance vairables I get type-cast errors in both cases.
    Any ideas?
    Here's the relevant coding snippet:
    DATA lo_table TYPE REF TO cl_wd_table.
      DATA lo_table_columns TYPE cl_wd_table_column=>tt_table_column.
      DATA lo_table_column TYPE REF TO cl_wd_table_column.
      DATA lo_table_column2 TYPE REF TO /rand/cl_wd_table_column.
      DATA lt_abstr_table_columns TYPE STANDARD TABLE OF REF TO cl_wd_abstr_table_column.
      DATA ls_abstr_table_column TYPE REF TO cl_wd_abstr_table_column.
      data lo_abstr_table_column type ref to /rand/cl_wd_abstr_table_column.
      data lv_pers_index type i.
      lo_table ?= wd_this->mv_view->get_element( 'RLTAB' ).
      lt_abstr_table_columns = lo_table->get_grouped_columns( ).
      LOOP AT lt_abstr_table_columns INTO ls_abstr_table_column.
        lo_table_column ?= ls_abstr_table_column.                 "this casting is successful
        lo_table_column2 ?= lo_table_column.                      "this casting throws type-cast exception
        lv_pers_index = lo_table_column2->get_pers_index( ).
        lo_abstr_table_column ?= ls_abstr_table_column.           "this casting throws type-cast exception, too
        lv_pers_index = lo_abstr_table_column->get_pers_index( ).
      ENDLOOP.
    Any help very welcome.
    Thanx and Regards,
    Volker

  • BlockAxis.addExpr, BlockAxis.insertExpr, and column sequence

    Hi, the columns I create using the SDK are appearing in reports in an apparently random sequence.  It appears that just calling BlockAxis.addExpr does not cause columns to appear in the correct sequence.
    In addition, I've tried calling BlockAxis.addExpr(expresssion) once for my final column, then calling BlockAxis.insertExpr(expresssion, 0) repeatedly for subsequent columns (in reverse order from N-1 to 0). This changes the sequence, but the result still looks random to me.
    I recall a similar issue with object insert orders in the Universe Designer SDK.
    How do I control the column sequence when I build reports?
    Thanks, Eric

    Hello Eric,
    I don't see the behavior you do, and am wondering what axis setting you're using for your block.
    Here's a code snippet:
    cell = reportContainer.getReportBody().createFreeCell(" Free Cell ");
    cell.setX(20.0);
    cell.setY(10.0);
    cell.getFont().setName("Arial");
    cell.getFont().setSize(16);
    cell.getFont().setStyle(StyleType.BOLD);
    reportBlock = reportContainer.getReportBody().createBlock();
    reportBlock.setAttachTo(cell, VAnchorType.BOTTOM, HAnchorType.NONE);
    dictionary = doc.getDictionary();
    blockAxis = reportBlock.getAxis(TableAxis.HORIZONTAL);
    blockAxis.addExpr(dictionary.getChildByName("City"));
    blockAxis.addExpr(dictionary.getChildByName("Store name"));
    blockAxis.addExpr(dictionary.getChildByName("State"));
    documentInstance.applyFormat();
    and it appears to add cells to the Table Block in order in which the expressions were added.
    Sincerely,
    Ted Ueda

  • Change download columns from report

    Hi! I have a report, with some columns and I'd like to change the columns when downloading as csv file.
    Let's say that I have a report with col1,col2, col3,col4 and some hidden columns: col5, col6, col7. When I download the file I'd like to have only
    col2, col3, col6, col7.
    How can I do this?
    Thanks!

    Currently there is no way to do this. The CSV export function just re-runs the exact same report as you see it on the screen and transforms it to CSV format.
    Another option is to create a report with the columns you want in the CSV on another page, and use the export:CSV template as in
    http://tinypic.com/jzya2t.jpg
    and provide a link to that page. This will run that page and instead of showing the page it will popup the File download box.
    Hope this helps.

  • How to change the column value which is coming from DO by a calculated field?

    Hi all,
    I want to change a column value based on my calculated field value. I have a column which is coming from DO which is based on External Data Source. I have a calculated field in my report. When there is any change in the calculated field then the column which is coming from DO needs to be changed. It means the DO needs to get updated when there is a change in the calculated field. Or like if the calculated field meets some condition then I need to change/update the same in the DO. This has to be done on the fly. the report should not submitted for this. when there is a change in the calculated column the DO column needs to get updated.
    Thanks,
    Venky.

    Ok, I've been a customer for very many years, I'm on a fixed retirement
    income.  I need to reduce my bills, my contract ends in  Dec. I will be
    pursuing other options unless I can get some concessions from Verizon.  My
    future son-in-law was given this loyalty plan, so I know this is a
    reasonable request.  My phone number is (removed)  acct number
    (removed)
    >> Personal information removed to comply with the Verizon Wireless Terms of Service <<
    Edited by:  Verizon Moderator

  • How can i  change the column label text in a alv table display

    how can i change the column label text in a alv table display??
    A similar kinda of question was posted previuosly where the requirement was the label text was needed and following below code was given as solution :
    <i>*  declare column, settings, header object
    DATA: lr_column TYPE REF TO cl_salv_wd_column.
    DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings.
    DATA: lr_column_header type ref to CL_SALV_WD_COLUMN_HEADER.
    get column by specifying column name.
    lr_column = lr_column_settings->get_column( 'COLUMN_NAME1' ).
    set Header Text as null
    lr_column_header = lr_column->get_header( ).
    lr_column_header->set_text( ' ' ).</i>
    My specific requirement is i have an input field on the screen and i want reflect that value as the column label for one of the column in the alv table. I have used he above code with slight modification in the MODIFYVIEW method of the view since it is a process after input. The component gets activated without any errors but while run time i get an error stating
    <i>"The following error text was processed in the system CDV : Access via 'NULL' object reference not possible."</i>
    i have checked in debugging and the error occured at the statement :
    <i>lr_column = lr_column_settings->get_column( 'CURRENT_YEAR' ).</i>Please can you provide me an alternative for my requirement or correct me if i have done it wrong.
    Thanks,
    Suri

    I found it myself how to do it. The error says that it is not able to find the reference object i.e  it is asking us to refer to the table. The following piece of code will solve this problem. Have to implement this in WDDOMODIFYVIEW method of the view. This thing works comrades enjoy...
      DATA : lr_cmp_usage TYPE REF TO if_wd_component_usage,
             lr_if_controller  TYPE REF TO iwci_salv_wd_table,
             lr_cmdl   TYPE REF TO cl_salv_wd_config_table,
             lr_col    TYPE REF TO cl_salv_wd_column.
      DATA : node_year  TYPE REF TO if_wd_context_node,
             elem_year  TYPE REF TO if_wd_context_element,
             stru_year  TYPE if_alv_layout=>element_importing,
             item_year  LIKE stru_year-i_current_year,
             lf_string    TYPE char(x),
      DATA: lr_column TYPE REF TO cl_salv_wd_column.
      DATA: lr_column_header TYPE REF TO cl_salv_wd_column_header.
      DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings.
    Get the entered value from the input field of the screen
    node_year  = wd_context->get_child_node( name = 'IMPORTING_NODE' ).
    elem_year  = node_year->get_element( ).
      elem_year->get_attribute(
       EXPORTING
        name = 'IMPORT_NODE-PARAMETER'
       IMPORTING
        value = L_IMPORT_PARAM ).
      WRITE L_IMPORT_PARAM TO lf_string.
    Get the reference of the table
      lr_cmp_usage  =  wd_this->wd_cpuse_alv( ).
      IF lr_cmp_usage->has_active_component( ) IS INITIAL.
        lr_cmp_usage->create_component( ).
      ENDIF.
      lr_if_controller  = wd_this->wd_cpifc_alv( ).
      lr_column_settings = lr_if_controller->get_model( ).
    get column by specifying column name.
      IF lr_column_settings IS BOUND.
        lr_column = lr_column_settings->get_column( 'COLUMN_NAME').
    set Header Text as null
        lr_column_header = lr_column->get_header( ).
        lr_column_header->set_text( lf_string ).
    endif.

  • How can I change excel column header using Labile.

    Dear Experts,
                          How can i change excel column header using LabVIEW.
    Thanks for any and all help!
    M.S.Sivaraj.
    Sivaraj M.S
    CLD

    As I said in my previous post, column headers in Excel are merely row 1 cells. May be I missing something here, so please be more explicit with your question.
    I guess you are using the Excel Report tools, and you want to modify an existing sheet. From my limited experience with the Excel Report tools, it is not possible to open an existing woorkbook (except as template...), so the answer to your question should be "Forget it"...
    The work around is to use the example I pointed for you before, and either to write the whole new colum headers as a string array, starting in A1, or to write a single string to a given cell in row 1.
    Hope this helps 
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

Maybe you are looking for

  • Scroll bars in Mac OS X 10.7.3

    I am using Mac OS X 10.7.3 and I don't like current style of scroll bars - I know it can be done to show them always, but the problem is that they're ugly - grey, narrow, just ugly. I love previous version of scroll bars - aqua blue ones. Is there a

  • IWeb/FrontPage quick question

    Hi all: -I have a friend who has a website she designed in MS FrontPage -I need to take ownership of only one of the pages within her website If I design the page in iWeb, designate the URL of the particular page within her site (which will now conta

  • ADL Not Launching

    I"m not sure why, but all of the sudden my ADL stopped working. FB produces the following message upon debugging: Process terminated without establishing connection to debugger. Command: "/Applications/Adobe Flex Builder 3 Plug-in/sdks/3.2.0/bin/adl"

  • J1IIN posting

    Hello guru's, I observed that Excise entry has not posted during the billing i.e VF01, so we are trying to post it by using J1IIN. is it correct way to post excise entry? If it is correct way, I am not able to post the Excise entry by using t.code :

  • Persistent Location of Media Cache Files?

    I am on Mac OS 10.6.6 and I have an SSD as a boot drive and therefore I try to keep it clear of as much data as possible. It's 240GB but it fills up fairly quick. One thing I've done several times is set the location of the Adobe Media cache and data