Skip to Content
author's profile photo
Former Member

Remove a column(Make Invisible) in table control

Hi Friends,

I am developing a dialog proramming and want to not show a column to user. This column is a key column and user should not see this column. how can I do my desire?

Thanks.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • author's profile photo
    Former Member
    Posted on Sep 27, 2007 at 01:48 PM

    this is default component called COLS in table control.

    By using cols, u can get a column,

    and use

    screen-invisible = 1.

    modify screen.

    for hiding the column.

    <b>pls reward if helpful.</b>

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Shori,

      After your suggestion I have written this code;

      loop at table_test-cols into screen.

      if screen-name = 'ITAB-MYCOL'.

      screen-invisible = 1.

      modify table_test-cols from screen.

      endif.

      endloop.

      But, After this program gives dump error. 😔

  • author's profile photo
    Former Member
    Posted on Sep 27, 2007 at 02:19 PM

    Hi,

    hope it will be helpful to you.

    Components of CXTAB_COLUMN

    Each column of the table control corresponds to a row of the table CXTAB_COLUMN. The internal table CXTAB_COLUMN has no header line and the following columns:

    Components are:- SCREEN,INDEX,SELECTED,VISLENGTH and INVISIBLE

    SCREEN

    Structure for the attributes of screen elements of the column (see below).

    INDEX

    Current position of the column in the table control. Transfered with initial value from Screen Painter. At PAI the current column configuration of the table control is withdrawn. Can be changed in the ABAP program.

    SELECTED

    Flag (X or blank) whether column is selected or not. At PAI the current status of the table control is withdrawn. Can be changed in the ABAP program.

    VISLENGTH

    Visible length of the column. Transferred from Screen Painter. Can be changed in the ABAP program.

    INVISIBLE:

    type : C(1)

    Flag (X or blank) whether column is visible. Transferred from Screen Painter. Can be changed in the ABAP program.

    have a look at this code

    1. define group name(s) for the columns to be hidden

    2. Add the following code...

    (define)

    controls tbl_ctrl type tableview ...

    wa like tbl_ctrl-cols.

    loop at tbl_ctrl-cols into wa.

    if wa-screen-group1 = <group defined for the column>

    wa-invisible = 1.

    modify tbl_ctrl-cols from wa

    endif

    endloop

    See the below link for more info..

    http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbac9f35c111d1829f0000e829fbfe/content.htm

    Thanks & regards,

    Rajesh

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 27, 2007 at 09:04 PM

    This is an example for the 1st (i.e. leftmost) column of the table control TABLE_CONTROL:

    CONTROLS: table_control TYPE TABLEVIEW USING SCREEN 0100.
    
    DATA: s_cols TYPE cxtab_column,
              s_screen TYPE screen.
    
        LOOP AT table_control-cols INTO s_cols.
          IF s_cols-index = 1.
            MOVE s_cols-screen TO s_screen.
            s_screen-invisible = 1.
            MOVE s_screen TO s_cols-screen.
            MODIFY table_control-cols FROM s_cols.
          ENDIF.
        ENDLOOP.

    Add comment
    10|10000 characters needed characters exceeded