‎2008 Jun 14 8:10 AM
CALL METHOD gr_alvgrid->get_selected_rows
IMPORTING
et_row_no = lt_selected_rows.
LOOP AT lt_selected_rows INTO ls_selected_row.
REFRESH lt_styletab.
READ TABLE i_output INTO ls_listrow INDEX ls_selected_row-row_id.
IF sy-subrc = 0 .
ls_stylerow-fieldname = 'ZZ_ACC_ASSGN'.
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled .
APPEND ls_stylerow TO lt_styletab .
CLEAR ls_stylerow.
ls_stylerow-fieldname = 'ZZ_DEPT_NAME' .
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled .
APPEND ls_stylerow TO lt_styletab .
CLEAR ls_stylerow.
ls_stylerow-fieldname = 'ZZ_ROOM_NR' .
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled .
APPEND ls_stylerow TO lt_styletab .
CLEAR ls_stylerow.
ls_stylerow-fieldname = 'ZZ_LOC' .
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled .
APPEND ls_stylerow TO lt_styletab .
CLEAR ls_stylerow.
ENDIF .
APPEND LINES OF lt_styletab TO ls_listrow-cellstyles.
MODIFY i_output FROM ls_listrow INDEX ls_selected_row-row_id TRANSPORTING cellstyles.
ENDLOOP.Hi I have given the code as above to disable my fields. But I am getting a runtime error as "A line is to be inserted or changed at position 3 in the sorted
internal table (type SORTED_TABLE)
"\PROGRAM=ZIAB_E_03_COPY\FORM=S_DISABLE_FIELDS\DATA=LT_STYLETAB".
In doing so, the sorting sequence - determined by the table key - was
destroyed."
Do anybody know wat it is??
‎2008 Jun 14 8:24 AM
Please, replace the APPEND statement with INSERT statement and check if it works.
Regards,
Rajesh.
‎2008 Jun 14 8:29 AM
‎2008 Jun 14 8:37 AM
HI,
TRY OUT THIS REFRESH AND CHECK.
REFRESH listrow-cellstyles.
APPEND LINES OF lt_styletab TO ls_listrow-cellstyles.
MODIFY i_output FROM ls_listrow INDEX ls_selected_row-row_id TRANSPORTING cellstyles.
ENDLOOP.
RAJ
Edited by: Raj D on Jun 14, 2008 9:37 AM
‎2008 Jun 14 11:59 AM
Hi Sharan,
the syntax for inserting into SORTED tables is
INSERT ls_stylerow INTO TABLE lt_styletab
You must use the TABLE keyword!
Regards,
Clemens