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

ALV GRID CURRENT CELL DOES NOT REFRESH ON BACK BUTTON

Former Member
0 Likes
2,063

Hi,

I call a screen and build the ALV GRID and then on double click get the column the user have clicked

by using the function

CALL METHOD ALV_GRID->GET_CURRENT_CELL

Use the current cell value to display details corresponding in the second screen

On hitting back I return to the previous screen using

  • leave screen

LEAVE TO SCREEN 0.

Refresh alv_grid

But in the first screen on double click again the previous selection still remains

the call method get current cell gets the same row selection

Is it something I am missing here to refresh the selection

Thanks ,

Charan

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,238

Hi,

Are you using Refresh statement for clear ALV_GRID? If yes then instead of this try using CALL METHOD ALV_GRID->FREE.

Hope this would help you.

Thanks,

Prashanth

9 REPLIES 9
Read only

Former Member
0 Likes
1,239

Hi,

Are you using Refresh statement for clear ALV_GRID? If yes then instead of this try using CALL METHOD ALV_GRID->FREE.

Hope this would help you.

Thanks,

Prashanth

Read only

0 Likes
1,238

Thanks for ur reply,

You Mean the ALV_GRID --> FREE would remove the previous previous user selection.

What does this ALV_GRID --> FREE do if you can explain.

Thanks,

Charan.

Read only

0 Likes
1,238

Hi,

This method actually clears the Object ALV_GRID. You cannot use Refresh statement if you wanted to clear the contents.

Did it work.

Thanks,

Prashanth

Edited by: Prashanth KR on Feb 5, 2009 10:42 AM

Read only

0 Likes
1,238

Hey thanks for the repsonse.

I am getting back to work now.

Will try those tips and get back to you.

Thanks,

Charan.

Read only

0 Likes
1,238

Hi,

The code

ALV_GRID --> FREE

did not free the selection and my call program to get the current selection still finds the previous selection when I return to the first screen and click another line item.

Can you let me know how can I remove the selection which was made on the grid and free it so a new selection will load up there

Charan

Read only

0 Likes
1,238

Hi,

The code as per you program is

LEAVE TO SCREEN 0.
Refresh alv_grid

Change this way and try.

Refresh alv_grid   " Refresh the ALV grind and then Leave to screen 0
LEAVE TO SCREEN 0.

Read only

0 Likes
1,238

Hi,

Can you let us know which class are you using build this Grid. Method FREE should clear the contents of the Object, if it exist in the Class or there should be some other relevent method to d othis and to my knowledge i don't think that Rrefresh statement will be helpful in doing this.

Thanks,

Prashanth

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
1,238

Hi

When you double-click on any cell of alv grid, use this code to fetch the data of the line that you currently clicked, its working:-

When you double click on the ALV grid line, you will have sy-ucomm = '&IC1'.

So when you define a i_callback_user_command for the FM reuse_alv_grid_display, and create it as:-


FORM command USING ucomm LIKE sy-ucomm selfield TYPE slis_selfield.
  DATA : ok_code TYPE sy-ucomm.
  ok_code = ucomm.
  CASE ok_code.
    WHEN '&IC1'. "for double click on alv grid line
      " your code
  ENDCASE.
ENDFORM.

As you have used selfield TYPE slis_selfield, the field selfield will hold all the values.

To know on which row you have clicked and to retain that line, use code:-

Suppose you are currently displaying data from internal table itab and corresponding to it you have work area wa.


read table itab into wa index selfield-tabindex. "index value of line you clicked
" now you have the contents of line that you double clicked currently

Now to know the field name that you clicked, use:-


selfield-fieldname " will fetch you the name of field that you clicked

Now using the work-area and the name of field that you clicked, you can easily make out the details of the field i.e., field name and field value and you can code as per your requirement.

Now here you can create a new field catalog and call another FM 'REUSE_ALV_GRID_DISPLAY' to display further information in the next grid based on the value obtained when user double clicks a cell.

Or if you are using the alv grid to display, then you can also use:-


selfield-refresh = 'X'. "to refresh the alv display

Hope this solves your problem.

Thanks & Regards,

Tarun Gambhir

Read only

Former Member
0 Likes
1,238

<p>Hi,</p>

<p>To refresh Grid Control you need to use the following method.</p>

<p>The method <b>REFRESH_TABLE_DISPLAY</b> of <b>CL_GUI_ALV_GRID</b> class.</p>

<p>In your case you need to use the following statement.</p>

<p><b>CALL METHOD ALV_GRID->REFRESH_TABLE_DISPLAY</b></p>

<p>Make sure you call this method in the PBO of the screen which contains the Grid Control</p>