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: 

How to control visibility of table control colum

Former Member
0 Kudos

Hi Experts

Any one has experience on controlling visibility of table control column? for example, the table control originally has 10 column, according to different flag, the table control will only show column 5-10 at runtime.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Use the code below.

DATA: it_cols TYPE STANDARD TABLE OF CXTAB_COLUMN
WITH HEADER LINE WITH NON-UNIQUE DEFAULT KEY,
wa_cols TYPE STANDARD TABLE OF CXTAB_COLUMN.

1. in a pbo module

** TC is the table control

it_cols[] = tc-cols[].
loop at it_cols into wa_cols.
if wa_cols-screen-group1 = 'INV'. 
wa_cols-invisible = 1.
else.
wa_cols-invisible = 0.
endif.
modify it_cols from wa_cols index sy-tabix.
endloop.

1 REPLY 1

Former Member
0 Kudos

Use the code below.

DATA: it_cols TYPE STANDARD TABLE OF CXTAB_COLUMN
WITH HEADER LINE WITH NON-UNIQUE DEFAULT KEY,
wa_cols TYPE STANDARD TABLE OF CXTAB_COLUMN.

1. in a pbo module

** TC is the table control

it_cols[] = tc-cols[].
loop at it_cols into wa_cols.
if wa_cols-screen-group1 = 'INV'. 
wa_cols-invisible = 1.
else.
wa_cols-invisible = 0.
endif.
modify it_cols from wa_cols index sy-tabix.
endloop.