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: 

need method to disable checkbox

Former Member
0 Kudos

Hi,

My alv Grid report contains checkbox at end of each row, when ever user select the checkbox , I am taking the particular line to internal Table by using below code.

DATA cl_gui_alv_grid TYPE REF TO cl_gui_alv_grid.

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

e_grid = cl_gui_alv_grid.

CALL METHOD cl_gui_alv_grid->check_changed_data.

My problem is whenever user selects the checkbox the checkbox should go Gray(Disabled).

Is there any method to do this, If so pls give sample code.

I tried with SET_VISIBLE, but not working

I am using version 4.6C

Thanks

kar

Edited by: karthik karthik on Jan 9, 2008 7:52 PM

2 REPLIES 2

Former Member
0 Kudos

Hi Karthik,

You can use this method cl_gui_alv_grid=>mc_style_disabled

For example go through the program BCALV_EDIT_05

In this program output ,If you double click on the check box it will be disabled , You can try the same logic in your program

Regards Rk

Former Member
0 Kudos

hi karthik,

this may be helpful to u

You have to have in the Output Table:

Types: begin of lt_io.

include structure mara. " Your Structure

Types: style_table type lvc_t_style.

Types: end of lt_io.

data: lt_io type table of lt_io,

ls_layout type lvc_s_layo,

lt_fcat type lvc_t_fcat,

lo_grid type ref to cl_gui_alv_grid.

field-symbols: <io> type lt_io,

<fcat> type lvc_s_fcat.

... fill your output table ....

ls_layout-stylefname = 'STYLE_TABLE'.

loop at lt_io assigning <io>.

PERFORM set_style USING 'CHECKBOX' "Your Filename

CHANGING <io>.

endloop.

... Fill Your Field Catalog lt_fcat

read table lt_fcat assigning <fcat>

where fieldname = 'CHECKBOX'.

<fcat>-checkbox = 'X'.

...

create grid control lo_grid.

...

CALL METHOD lo_grid->set_table_for_first_display

EXPORTING

is_layout = ls_layout

CHANGING

it_fieldcatalog = lt_fcat

it_outtab = lt_io[].

...

FORM set_style

USING iv_fieldname TYPE lvc_fname

CHANGING cs_io TYPE io.

DATA: ls_style TYPE lvc_s_styl,

lt_style TYPE lvc_t_styl.

ls_style-fieldname = iv_fieldname.

if cs_io-checkbox = ' '.

ls_style-style = cl_gui_alv_grid=>mc_style_enabled.

else.

ls_style-style = cl_gui_alv_grid=>mc_style_disabled.

endif.

ls_style-maxlen = 2.

INSERT ls_style INTO TABLE io-style_table.

ENDFORM. "set_style

regards,

sravanthi