Skip to Content
author's profile photo Former Member
Former Member

How to make cells editable or non editable based on the other column cells?

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jan 04, 2008 at 10:31 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.