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 make cells editable or non editable based on the other column cells?

Former Member
0 Kudos

Hi all,

I have two ALV Columns say Column 'A' and column 'B'.

Both columns are check boxes only.As soon as I execute the report,Screen 100 comes with Columns 'A' and 'B'.

Column 'B' will always be in disable mode.But some cells in Column 'B' will be checked and some cells will be unchecked.

Based on the status of the column 'B' cells,Column 'A' cells should be in either enabled mode(if correponding 'B' cell is checked)or disabled mode(if correspondng 'B' cell is unchecked)

Remember the entire Column 'B' will always be in disabled mode only .

Finally I want the cells of 'A' to be either in enabled or disabled mode based on the 'B' cells. Remember the entire Column 'B' will always be in disabled mode only.

Any code please.....?

Thanks,

Balaji

2 REPLIES 2

mnicolai_77
Active Participant
0 Kudos

hi,

to make editable and not editable some cells you have to do the following modification to your code:

1 - extend the structure of your table with one more filed

>data: begin of outtab occurs 0,

> Column_A type xfeld,

> Column_B type xfeld,

> style TYPE lvc_t_styl,

> end of outtab.

2 - set value 'STYLE' into the field stylefname of strucure typed lvc_s_layo.

>data: ls_layo type lvc_s_layo.

>lvc_s_layo-stylefname = 'STYLE'.

3 - in the fieldcatlog set editable the column A

4 - loop to your table and set the style of evry single cell

>data: ls_style type lvc_s_styl.

>loop at outtab.

>if column_b = space.

>ls_style-fieldname = 'COLUMN_A'.

>ls_style-style = cl_gui_alv_grid=>mc_style_disabled.

>append ls_style to outtab-style.

>clear ls_style.

>else.

>clear outtab-style.

>endif.

>modify outtab.

>endloop.

5 - disply ALV.

for more example see [https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/abap-changing%2bcell%2bcharacteristics%2bin%2balv%2b(OOPS)]

bye

Marco

0 Kudos

Marco,

thank you very much.

Thanks,

Balaji