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

Refresh ALV & set focus

Former Member
0 Likes
4,708

Hi,

I have a refresh option on my screen. It will bring latest data from database. After displaying data in ALV and scrolling down (lets assume scrolled down 10 records). if I select refresh, I am reloading data to ALV. But focus is going to first record. I have again scrool down to 11th record to check the data. How I can set focus to 11th record after repopulating data on ALV. I am using classes for ALV.

I will appriciate any inputs.

Regards,

Venkat.

Hi,

I have a refresh option on my screen. It will bring latest data from database. After displaying data in ALV and scrolling down (lets assume scrolled down 10 records). if I select refresh, I am reloading data to ALV. But focus is going to first record. I have again scrool down to 11th record to check the data. How I can set focus to 11th record after repopulating data on ALV. I am using classes for ALV.

I will appriciate any inputs.

Regards,

Venkat.

9 REPLIES 9
Read only

Former Member
0 Likes
2,025

Hi,

Try using the method SET_CURRENT_CELL_VIA_ID by passing the row number..

Thanks,

Naren

Read only

Former Member
0 Likes
2,025

Hi,

Check this example of using the method set_current_cell_via_id.

DATA: ROWNO TYPE LVC_S_ROID.

ROWNO-ROW_ID = 25.

  • Set the focus on the row number 25.

CALL METHOD <b>grid1->set_current_cell_via_id</b>

EXPORTING

IS_ROW_NO = rowno.

Hope this helps..

THanks,

Naren

Read only

Former Member
0 Likes
2,025

Hi,

I tried this it worked for me..Please let me know if it works for you..

Thanks,

Naren

Read only

0 Likes
2,025

Hi Naren,

Thanks for your reply. Its working for some extent. selected line is in middile of screen once I do refresh the line is displaying the end of screen. The solution is surely better than displaying list from first. My exact requirement is if user select a row after refresh I want to see the row at the same position. Does it require any additional effort ?.

Regards,

Venkat.

Read only

0 Likes
2,025

Hello Venkat

You have to set I_STABLE-ROW = 'X' and I_STABLE-COL = 'X' when calling method go_grid->refresh_table_display.

Regards

Uwe

Read only

0 Likes
2,025

Hi Uwe,

Thanks for your response. What data I_STABLE table contains ?

Regards,

Venkat.

Read only

0 Likes
2,025

Naren,

Thanks for your response. Its working partially. When even i refresh my selected line is displaying moving to the end on alv screen, before refresh my selected line is in middle of alv screen.

Regards,

Venkat.

Read only

0 Likes
2,025

Hello Venkat

As the names imply

- I_STABLE-ROW = 'X' means current row position (e.g. if you have used the horizontal scroll bar) remains stable after refresh and

- I_STABLE-COL = 'X' means current column position (e.g. if you have used the vertical scroll bar) remains stable after refresh

Regards

Uwe

Read only

Former Member
0 Likes
2,025

not to go to first row. use refresh with stable option.

e.g.:-

data:g_stable type LVC_S_STBL.

  • Refresh the screen without changing the view

g_stable-row = '1'.

call method g_alv_grid->refresh_table_display

exporting IS_STABLE = g_stable.