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 refresh not working properly

0 Likes
3,991

Hi all,

i want to refresh my alv-grid but after update of my internal-table and setting the 3 fields of rs_selfield ( rs_selfield-refresh = 'X', rs_selfield-col_stable = 'X', rs_selfield-row_stable = 'X'), the method cl_gui_alv_grid-refresh_table_display only shows the data of my internal Table BEFORE my update... (i checked in Debugging the content of the table mt_outtab->*).

I wanted to add the fact, that i already checked ALL forum threads with keywords ALV GRID REFRESH and NONE of them solved my issue.. (all Reports of Michel Prioud for instance, the SLIS-ones)

*Here's an extract of my USERCOMMAND*_

CASE p_ucomm.
(...)
    WHEN '&AKTU'.
      PERFORM itab_actualize CHANGING gt_outtab. "<- actualization of my internal table
      rs_selfield-refresh = 'X'.
      rs_selfield-col_stable = 'X'.
      rs_selfield-row_stable = 'X'.
(...)
when others.
endcase.

Here's my ALV-Display-Call

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_buffer_active             = 'X'
        i_callback_program          = g_callback_program
        i_callback_pf_status_set    = g_callback_pf_status_set
        i_callback_user_command     = g_callback_user_command
        i_callback_top_of_page      = g_callback_top_of_page
        i_callback_html_top_of_page = g_callback_html_top_of_page
        i_grid_title                = g_grid_title
        is_layout                   = gs_layout
        it_fieldcat                 = gt_fieldcat
        it_excluding                = gt_excluding
        it_sort                     = gt_sort
        it_filter                   = gt_filter
        i_save                      = g_save
        is_variant                  = gs_variant
        it_events                   = gt_events
        it_event_exit               = gt_event_exit
      TABLES
        t_outtab                    = gt_outtab
      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.

Any idea on a possible explanation for this????

Thx in advance for any clue and greets from France...

Hi all,

i want to refresh my alv-grid but after update of my internal-table and setting the 3 fields of rs_selfield ( rs_selfield-refresh = 'X', rs_selfield-col_stable = 'X', rs_selfield-row_stable = 'X'), the method cl_gui_alv_grid-refresh_table_display only shows the data of my internal Table BEFORE my update... (i checked in Debugging the content of the table mt_outtab->*).

I wanted to add the fact, that i already checked ALL forum threads with keywords ALV GRID REFRESH and NONE of them solved my issue.. (all Reports of Michel Prioud for instance, the SLIS-ones)

*Here's an extract of my USERCOMMAND*_

CASE p_ucomm.
(...)
    WHEN '&AKTU'.
      PERFORM itab_actualize CHANGING gt_outtab. "<- actualization of my internal table
      rs_selfield-refresh = 'X'.
      rs_selfield-col_stable = 'X'.
      rs_selfield-row_stable = 'X'.
(...)
when others.
endcase.

Here's my ALV-Display-Call

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_buffer_active             = 'X'
        i_callback_program          = g_callback_program
        i_callback_pf_status_set    = g_callback_pf_status_set
        i_callback_user_command     = g_callback_user_command
        i_callback_top_of_page      = g_callback_top_of_page
        i_callback_html_top_of_page = g_callback_html_top_of_page
        i_grid_title                = g_grid_title
        is_layout                   = gs_layout
        it_fieldcat                 = gt_fieldcat
        it_excluding                = gt_excluding
        it_sort                     = gt_sort
        it_filter                   = gt_filter
        i_save                      = g_save
        is_variant                  = gs_variant
        it_events                   = gt_events
        it_event_exit               = gt_event_exit
      TABLES
        t_outtab                    = gt_outtab
      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.

Any idea on a possible explanation for this????

Thx in advance for any clue and greets from France...

10 REPLIES 10
Read only

Former Member
0 Likes
2,275

Hi

refresh ur itab as below:

clear : itab[],wa_itab.

CASE p_ucomm.

(...)

WHEN '&AKTU'.

PERFORM itab_actualize CHANGING gt_outtab. "<- actualization of my internal table

rs_selfield-refresh = 'X'.

rs_selfield-col_stable = 'X'.

rs_selfield-row_stable = 'X'.

Read only

venkat_o
Active Contributor
0 Likes
2,275

Dear Guillaume Delorme,

<li> Check this sample program to know how it works and how it gets refreshed.

<li> Everything is there in USER_COMMAND callback routine. You need to handle properly.

<font color=blue><pre>

REPORT zvenkat_alv_list.

DATA: BEGIN OF i_mard OCCURS 0,

color(3) TYPE c, "color

werks TYPE mard-werks,

lgort TYPE mard-lgort,

matnr TYPE mard-matnr,

insme TYPE mard-insme,

einme TYPE mard-einme,

speme TYPE mard-speme,

END OF i_mard.

  • Types Pools

TYPE-POOLS:

slis.

  • Types

TYPES:

t_fieldcat TYPE slis_fieldcat_alv,

t_events TYPE slis_alv_event,

t_layout TYPE slis_layout_alv.

  • Workareas

DATA:

w_fieldcat TYPE t_fieldcat,

w_events TYPE t_events,

w_layout TYPE t_layout.

  • Internal Tables

DATA:

i_fieldcat TYPE STANDARD TABLE OF t_fieldcat,

i_events TYPE STANDARD TABLE OF t_events.

START-OF-SELECTION.

PERFORM get_data_from_database .

PERFORM build_fieldcatalog.

w_layout-info_fieldname = 'COLOR'. "color

PERFORM display_data.

&----


*& Form get_data_from_database

&----


FORM get_data_from_database .

CLEAR :i_mard,i_mard[].

SELECT werks lgort matnr insme einme speme

FROM mard

INTO CORRESPONDING FIELDS OF TABLE i_mard

UP TO 100 ROWS.

ENDFORM. " get_data_from_database

&----


*& Form build_fieldcatalog

&----


FORM build_fieldcatalog .

CLEAR :w_fieldcat,i_fieldcat[].

PERFORM build_fcat USING:

"Field Int Tab Text

'WERKS' 'I_MARD' 'WERKS',

'LGORT' 'I_MARD' 'LGORT',

'MATNR' 'I_MARD' 'MATNR',

'INSME' 'I_MARD' 'INSME',

'EINME' 'I_MARD' 'EINME',

'SPEME' 'I_MARD' 'SPEME'.

ENDFORM. " build_fieldcatalog

&----


*& Form display_data

&----


FORM display_data .

DATA :program LIKE sy-repid VALUE sy-repid.

SORT i_mard BY werks.

DELETE ADJACENT DUPLICATES FROM i_mard COMPARING werks.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = program

i_callback_user_command = 'USER_COMMAND'

is_layout = w_layout

it_fieldcat = i_fieldcat

it_events = i_events

TABLES

t_outtab = i_mard.

ENDFORM. " display_data

&----


*& Form BUILD_FCAT

&----


FORM build_fcat USING l_field l_tab l_text.

w_fieldcat-fieldname = l_field.

w_fieldcat-tabname = l_tab.

w_fieldcat-seltext_m = l_text.

IF l_field = 'WERKS'.

w_fieldcat-hotspot = 'X'.

ENDIF.

APPEND w_fieldcat TO i_fieldcat.

CLEAR w_fieldcat.

ENDFORM. " BUILD_FCAT

&----


*& Form USER_COMMAND

&----


FORM user_command USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield.

IF r_ucomm = '&IC1'.

READ TABLE i_mard WITH KEY werks = rs_selfield-value.

IF sy-subrc = 0.

i_mard-color = 'C31'.

MODIFY i_mard INDEX sy-tabix.

ENDIF.

rs_selfield-refresh = 'X'.

ENDIF.

ENDFORM. "USER_COMMAND</pre></font>

thanks

venkat.O

Read only

0 Likes
2,275

Hi Guys,

Thx for your answers.

But:

->The first recommandation (clear itab and wa) was already implemented

->The second one is as you can see in my code already in too...

=>Sorry but the thread hasn't been answered yet ..

Greets,

Guillaume

Read only

RahulKeshav
Active Contributor
0 Likes
2,275

Hi,

Try to debug and check weather gt_outtab is getting filled with new data or not....

CASE p_ucomm.

(...)

WHEN '&AKTU'.

BREAK-POINT.

PERFORM itab_actualize CHANGING gt_outtab. "<- actualization of my internal table

rs_selfield-refresh = 'X'.

rs_selfield-col_stable = 'X'.

rs_selfield-row_stable = 'X'.

(...)

when others.

endcase.

thnx

Rahul

Read only

0 Likes
2,275

that's what i am doing since 8.00 AM (now 1.00 PM) => Itab get filled with updated Data => Dataretrieving-routine is OK...

Thx for your efforts Rahul,

Greets,

Edited by: Guillaume Delorme on Jul 22, 2009 1:48 PM

Read only

0 Likes
2,275

Hi GD,

Try this...

IF r_ucomm = '&ACTION'.

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.

...

....

....

*refresh the ALV Grid Display after the execution of the BDC

gt_display[ ] = gt_not_select[ ].

rs_selfield-refresh = c_x.

ENDIF.

thnx

Rahul

Edited by: Rahul Keshav on Jul 22, 2009 5:29 PM

Edited by: Rahul Keshav on Jul 22, 2009 5:30 PM

Read only

0 Likes
2,275

any update?

Read only

0 Likes
2,275

Hi Rahul again...

absolutely no influence of the call-Method grid->check_changed_data on the report behaviour noticed...

=> Always refreshing but still showing the old datasets...

Thx again and Greets,

Guillaume

Read only

0 Likes
2,275

Hi Guillaume

Did you got the solution, I am also facing the same kind of problem.

I am using field-symbols for creating the structure . As my fieldcat depends on the number of characteristics maintained in a Z table.

I am getting the updated values, but doesn't reflect in ALV.

I have tried

1. rs_selfield-refresh = c_x.

2. CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

e_grid = ref_grid.

CALL METHOD ref_grid->refresh_table_display.

3. CALL METHOD ref_grid->check_changed_data .

But none of them works.

Please reply ASAP.

Regards,

Mukesh Dhakar

Read only

0 Likes
2,275

Hi Guillaume,

my bet: Although you modify the internal table data you re-fill them with original data again and then call display again. Make a where-used-list for the GT_DATA table, put breakpoints weherever it is filled and then try again. You will find out that your logic will re-fill the table.

Regards,

Clemens