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 Refresh not working

Former Member
0 Likes
4,687

Hi Gurus,

I am using refresh_table_display to refresh the data in my ALV, but apparantly it is not refreshing anything.

Please advice if i am missing something.

WHEN 'REFR'.

*Clear Data

PERFORM clear_data.

  • Data Selection.

PERFORM get_data.

CALL METHOD obj_grid->refresh_table_display

EXCEPTIONS

finished = 1

OTHERS = 2.

IF sy-subrc <> 0.

ENDIF.

ENDCASE.

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,786

I think you need a " CALL METHOD cl_gui_cfw=>flush. " after the method refresh_table_display called.

You don't have to free the alv grid control.

This method is used to synchronize your SAPGui, each time you call it, a new RFC connection is opened to the SAPgui.

Ref. http://help.sap.com/saphelp_sm32/helpdata/en/06/3fa1879f2811d2bd68080009b4534c/content.htm

Hi Gurus,

I am using refresh_table_display to refresh the data in my ALV, but apparantly it is not refreshing anything.

Please advice if i am missing something.

WHEN 'REFR'.

*Clear Data

PERFORM clear_data.

  • Data Selection.

PERFORM get_data.

CALL METHOD obj_grid->refresh_table_display

EXCEPTIONS

finished = 1

OTHERS = 2.

IF sy-subrc <> 0.

ENDIF.

ENDCASE.

Thanks in advance.

8 REPLIES 8
Read only

Former Member
0 Likes
2,786

u need to write below code to clear custom control :

*--custom control through it ALV Grid is displayed.

IF NOT G_CUSTOM_CONTAINER2 IS INITIAL.

CALL METHOD G_CUSTOM_CONTAINER2->FREE.

CLEAR: G_CUSTOM_CONTAINER2.

ENDIF.

Read only

0 Likes
2,786

Hi,

Why there is a need to FREE the custom container?

IF NOT G_CUSTOM_CONTAINER2 IS INITIAL.

CALL METHOD G_CUSTOM_CONTAINER2->FREE.

CLEAR: G_CUSTOM_CONTAINER2.

ENDIF.

Read only

Former Member
0 Likes
2,787

I think you need a " CALL METHOD cl_gui_cfw=>flush. " after the method refresh_table_display called.

You don't have to free the alv grid control.

This method is used to synchronize your SAPGui, each time you call it, a new RFC connection is opened to the SAPgui.

Ref. http://help.sap.com/saphelp_sm32/helpdata/en/06/3fa1879f2811d2bd68080009b4534c/content.htm

Read only

0 Likes
2,786

hi:

form user_com using r_ucomm like sy-ucomm

rs_selfield type slis_selfield .

case r_ucomm.

when: 'BACK' or 'EXIT' or 'CANCEL'. "leave back to last screen

leave to screen 0.

when: 'ZADD'. "add line

call screen '100' starting at 80 10.

when: 'ZDELETE'.

perform do_delete_line. "delete lines

endcase.

rs_selfield-refresh = 'X'.

rs_selfield-col_stable = 'X'.

rs_selfield-row_stable = 'X'.

endform. "user_com_second

if you used the oo ALV.

you need define a new object,do not use the old one.

such as:

FORM refresh_alv_dis.

data: l_grid TYPE REF TO cl_gui_alv_grid.

CALL METHOD l_grid->refresh_table_display.

ENDFORM. "REFRESH_ALV

好运,

启明星

Read only

0 Likes
2,786

Hi Gi

Even I am using refresh_table_display but its not working. I just added few things

CASE e_ucomm.

WHEN 'REFR'.

PERFORM clear_data.

PERFORM get_data.

CALL METHOD obj_grid->get_frontend_layout

IMPORTING

es_layout = DS_LAYO

CALL METHOD obj_grid->set_frontend_layout

EXPORTING

is_layout = ds_layo.

data ds_sort1 type LVC_T_SORT.

CALL METHOD obj_grid->get_sort_criteria

IMPORTING

et_sort = ds_sort1

.

CALL METHOD obj_grid->set_sort_criteria

exporting

it_sort = ds_sort1

.

CALL METHOD obj_grid->refresh_table_display

  • EXPORTING

  • IS_STABLE = ds_stable

EXCEPTIONS

finished = 1

OTHERS = 2.

IF sy-subrc <> 0.

ENDIF.

CALL METHOD cl_gui_cfw=>flush

EXCEPTIONS CNTL_SYSTEM_ERROR = 1

CNTL_ERROR = 2.

ENDCASE.

Read only

0 Likes
2,786

Hi Zhang,

I just added the FLUSH to my code, I Development server it was working before as well, but in production server it is was not refreshing. Lets see if this FLUSH thing will help in production server.

CASE e_ucomm.

WHEN 'REFR'.

*Clear Data

PERFORM clear_data.

  • Data Selection.

PERFORM get_data.

CALL METHOD obj_grid->get_frontend_layout

IMPORTING

es_layout = DS_LAYO

.

*DATA DS_STABLE TYPE LVC_S_STBL .

*DS_STABLE-ROW = 'X'.

*DS_STABLE-COL = 'X'.

CALL METHOD obj_grid->set_frontend_layout

EXPORTING

is_layout = ds_layo.

data ds_sort1 type LVC_T_SORT.

CALL METHOD obj_grid->get_sort_criteria

IMPORTING

et_sort = ds_sort1

.

CALL METHOD obj_grid->set_sort_criteria

exporting

it_sort = ds_sort1

.

CALL METHOD obj_grid->refresh_table_display

  • EXPORTING

  • IS_STABLE = ds_stable

EXCEPTIONS

finished = 1

OTHERS = 2.

IF sy-subrc <> 0.

ENDIF.

CALL METHOD cl_gui_cfw=>flush

EXCEPTIONS CNTL_SYSTEM_ERROR = 1

CNTL_ERROR = 2.

Read only

0 Likes
2,786

Thanks Gurus for your help

Read only

Former Member