2009 Sep 17 12:30 PM
Hi everybody,
I am facing a problem with an ALV and I am not able to solve. I have been looking the threads that already exist but I can not find the solution.
I am going to try to explain what is the problem:
There is an screen with some alv with tables related between them, whenever I double click in the first alv table the next table must be filled with the entries related and the entry that I double click it should be marked. The problem is any time I double click and the next alv table is open the one where I double click lost the line, I mean the focus goes to the first line of the table, meaning that the refreshing eliminates the actual selected entry.
This is what I tried to do but I don't know why it doesn't work.
1.- The lines selected are saved in a table.
CALL METHOD mo_alv_grid_edit->get_selected_rows
IMPORTING
et_index_rows = gi_index_rows.
2.- Refresh the alv table.
CALL METHOD mo_alv_grid_edit->refresh_table_display
EXPORTING
i_soft_refresh = 'X'.
3.- Set the lines I have before
CALL METHOD mo_alv_grid_edit->set_selected_rows
EXPORTING
it_index_rows = gi_index_rows .
Thanks very much
2009 Sep 17 1:30 PM
Is there a reason why you are doing a refresh ? Perhaps you can avoid a refresh and try.
BR,
Advait
Hi everybody,
I am facing a problem with an ALV and I am not able to solve. I have been looking the threads that already exist but I can not find the solution.
I am going to try to explain what is the problem:
There is an screen with some alv with tables related between them, whenever I double click in the first alv table the next table must be filled with the entries related and the entry that I double click it should be marked. The problem is any time I double click and the next alv table is open the one where I double click lost the line, I mean the focus goes to the first line of the table, meaning that the refreshing eliminates the actual selected entry.
This is what I tried to do but I don't know why it doesn't work.
1.- The lines selected are saved in a table.
CALL METHOD mo_alv_grid_edit->get_selected_rows
IMPORTING
et_index_rows = gi_index_rows.
2.- Refresh the alv table.
CALL METHOD mo_alv_grid_edit->refresh_table_display
EXPORTING
i_soft_refresh = 'X'.
3.- Set the lines I have before
CALL METHOD mo_alv_grid_edit->set_selected_rows
EXPORTING
it_index_rows = gi_index_rows .
Thanks very much
2009 Sep 17 12:35 PM
As per my understaning you have to use Get_selected_rows rather than set selected rows method.
Regards
Pavan
2009 Sep 17 12:38 PM
Hi Pavan,
the problem is that I lost the entries that were marked, that is the reason that befores refreshing the alv, I take from the object the lines selected and then I try to set them again after the refreshing is done.
2009 Sep 17 12:39 PM
Try this :
1.- The lines selected are saved in a table.
CALL METHOD mo_alv_grid_edit->get_selected_rows
IMPORTING
et_index_rows = gi_index_rows.
call the table and then
2.- Set the lines I have before
CALL METHOD mo_alv_grid_edit->set_selected_rows
EXPORTING
it_index_rows = gi_index_rows .
2009 Sep 17 12:49 PM
Hi Sandeep,
what do you exactly mean with 'call the table' ?
when I call 'refresh_table_display' the outtab is update, so after this update because it is possible that new lines are added, I try to set the lines but everything is refresh so the focus come back to the first line.
2009 Sep 17 1:03 PM
just change the order of execution of the methods.
1 then 3 then 2
2009 Sep 17 1:06 PM
Hi Soumyaprakash,
I have already checked that but still doesn't work
2009 Sep 17 1:06 PM
In PBO of the screen
CALL METHOD mo_alv_grid_edit->set_selected_rows
EXPORTING
it_index_rows = gi_index_rows . " Please ensure this have values
CALL METHOD mo_alv_grid_edit->refresh_table_display.
a®
2009 Sep 17 1:20 PM
Hi again,
and thanks very much to all for your help.
There is info in the table that keeps the index, but method doesn't do anything.
2009 Sep 17 1:27 PM
As i mentioned whether do you removed soft_refresh from refresh_table_display ?
Please check the docu on soft_refresh
http://help.sap.com/saphelp_46c/helpdata/fr/0a/b5531ed30911d2b467006094192fe3/content.htm
a®
2009 Sep 17 1:30 PM
Is there a reason why you are doing a refresh ? Perhaps you can avoid a refresh and try.
BR,
Advait
2009 Sep 17 1:36 PM
Hi,
I have already tryed without the "refresh_table_display", but nothing happens the focus goes again to the first line.
2009 Sep 17 1:44 PM
But do the lines remain selected ? If they do , then try passing IS_STABLE to the REFRESH_TABLE_DISPLAY method and see. Pass the row index of the first line that was selected in gi_index_rows by reading the table at index 1.
BR,
Advait
2009 Sep 17 1:59 PM
the entries remain, but after the refresh they dissappear. I thought that setting this lines again it would work but nothing happens. Indeed, after setting the entries I call again get_selected_rows to be sure that something was done, and it was the entries were selected but nothing is shown in the screen, the focus goes back to the first line
2009 Sep 17 2:12 PM
But did you try with IS_STABLE parameter ?
* Call the refresh
DATA ls_stable TYPE lvc_s_stbl.
ls_stable-row = 'X'.
ls_stable-col = 'X'.
CALL METHOD g_grid->refresh_table_display
EXPORTING
is_stable = ls_stable
EXCEPTIONS
finished = 1
OTHERS = 2.
Now, the focus will remain on the row and column that you double clicked on.
You need to pass 'X' to the row and col field. Not the index as I had mentioned in my earlier post. Sorry about that.
BR,
Advait
2009 Sep 17 2:23 PM
Hi Advait,
thanks very much for all the answers
I have marked ls_stable-row = 'X'. But nothing happens the line doesn't remain, it always come back to the first line
2009 Sep 17 2:57 PM
Hi Advait,
thanks very much for all the answers
I have marked ls_stable-row = 'X'. But nothing happens the line doesn't remain, it always come back to the first line
2009 Sep 17 3:11 PM
thanks very much to all of you, after hours debugging I have found out that there was anohter refresh so everything was set up again.
I will give you the maximun points I can.
Thanks
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |