2009 Feb 04 5:02 AM
Hi,
I have a ALV with 17 rows and i need to make Rows 12 - 17 non-editable ,
i tried it using the following code
LOOP AT i_output INTO wa_i_output.
IF sy-tabix GT 12.
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled. "set field to disabled
APPEND ls_stylerow TO wa_i_output-field_style.
MODIFY i_output FROM wa_i_output.
ENDIF.
ENDLOOP.But i am not getting the desired result.
Any help regarding this will be greatly appreciated.
Rgds,
K
2009 Feb 04 5:19 AM
Hi Ken
Try this
LOOP AT i_output INTO wa_i_output.
IF sy-tabix GE 12.
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled. "set field to disabled
APPEND ls_stylerow TO lt_styletab.
INSERT LINES OF lt_styletab INTO ls_listrow-cellstyles .
MODIFY i_output FROM ls_listrow.
ENDIF.
ENDLOOP.
Pushpraj
Hi,
I have a ALV with 17 rows and i need to make Rows 12 - 17 non-editable ,
i tried it using the following code
LOOP AT i_output INTO wa_i_output.
IF sy-tabix GT 12.
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled. "set field to disabled
APPEND ls_stylerow TO wa_i_output-field_style.
MODIFY i_output FROM wa_i_output.
ENDIF.
ENDLOOP.But i am not getting the desired result.
Any help regarding this will be greatly appreciated.
Rgds,
K
2009 Feb 04 5:08 AM
2009 Feb 04 5:12 AM
Hi,
If u want to disable some rows in an alv grid, than u can specify the row in fieldcatalog as edit ' '.
This will make the specified rows as disabled.
thank u.
2009 Feb 04 5:18 AM
2009 Feb 04 5:19 AM
Hi Ken
Try this
LOOP AT i_output INTO wa_i_output.
IF sy-tabix GE 12.
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled. "set field to disabled
APPEND ls_stylerow TO lt_styletab.
INSERT LINES OF lt_styletab INTO ls_listrow-cellstyles .
MODIFY i_output FROM ls_listrow.
ENDIF.
ENDLOOP.
Pushpraj
2009 Feb 04 5:34 AM
Hi Pushparaj,
Its getting a dump. I think the insert statement aint correct.
Any suggestions??
Rgds,
K.
2009 Feb 04 5:51 AM
Hi Ken
Try this
LOOP AT i_output INTO wa_i_output.
IF sy-tabix GE 12.
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled. "set field to disabled
APPEND ls_stylerow TO lt_styletab.
INSERT LINES OF lt_styletab INTO TABLE wa_i_output-i_cellstyles.
ENDIF.
ENDLOOP.
i_cellstyles is to be passed like this in the layout structure
ls_layout-stylefname = 'I_CELLSTYLES'.
Pushpraj
2009 Feb 04 6:09 AM
Thanks Pushparaj. It really helped to solve our issue.
Rgds,
K.
2009 Feb 04 5:29 AM
Try this way..
DATA: BEGIN OF t_vbrk OCCURS 0.
INCLUDE STRUCTURE zsvbrk.
DATA: status TYPE statusicon30.
DATA: modify TYPE statusicon30.
DATA: cltab TYPE lvc_t_styl. """Add field for cell style
DATA: messages TYPE lvc_t_msg1.
DATA: row_no TYPE lvc_s_roid-row_id.
DATA: END OF t_vbrk.
PERFORM set_style TABLES t_vbrk[].
&----
*& Form set_style
&----
text
----
-->P_T_VBRK[] text
----
FORM set_style TABLES p_t_vbrk STRUCTURE t_vbrk.
DATA: lt_cell TYPE lvc_t_styl,
l_ind TYPE i.
LOOP AT p_t_vbrk .
l_ind = sy-tabix.
PERFORM fill_tab USING 'RO' CHANGING lt_cell.
INSERT LINES OF lt_cell INTO TABLE p_t_vbrk-cltab.
p_t_vbrk-row_no = l_ind.
MODIFY p_t_vbrk INDEX l_ind.
ENDLOOP.
ENDFORM.
&----
*& Form FILL_TAB
&----
text
----
-->P_0239 text
<--P_LT_CELL text
----
FORM fill_tab USING value(p_mode)
CHANGING p_lt_cell TYPE lvc_t_styl.
DATA: ls_cell TYPE lvc_s_styl,
l_mode TYPE raw4.
IF p_mode = 'RW'.
l_mode = cl_gui_alv_grid=>mc_style_enabled.
ELSE.
l_mode = cl_gui_alv_grid=>mc_style_disabled.
ENDIF.
ls_cell-fieldname = 'MANDT'.
ls_cell-style = l_mode.
INSERT ls_cell INTO TABLE p_lt_cell.
ls_cell-fieldname = 'VBELN'.
ls_cell-style = l_mode.
INSERT ls_cell INTO TABLE p_lt_cell.
ENDFORM. " FILL_TAB
Hope this solve ur problem..
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |