Hi,
I have a requirement about alv cursor position but I faced a problem. I was able to Highlighted to cell using this code:
DATA: ls_row TYPE i,
ls_value TYPE c,
ls_col TYPE i,
ls_row_id TYPE lvc_s_row,
ls_col_id TYPE lvc_s_col,
es_row_no TYPE lvc_s_roid.
CALL METHOD lo_alv->get_current_cell
IMPORTING
e_row = ls_row
e_value = ls_value
e_col = ls_col
es_row_id = ls_row_id
es_col_id = ls_col_id
es_row_no = es_row_no.
IF ls_col = 1.“next line
ls_col_id = ‘LGORT’. “cursor will go this field.
CALL METHOD lo_alv->refresh_table_display.
CALL METHOD lo_alv->set_current_cell_via_id
EXPORTING
is_column_id = ls_col_id
is_row_no = es_row_no.
CALL METHOD lo_alv->refresh_table_display
EXPORTING
* is_stable =
i_soft_refresh = abap_true
* EXCEPTIONS
* finished = 1
* others = 2
.
IF sy–subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ELSE.
ls_col_id = ‘WERKS’. “cursor will go this field.
es_row_no–row_id = conv i( es_row_no–row_id ) + 1 .
CALL METHOD lo_alv->refresh_table_display.
CALL METHOD lo_alv->set_current_cell_via_id
EXPORTING
is_column_id = ls_col_id
is_row_no = es_row_no.
ENDIF.
but cursor itself located top of screen where we enter tcode here is cursor position where its located:
How can I solve this problem.