Application Development 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: 

Trouble with loading new data into ALV GRID

Former Member
0 Kudos

Hello Experts!

I am creating a hierarchy comparison tool that also shows the master data of changed nodes in an ALV Grid. Because it must work for different InfoObjects, I create the internal table containing the output dynamically using the "WAS 6.40 Approach" found in this How-To (/people/subramanian.venkateswaran2/blog/2004/11/19/dynamic-internal-table), which results in a field symbol pointing to the dynamic table. I then create the field catalog and show the ALV Grid in Screen 200.

When the user goes back to the selection screen (100) and changes the comparison options, the internal table is updated with the new results. So far, everything works fine.

But although I call the method alv_grid->refresh_table_display, I am not able to update the data within the ALV Grid. Could it be that the problem lies with using a field symbol instead of a 'real' internal table?

Here is the module that shows / updates the grid:

MODULE display_alv OUTPUT.
    PERFORM prepare_data.
    PERFORM prepare_field_catalog CHANGING g_it_fieldcatalog.

  IF alv_container IS INITIAL.
    CREATE OBJECT alv_container
      EXPORTING
        container_name = alv_containernm.

    CREATE OBJECT alv_grid
      EXPORTING
        i_parent = alv_container.

    CALL METHOD alv_grid->set_table_for_first_display
      EXPORTING
        is_layout       = alv_layout
        i_buffer_active = false
      CHANGING
        it_fieldcatalog = g_it_fieldcatalog
        it_outtab       = <fs_results>.

  ELSE.
    CALL METHOD alv_grid->set_frontend_fieldcatalog
      EXPORTING it_fieldcatalog = g_it_fieldcatalog.

    CALL METHOD alv_grid->refresh_table_display.

  ENDIF.
ENDMODULE.                 " display_alv  OUTPUT

Does anybody have an idea what (probably very basic thing) I'm doing wrong?

Thanks a lot in advance,

Roland

1 REPLY 1

Former Member
0 Kudos

Oh man, I was trying to solve that problem for hours and five minutes after posting here I find the solution...

Instead of calling alv_grid->refresh_table_display, I just call alv_grid->set_table_for_first_display all the time.

MODULE display_alv OUTPUT.
  PERFORM prepare_data.
  PERFORM prepare_field_catalog CHANGING g_it_fieldcatalog.

  IF alv_container IS INITIAL.
    CREATE OBJECT alv_container
      EXPORTING
        container_name = alv_containernm.

    CREATE OBJECT alv_grid
      EXPORTING
        i_parent = alv_container.

  ELSE.
    CALL METHOD alv_grid->set_frontend_fieldcatalog
      EXPORTING
        it_fieldcatalog = g_it_fieldcatalog.

  ENDIF.

  CALL METHOD alv_grid->set_table_for_first_display
    EXPORTING
      is_layout       = alv_layout
      i_buffer_active = false
    CHANGING
      it_fieldcatalog = g_it_fieldcatalog
      it_outtab       = <fs_results>.

ENDMODULE.                 " display_alv  OUTPUT