Skip to Content
Former Member
Nov 16, 2006 at 07:38 PM

Switching tables on OO ALV Grid?


Hello All, Im trying to make a simple switch button to switch tables in an OO ALV Grid,

I have two tables with the same structure one is for the items, and the other is a summarized version of the items (with totals and other calculations).

<i>I can't use the standards subtotals from SAP because I need to show others results beside the required totals in the ALV summarized</i>

What I did was to create a field symbol and when the user clicks on the summarize button the program will assign the summarized table to the field symbol and then i'll do a refresh_table_display and that should be it.

Here are portions of my code:

* this is in the PBO
    ASSIGN it_data to <table>.
    CALL METHOD grid->set_table_for_first_display
        i_structure_name     = '<table>'                        "<--- Field Symbol
        is_variant           = ls_vari
        is_layout            = gs_layout
        it_toolbar_excluding = lt_exclude
        is_print             = ls_print
        i_save               = 'A'
        it_sort              = lt_sort
        it_fieldcatalog      = gt_fieldcat
        it_outtab            = <table>.

* This is in the PAI (user command)
CASE sy-ucomm.
    IF ( summarize_flag EQ 'X' ).
      CLEAR summarize_flag.
      ASSIGN it_data[] TO <table>.
      summarize_flag = 'X'.
      ASSIGN it_summarized[] TO <table>.
    CALL METHOD grid->refresh_table_display.

But it's not working.... any ideas of why?

TIA, Mauro.

Message was edited by:

Mauro Blanc