08-02-2005 2:44 PM
Hi All,
Is there a way by which we can disable a row in an ALV grid display.Suppose we have three rows,can we disable the second row only and keep the rest two enabled for editing.
Thanks in advance
Nishanth
08-02-2005 3:12 PM
Hi, of course. you can
There is a way to set the cell of ALV editable or not.
By this way, you can set every cell of row 2 to be uneditable. In addition, this solution is for OO ALV
List as following:
Add a field into your outtab of ALV
like this:
TYPES: BEGIN OF TYP_TEST,
FLD_A(10) TYPE C,
FLD_B(10) TYPE C,
FLD_C(10) TYPE C,
FLD_STYL TYPE LVC_T_STYL,
END OF TYP_TEST.
Set the layout structure
V_LAYOUT-STYLEFNAME = 'FLD_STYL'.
call method, it is necessary
CALL METHOD V_GRID->SET_READY_FOR_INPUT
EXPORTING I_READY_FOR_INPUT = 1.
if we have two field in ALV, named 'FLD_B', 'FLD_C'
then do like this:
LOOP AT IT_TEST INTO FLD_TEST.
IF SY-TABIX = 2.
WA_CELLSTYLE-FIELDNAME = 'FLD_B'.
WA_CELLSTYLE-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_ENABLED.
APPEND WA_CELLSTYLE TO FLD_TEST-FLD_STYL.
WA_CELLSTYLE-FIELDNAME = 'FLD_C'.
WA_CELLSTYLE-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_ENABLED.
APPEND WA_CELLSTYLE TO FLD_TEST-FLD_STYL.
MODIFY IT_TEST FROM FLD_TEST.
ENDIF.
ENDLOOP.
At last, call like this
CALL METHOD V_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING IS_LAYOUT = V_LAYOUT
CHANGING IT_OUTTAB = IT_TEST
IT_FIELDCATALOG = IT_FIELD.
Then, in the second rows of IT_TEST, the field 'FLD_B', 'FLD_C' is editable, 'FLD_A' is uneditable
That's all steps, hope it will be helpful
08-02-2005 3:12 PM
Hi, of course. you can
There is a way to set the cell of ALV editable or not.
By this way, you can set every cell of row 2 to be uneditable. In addition, this solution is for OO ALV
List as following:
Add a field into your outtab of ALV
like this:
TYPES: BEGIN OF TYP_TEST,
FLD_A(10) TYPE C,
FLD_B(10) TYPE C,
FLD_C(10) TYPE C,
FLD_STYL TYPE LVC_T_STYL,
END OF TYP_TEST.
Set the layout structure
V_LAYOUT-STYLEFNAME = 'FLD_STYL'.
call method, it is necessary
CALL METHOD V_GRID->SET_READY_FOR_INPUT
EXPORTING I_READY_FOR_INPUT = 1.
if we have two field in ALV, named 'FLD_B', 'FLD_C'
then do like this:
LOOP AT IT_TEST INTO FLD_TEST.
IF SY-TABIX = 2.
WA_CELLSTYLE-FIELDNAME = 'FLD_B'.
WA_CELLSTYLE-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_ENABLED.
APPEND WA_CELLSTYLE TO FLD_TEST-FLD_STYL.
WA_CELLSTYLE-FIELDNAME = 'FLD_C'.
WA_CELLSTYLE-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_ENABLED.
APPEND WA_CELLSTYLE TO FLD_TEST-FLD_STYL.
MODIFY IT_TEST FROM FLD_TEST.
ENDIF.
ENDLOOP.
At last, call like this
CALL METHOD V_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING IS_LAYOUT = V_LAYOUT
CHANGING IT_OUTTAB = IT_TEST
IT_FIELDCATALOG = IT_FIELD.
Then, in the second rows of IT_TEST, the field 'FLD_B', 'FLD_C' is editable, 'FLD_A' is uneditable
That's all steps, hope it will be helpful