2006 Sep 27 12:17 PM
Hi all
I am using the abap class implementation of an alv. I have a problem that occurs when I enter a cell value and hit return the focus goes back to the first row.
e.g. i enter a value on row 50 and the focus jumps back to row 1.
Any help would be greatly appreciated
Thanks
2006 Sep 27 12:19 PM
Dareen
Write the below code in the program (In the handle_data_changed event). It will keep the scroll bar in the same place.
Concept behind this code is, after the data is changed we will call refresh_table_display. If u call like that the ALV will get refreshed so the cursor goes to the first cell. But before refreshing the ALV get the current cell using <b>get_current_cell</b> and get the scroll information using <b>get_scroll_info_via_id</b>. Then refresh the ALV and again set the current cell using <b>set_current_cell_via_id</b>.
DATA: li_rows TYPE lvc_s_roid,
li_col TYPE lvc_s_col,
lws_row_id TYPE lvc_s_roid,
lws_col_id TYPE lvc_s_col,
ls_col TYPE lvc_s_col,
ls_num TYPE lvc_s_roid.
CALL METHOD o_alvgrid->get_current_cell
IMPORTING
es_col_id = li_col
es_row_no = li_rows.
CALL METHOD o_alvgrid->get_scroll_info_via_id
IMPORTING
es_col_info = ls_col
es_row_no = ls_num.
CALL METHOD o_alvgrid->refresh_table_display.
CALL METHOD o_alvgrid->set_scroll_info_via_id
EXPORTING
is_col_info = ls_col
is_row_no = ls_num.
lws_row_id-row_id = li_rows-row_id.
lws_col_id-fieldname = li_col-fieldname.
CALL METHOD o_alvgrid->set_current_cell_via_id
EXPORTING
is_column_id = lws_col_id
is_row_no = lws_row_id.
Regards,
Prakash.
Hi all
I am using the abap class implementation of an alv. I have a problem that occurs when I enter a cell value and hit return the focus goes back to the first row.
e.g. i enter a value on row 50 and the focus jumps back to row 1.
Any help would be greatly appreciated
Thanks
2006 Sep 27 12:19 PM
Dareen
Write the below code in the program (In the handle_data_changed event). It will keep the scroll bar in the same place.
Concept behind this code is, after the data is changed we will call refresh_table_display. If u call like that the ALV will get refreshed so the cursor goes to the first cell. But before refreshing the ALV get the current cell using <b>get_current_cell</b> and get the scroll information using <b>get_scroll_info_via_id</b>. Then refresh the ALV and again set the current cell using <b>set_current_cell_via_id</b>.
DATA: li_rows TYPE lvc_s_roid,
li_col TYPE lvc_s_col,
lws_row_id TYPE lvc_s_roid,
lws_col_id TYPE lvc_s_col,
ls_col TYPE lvc_s_col,
ls_num TYPE lvc_s_roid.
CALL METHOD o_alvgrid->get_current_cell
IMPORTING
es_col_id = li_col
es_row_no = li_rows.
CALL METHOD o_alvgrid->get_scroll_info_via_id
IMPORTING
es_col_info = ls_col
es_row_no = ls_num.
CALL METHOD o_alvgrid->refresh_table_display.
CALL METHOD o_alvgrid->set_scroll_info_via_id
EXPORTING
is_col_info = ls_col
is_row_no = ls_num.
lws_row_id-row_id = li_rows-row_id.
lws_col_id-fieldname = li_col-fieldname.
CALL METHOD o_alvgrid->set_current_cell_via_id
EXPORTING
is_column_id = lws_col_id
is_row_no = lws_row_id.
Regards,
Prakash.
2006 Sep 27 12:20 PM
2006 Sep 27 12:43 PM
Hello Darren
When you refresh your ALV grid (method REFRESH_TABLE_DISPLAY) set parameter IS_STABLE:
IS_STABLE-ROW = 'X'
IS_STABLE-COL = 'X'
Regards
Uwe
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |