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: 

Edit one column in table control

Former Member
0 Kudos
1,764

Hey guys,

Could you pls tell me how to make one particular column editable and non-editable one.

i have done before..but could not recall how i did..

could you pls..guide..

ambichan

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
464

You can do this statically, in screen painter by double clicking the field of table control, uncheck the "Input Field" attribute.

You can do this dynamically at runtime, by modifying the table control.



* Here you are looping at the columns of table control 
* itself, not the internal table which is used in the 
* table control.
* This table has a structure, here we are looping at
* the columns(cols) of the table control.
* You can set them as INPUT = 1 or INPUT = 0.

   loop at i_pidetcon-cols into cols where index gt 0.

        if  cols-screen-group1 = 'GP1'
          and cols-screen-input = '0'.
          cols-screen-input = '1'.
        elseif  cols-screen-group1 = 'GP1'
           and cols-screen-input = '1'.
          cols-screen-input = '0'.
        endif.
        modify i_pidetcon-cols from cols index sy-tabix.
    endloop.

Regards,

Rich Heilman

6 REPLIES 6

Vinod_Chandran
Active Contributor
0 Kudos
464

H,

You can find the answer in this post.

Thanks

Vinod

Former Member
0 Kudos
464

Hi,

This code hides a column in a table control.

FORM SUPRESS_TAB_CONTROL using sprfield.

data: fields type CXTAB_COLUMN.

loop at screen_0300-cols into fields.

if fields-screen-name = sprfield.

fields-invisible = 1.

MODIFY screen_0300-COLS FROM fields.

endif.

endloop.

ENDFORM.

Svetlin

RichHeilman
Developer Advocate
Developer Advocate
465

You can do this statically, in screen painter by double clicking the field of table control, uncheck the "Input Field" attribute.

You can do this dynamically at runtime, by modifying the table control.



* Here you are looping at the columns of table control 
* itself, not the internal table which is used in the 
* table control.
* This table has a structure, here we are looping at
* the columns(cols) of the table control.
* You can set them as INPUT = 1 or INPUT = 0.

   loop at i_pidetcon-cols into cols where index gt 0.

        if  cols-screen-group1 = 'GP1'
          and cols-screen-input = '0'.
          cols-screen-input = '1'.
        elseif  cols-screen-group1 = 'GP1'
           and cols-screen-input = '1'.
          cols-screen-input = '0'.
        endif.
        modify i_pidetcon-cols from cols index sy-tabix.
    endloop.

Regards,

Rich Heilman

0 Kudos
464

Hay Rich,

Thanks for your reply..it worked out.

You peoples reply really great.Thanks.

ambichan

0 Kudos
464

Please make sure to award points to the posts which helped you solve the problem and mark this post as solved. Thanks.

Regards,

Rich Heilman

Former Member
0 Kudos
464

Hi, you can adjust the column attribute of table control in the PBO. like following:

CONTROLS: TABCTRL TYPE TABLEVIEW USING SCREEN XXXX.

DATA: COLUMN TYPE CXTAB_COLUMN.

LOOP AT TABCTRL-COLS INTO COLUMN.

  • set the column name here which you want to populate

  • it's attribute

if column-screen-name = 'XXXX'.

COLUMN-SCREEN-input = (space)/('X').

MODIFY TABCTRL-COLS FROM COLUMN.

endif.

ENDLOOP.

Hope it will be helpful

thanks a lot