02-19-2007 5:45 AM
Hi everyone,
I am using an editable ALV grid display where the user can enter his data. Once I update the data, I need to check for one field whether it is zero or not. For whichever row it is zero, i need to display the whole row as editable otherwise in non-editable mode... Hope I am clear in explaining.
-SatyaPriya
02-19-2007 6:28 AM
Hi ,
Create a perform as below .Assume gt_list is output table
and carrid is field where the value is zero
FORM adjust_editables USING pt_list LIKE gt_list[] .
DATA ls_listrow LIKE LINE OF pt_list .
DATA ls_stylerow TYPE lvc_s_styl .
DATA lt_styletab TYPE lvc_t_styl .
LOOP AT pt_list INTO ls_listrow .
IF ls_listrow-carrid = 0
ls_stylerow-fieldname = 'SEATSMAX' .
ls_stylerow-style = cl_gui_alv_grid=>mc_style_enabled .
APPEND ls_stylerow TO lt_styletab .
else.
.ls_stylerow-fieldname = 'SEATSMAX' .
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled. .
endif.
INSERT LINES OF lt_styletab INTO ls_listrow-cellstyles .
MODIFY pt_list FROM ls_listrow .
ENDLOOP .
add the following line in the layout workarea.
ps_layout-stylefname = CELLSTYLES
Please reward if useful.