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

Issue regarding cursor placement on screen

Former Member
0 Likes
1,092

Hi All

We had built a custom report where an ALV grid appears in report once the transaction is executed. The user provides input in ALV grid on the screen.

Requirement : When we execute the transaction, the cursor goes to the first field in the screen.

Our requirement is that the cursor should go to the first editable cell in ALV

Please let me know if anyone has any idea how to proceed here

Thanks

Krishna

Hi All

We had built a custom report where an ALV grid appears in report once the transaction is executed. The user provides input in ALV grid on the screen.

Requirement : When we execute the transaction, the cursor goes to the first field in the screen.

Our requirement is that the cursor should go to the first editable cell in ALV

Please let me know if anyone has any idea how to proceed here

Thanks

Krishna

5 REPLIES 5
Read only

Patrick_vN
Active Contributor
0 Likes
1,049

Class CL_GUI_ALV_GRID has a method SET_CURRENT_CELL_VIA_ID that allows you to place the cursor where you want in the ALV (set_current_cell_via_id - ALV Grid Control (BC-SRV-ALV) - SAP Library)

Read only

0 Likes
1,049

Hi Patrick,

We have tried to use that method, in fact we are using this method to move the cursor when user enters any data so that cursor goes to next input cell on ALV(works perfectly). But it does not work for initial display of ALV, when we use it during ALV first display it just highlights the specified cell in yellow color, the cursor is still on the 1st screen field of the screen.

Any other suggestions will be helpful.

Regards

Read only

0 Likes
1,049

If that is the case, can it be somehow related to a refresh of the screen? the refresh of the alv?

Read only

0 Likes
1,049

Could you try to add a call of set_selected_cells


CALL METHOD alv_grid_p->set_current_cell_via_id

  EXPORTING

    is_row_no = row_no. " lvc_s_roid

REFRESH cell_p.

CLEAR r_cell.

r_cell-row_id-index = row. " integer

r_cell-col_id-fieldname = 'FIELDNAME'.

APPEND r_cell TO cell_p.

CALL METHOD alv_grid_p->set_selected_cells

  EXPORTING

    it_cells = cell_p. " lvc_t_cell

Or you could

  • Force SET_TABLE_FOR_FIRST_DISPLAY to execute with some cl_gui_cfw=>dispatch before execution of set_current_cell_via_id
  • Set (again) cursor in event AFTER_REFRESH?

Regards,

Raymond

Read only

0 Likes
1,049

Hi Raymond,

I had already tried this method but I tried again, the result is it highlights the cell with a red border but cursor still is in other screen field.

For the second method you suggested I am not clear, could you explain a bit more.