Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Remove a column(Make Invisible) in table control

Former Member
0 Kudos

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.

4 REPLIES 4

Former Member
0 Kudos

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>

0 Kudos

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.

Former Member
0 Kudos

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

Jelena
Active Contributor
0 Kudos

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.