Application Development 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: 

CALL METHOD xxx->set_current_cell_via_id

Chris_2311
Participant
0 Kudos
3,116

hi all ...

i have the following request and i'm not far away from a mental breakdown

this is my coding:

CALL METHOD grid->set_table_for_first_display

       EXPORTING

         i_structure_name    'IT_DIALOG'

         is_layout                     = ls_layout

         it_toolbar_excluding   = it_toolbar_excluding

       CHANGING

         it_outtab                     = lt_dialog

         it_fieldcatalog               = lt_fieldcat

       EXCEPTIONS

         invalid_parameter_combination = 1

         program_error                 = 2

         too_many_lines                = 3

         OTHERS                        = 4.

     CALL METHOD cl_gui_alv_grid=>set_focus

       EXPORTING

         control           = dialogbox

       EXCEPTIONS

         cntl_error        = 1

         cntl_system_error = 2

         OTHERS            = 3.

     CALL METHOD grid->set_ready_for_input

       EXPORTING

         i_ready_for_input = 1.

     CALL METHOD grid->refresh_table_display

       EXPORTING

         i_soft_refresh = 'X'.

     lt_col_id-fieldname = 'SERGE'.

     lt_row_id-index = '1'.

     lt_row_no-row_id = '1'.

     CALL METHOD grid->set_current_cell_via_id

       EXPORTING

         is_row_id    = lt_row_id

         is_column_id = lt_col_id

         is_row_no    = lt_row_no.

i want to set the input cursor to the column "SERGE" in my alv grid ... this alv grid only has one row, every time!

what am i doing wrong?

the "SERGE" cell is selected, but the cursor inside is not active/blinking!

TIA!

christian

1 ACCEPTED SOLUTION

MariaJoãoRocha
Contributor
742

Hi,

I use and it works! Try flush.

  call method grid->set_current_cell_via_id

    exporting

      is_row_no    = ls_row_no   "row number

      is_column_id = ls_col_id. "column number



  call method cl_gui_control=>set_focus

    exporting

      control = grid.

  call method cl_gui_cfw=>flush.

Regards,

Maria João Rocha

5 REPLIES 5

sivaganesh_krishnan
Contributor
0 Kudos
742

HI Christian ,

I Just tried out the alv , and i can get the cursor on specified cell.

I have Used set_selected_cells_id Method

data: lt_cell type table of lvc_s_ceno.
  data: lwa_cell like line of  lt_cell.


  lwa_cell-col_id = 2.
  lwa_cell-row_id = 3.
  append lwa_cell to lt_cell.


  call method lr_alv_grid->set_selected_cells_id
    exporting
      it_cells = lt_cell.

Regards,

Sivaganesh.

MariaJoãoRocha
Contributor
743

Hi,

I use and it works! Try flush.

  call method grid->set_current_cell_via_id

    exporting

      is_row_no    = ls_row_no   "row number

      is_column_id = ls_col_id. "column number



  call method cl_gui_control=>set_focus

    exporting

      control = grid.

  call method cl_gui_cfw=>flush.

Regards,

Maria João Rocha

Former Member
0 Kudos
742

Hi Christian,

your code is fine but you just need to call method set_focus after calling the method set_current_cell_via_id  and while calling the method set_focus provide control = reference of cl_gui_alv_grid like below ,what happend in ur case is that u set focus first then set the current cell

lt_col_id-fieldname = 'SERGE'.

     lt_row_id-index = '1'.

     lt_row_no-row_id = '1'.

     CALL METHOD grid->set_current_cell_via_id

       EXPORTING

         is_row_id    = lt_row_id

         is_column_id = lt_col_id

         is_row_no    = lt_row_no.

CALL METHOD cl_gui_alv_grid=>set_focus

       EXPORTING

         control           = grid    ----->reference variable of cl_gui_alv_grid.

       EXCEPTIONS

         cntl_error        = 1

         cntl_system_error = 2

         OTHERS            = 3.

if sy-subrc <> 0.

     EXIT.

endif.

Just make little mentioned change and enjoy.

If still not placing the cursor then finally

call method flush of cl_gui_cfw

call method cl_gui_cfw=>flsuh.

Hope this will resolve ur issue

regards

Syed

Former Member
0 Kudos
742

hi Christian

you need set focus on the grid, not the dialogbox.

   call method cl_gui_control=>set_focus
    exporting
      control = grid.

then the cell should be selected, and the cursor inside is active. to type a char verify the reult.

regards,

Archer

Former Member
0 Kudos
742

it's very helpful.i have solved my recent issue by this discussion.thanks all fellows