Application Development and Automation 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: 
Read only

Dynamically hiding Table Control Column?

Former Member
0 Likes
1,070

Hi,

How can one dynamically hide a column of a given table control? Say youhave a three-column table and at run time you only want to show columns1 and 3. How do you hide column 2 programmatically?

Regards,

Pranshu

6 REPLIES 6
Read only

gopi_narendra
Active Contributor
0 Likes
955
loop at screen.
  if screen-name = 'SCREEN_FIELD2'.  " Column 2
    screen-active = 0.
    modify screen.
  endif.
endloop.

This set of statements should be incluced in the PBO of the table control loop module...

Regards

Gopi

Read only

0 Likes
955

Hi Gopi,

I think you have not read the query properly , it is about hiding a column in table control not on screen

Loop at screen will never work on table control.

Regards,

Pranshu

Read only

0 Likes
955

so , did u mean that u dont have a screen for a table control,

if so how did u place ur table control. and where?

Generally a table control is placed on a screen.

see the below examples

DEMO_DYNPRO_TABCONT_LOOP

DEMO_DYNPRO_TABCONT_LOOP_AT

PROCESS BEFORE OUTPUT.
  MODULE STATUS_0100.
  LOOP WITH CONTROL FLIGHTS. " assuming FLIGHTS is the table control name.
    MODULE FILL_TABLE_CONTROL.
  ENDLOOP.

Now in the module fill_table_Control , you should be writing the code which i mentioned in my above post.

Regards

Gopi

Read only

0 Likes
955

Hi,

put an 'X' in the no_out field of the field catalog of your alv for each column that you want hidden. do this on the PBO module of your program.

Regars,

Peter

Read only

Former Member
0 Likes
955

hi,

we have a type group for table control ...

cxtab ...

CXTAB_CONTROL type scxtab_control,

just double click on ... scxtab_control,

double click on cols ... u get all the field relating to Columns of Table control ...

Just mention in the PBO ...

loop at screen.

if cols-index = 2.

cols-invisible = 'X'.

endif.

Read only

Former Member
0 Likes
955

Hi Pranshu,

we can disable the column by making it display only

Now assume the name of your table control is ZTABLECONT..double click on the screen painter on the table control..these 2 names must be the same....

if you need to disable columns of table control as a part of user action..like say click of a button..it can be entered in PAI by checking the sy-ucomm

data declaration:

data : cols like line of ZTABLECONT-cols.

Case sy-ucomm.

when 'PUSH'.

loop at ZTABLECONT-cols into cols.

if cols-screen-input = '1'.

cols-screen-input = '0'.

endif.

modify ZTABLECONT-cols from cols index sy-tabix.

endloop.

endcase.

This will disable all the columns

for a particular column do the following

For this imagine you have 5 columns

in the below code

index = 1 => column 1

index = 2 => column 2

index = 3 => column 3

index = 4 => column 4

index = 5 => column 5

in the below code , only column2 will be disabled....

so whicever column you want to disable ..just give the index

for multiple disabling..just write the code accordingly

LOOP AT ZTABLECONT-cols INTO cols WHERE index = 2.

IF cols-screen-input = '1'.

cols-screen-input = '0'.

ENDIF.

MODIFY ZTABLECONT-cols FROM cols INDEX sy-tabix.

ENDLOOP.

Pls check and revert...the code works and is being used in active code and close the thread if issue is solved

<REMOVED BY MODERATOR>

Regards

Byju

Edited by: Alvaro Tejada Galindo on Apr 14, 2008 6:24 PM