Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Disabling fields

Former Member
0 Likes
551
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??

4 REPLIES 4
Read only

Former Member
0 Likes
527

Please, replace the APPEND statement with INSERT statement and check if it works.

Regards,

Rajesh.

Read only

Former Member
0 Likes
527

I checked with INSERT also. It is telling me the same error.

Read only

0 Likes
527

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

Read only

Clemenss
Active Contributor
0 Likes
527

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