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 list display

Former Member
0 Likes
3,270

Hi,

how to refresh an ALV LIST display?

Thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,713

Hi,

just after displaying alv output refresh_table_display is to refresh table .

But after displaying alv output if you want to refresh alv output

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name

= alv_prog

i_structure_name

= Structure name has to be in capital'

i_inclname

= alv_prog

CHANGING

ct_fieldcat

= alv_fieldcat

EXCEPTIONS

inconsistent_interface = 1

program_error

= 2

OTHERS

= 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

  • Display ALV grid

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_bypassing_buffer

= 'X'

i_callback_program

= alv_prog

i_callback_pf_status_set = 'SET_PF_STATUS'

i_callback_user_command = 'HANDLE_USER_COMMAND'

i_grid_title

= sy-title

is_layout

= alv_layout

it_fieldcat

= alv_fieldcat

it_excluding

= alv_exclude

i_save

= 'A'

TABLES

t_outtab

= tab

EXCEPTIONS

program_error

= 1

OTHERS

= 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

FORM set_pf_status USING rt_extab TYPE slis_t_extab.

SET PF-STATUS 'XXXX' EXCLUDING action.

ENDFORM."SET_PF_STATUS

FORM handle_user_command USING r_ucomm

LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

CASE r_ucomm.

WHEN 'UPDATE'.

PERFORM update_routine.

WHEN '&IC1'.

IF rs_selfield-fieldname = 'IDOC_NUM' OR

rs_selfield-fieldname = 'IDOC_NUM_OUT'.

PERFORM drill_down USING rs_selfield-value.

ENDIF.

WHEN 'SAVE'.

DATA ref1 TYPE REF TO cl_gui_alv_grid.

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

e_grid = ref1.

CALL METHOD ref1->check_changed_data.

PERFORM save_routine.

WHEN 'REFRESH'.

PERFORM get_selection.

WHEN OTHERS.

ENDCASE.

rs_selfield-refresh = 'X'.

"Refresh screen

ENDFORM.

"HANDLE_USER_COMMAND

use this option it will work.

Hi,

how to refresh an ALV LIST display?

Thanks.

5 REPLIES 5
Read only

Former Member
0 Likes
1,713

call method refresh_table_display of class cl_gui_alv_grid.

Regards,

Anil.

Read only

Former Member
0 Likes
1,713

Hi,

Content and Structure Change

Use

You are able to change the internal data table in various ways. Depending on which type of change you use, you have to proceed differently to make the change visible on the front end in the ALV output as well.

You are able to make the following changes:

· You change content or the sequence of the individual data records

Afterwards you need to refresh the ALV output

· You replace the entire data table

Refresh Display of the ALV Output

If you have changed single values, added rows or deleted rows in the data table of list-type ALV outputs, you need to complete these changes in the ALV output as well by refreshing the ALV display.

For Changes in the Tree Structure you do not have to refresh the display. In the other ALV tools, you do not have to refresh the ALV output when you make the following changes:

§ Changes to the Display of Columns

§ Changes Sequence of Columns in the ALV display

§ Changes to the DDIC Reference of Columns

By default, the ALV output automatically scrolls to the beginning. However, you are able to determine that the current display (position on the screen) not be changed.

You are able to refresh the ALV output in two ways:

· All settings for filters and sorting remain.

This setting can lead to newly inserted data records not being displayed because the filter setting hid exactly these data records.

· All settings for filters and sorting remain.

Features

For changes to content and structure, you are able to make the following settings:

· Refresh ALV output

· Swap the data table of the ALV output

Refresh ALV output

With the refresh, you ensure that the changed values are available on the front end as well.

Display type

ALV Tool

Classic ABAP list

Full screen

In the Container

Simple, two-dimensional table

Yes

Yes

Yes

Hierarchical-sequential list

Yes

Tree structure

No

No

Methods

Function

Class

Method

Refresh ALV output without deleting filter and sort settings

CL_SALV_TABLE

CL_SALV_HIERSEQ_TABLE

REFRESH

(Parameter REFRESH_MODE: SOFT)

Refresh ALV output and delete filter and sort settings

REFRESH

(Parameter REFRESH_MODE: FULL)

Change the Structure of the Data Table with SET_DATA

Depending on which ALV tool you are using, the parameters of the SET_DATA method are different:

If you assign a new structure with SET_DATA, all objects that referred to the previous structure will be deleted such as all sort objects in list-type ALV outputs or all node objects in tree structures.

Methods

Function

Class

Method

Change structure and data table

CL_SALV_TABLE

CL_SALV_HIERSEQ_TABLE

CL_SALV_TREE

CL_SALV_HIERSEQ_LEVEL

SET_DATA

Change the Structure of the Data Table with the SET_DATA Method

ALV Tool

Parameter

Remarks

Simple, two-dimensional table

T_TABLE

Table for structure and contents of the ALV output

Hierarchical-sequential list

(in CL_SALV_HIERSEQ_TABLE)

LEVEL

Hierarchy level whose structure you wish to change

T_TABLE

New table of hierarchy level

T_BINDING

List of up to five foreign-key relationships

(in CL_SALV_HIERSEQ_LEVEL)

VALUE

New table of hierarchy level

T_BINDING

List of up to five foreign-key relationships

Tree structure

T_TABLE

Initial table

Empty table, only sets the structure

Read only

Former Member
0 Likes
1,713

In ALV FM for list display,

use parameter callback user command,

inside the form for that subroutine

use

selfield-refresh = 'X'.

Reward if useful.

Regards,

Talwinder

Read only

Former Member
0 Likes
1,714

Hi,

just after displaying alv output refresh_table_display is to refresh table .

But after displaying alv output if you want to refresh alv output

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name

= alv_prog

i_structure_name

= Structure name has to be in capital'

i_inclname

= alv_prog

CHANGING

ct_fieldcat

= alv_fieldcat

EXCEPTIONS

inconsistent_interface = 1

program_error

= 2

OTHERS

= 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

  • Display ALV grid

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_bypassing_buffer

= 'X'

i_callback_program

= alv_prog

i_callback_pf_status_set = 'SET_PF_STATUS'

i_callback_user_command = 'HANDLE_USER_COMMAND'

i_grid_title

= sy-title

is_layout

= alv_layout

it_fieldcat

= alv_fieldcat

it_excluding

= alv_exclude

i_save

= 'A'

TABLES

t_outtab

= tab

EXCEPTIONS

program_error

= 1

OTHERS

= 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

FORM set_pf_status USING rt_extab TYPE slis_t_extab.

SET PF-STATUS 'XXXX' EXCLUDING action.

ENDFORM."SET_PF_STATUS

FORM handle_user_command USING r_ucomm

LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

CASE r_ucomm.

WHEN 'UPDATE'.

PERFORM update_routine.

WHEN '&IC1'.

IF rs_selfield-fieldname = 'IDOC_NUM' OR

rs_selfield-fieldname = 'IDOC_NUM_OUT'.

PERFORM drill_down USING rs_selfield-value.

ENDIF.

WHEN 'SAVE'.

DATA ref1 TYPE REF TO cl_gui_alv_grid.

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

e_grid = ref1.

CALL METHOD ref1->check_changed_data.

PERFORM save_routine.

WHEN 'REFRESH'.

PERFORM get_selection.

WHEN OTHERS.

ENDCASE.

rs_selfield-refresh = 'X'.

"Refresh screen

ENDFORM.

"HANDLE_USER_COMMAND

use this option it will work.

Read only

Former Member
0 Likes
1,713

Hi Navi,

The following method call is used to refresh the data displayed within an ALV object grid:

CALL method gd_tree->REFRESH_TABLE_DISPLAY.

CALL METHOD gd_tree->set_table_for_first_display

EXPORTING

is_layout = gd_layout

CHANGING

it_fieldcatalog = gd_fieldcat

it_sort = it_sortcat

it_outtab = it_report.

CALL method gd_tree->REFRESH_TABLE_DISPLAY.

CALL METHOD cl_gui_cfw=>flush.

Hope this helps.

Reward if helpful.

Regards,

Sipra