07-05-2006 1:44 PM
Hi,
I am using the REUSE_ALV_GRID_DISPLAY_LVC function to display a grid. In this grid I have some columns containing checkboxes that are editable. But, depending on some data in de records that I show, some of these checkboxes should be non-editable. Does anyone of you have an idea how to do this?
regards,
Henk
07-05-2006 2:21 PM
Hi,
add the field to the table declaration.
DATA cellstyles TYPE lvc_t_styl .
now tell the layout about this styling field.
ps_layout-stylefname = CELLSTYLES.
DATA ls_listrow LIKE LINE OF pt_list(the displayed table) .
DATA ls_stylerow TYPE lvc_s_styl .
DATA lt_styletab TYPE lvc_t_styl .
here the seatmax(carrid) is not editable if the value is'XY' and planetype(connid) is editable if the value is '02'
LOOP AT pt_list INTO ls_listrow .
IF ls_listrow-carrid = 'XY' .
ls_stylerow-fieldname = 'SEATSMAX' .
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled .
APPEND ls_stylerow TO lt_styletab .
ENDIF .
IF ls_listrow-connid = '02' .
ls_stylerow-fieldname = 'PLANETYPE' .
ls_stylerow-style = cl_gui_alv_grid=>mc_style_enabled .
APPEND ls_stylerow TO lt_styletab .
ENDIF .
INSERT LINES OF lt_styletab INTO ls_listrow-cellstyles .
MODIFY pt_list FROM ls_listrow .
ENDLOOP .
hope this helps.
regards,
vidya.
07-05-2006 2:14 PM
Usually this is done something like this.
Add a column STYLE TYPE LVC_T_STYL to your internal table. This becomes a nested internal table. Now, for each row of the internal table, fill up the STYLE table with each column and the style as CL_GUI_ALV_GRID=>MC_STYLE_ENABLED OR CL_GUI_ALV_GRID=>MC_STYLE_DISABLED. This will make sure that the selective columns of specific rows are enabled for editing.
Regards,
Ravi
Note : Please mark all the helpful answers
07-05-2006 2:21 PM
Hi,
add the field to the table declaration.
DATA cellstyles TYPE lvc_t_styl .
now tell the layout about this styling field.
ps_layout-stylefname = CELLSTYLES.
DATA ls_listrow LIKE LINE OF pt_list(the displayed table) .
DATA ls_stylerow TYPE lvc_s_styl .
DATA lt_styletab TYPE lvc_t_styl .
here the seatmax(carrid) is not editable if the value is'XY' and planetype(connid) is editable if the value is '02'
LOOP AT pt_list INTO ls_listrow .
IF ls_listrow-carrid = 'XY' .
ls_stylerow-fieldname = 'SEATSMAX' .
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled .
APPEND ls_stylerow TO lt_styletab .
ENDIF .
IF ls_listrow-connid = '02' .
ls_stylerow-fieldname = 'PLANETYPE' .
ls_stylerow-style = cl_gui_alv_grid=>mc_style_enabled .
APPEND ls_stylerow TO lt_styletab .
ENDIF .
INSERT LINES OF lt_styletab INTO ls_listrow-cellstyles .
MODIFY pt_list FROM ls_listrow .
ENDLOOP .
hope this helps.
regards,
vidya.
07-05-2006 3:01 PM