This website is not affiliated with, sponsored by, or approved by SAP AG.

Update data in cl_gui_alv_grid=>set_table_for_first_display

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Update data in cl_gui_alv_grid=>set_table_for_first_display

Postby Baz » Tue Jul 07, 2015 8:47 am

Hello

I was working on this yesterday and finally got it working:

Code: Select all
*----------------------------------------------------------------------*
***INCLUDE ZXCSAO03 .
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&      Module  STATUS_1000  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_1000 OUTPUT.

  DATA:   gv_fcat         TYPE lvc_s_fcat,
          gt_fieldcatalog TYPE TABLE OF lvc_s_fcat,
          gs_layout       TYPE lvc_s_layo.

  DATA: g_grid             TYPE REF TO cl_gui_alv_grid.
  DATA:  gt_bom_table     TYPE TABLE OF zpp_bom_table.

  DATA: gr_table   TYPE REF TO cl_salv_table.

  DATA : g_container_name        TYPE scrfname VALUE 'BOM_ALV',
         g_custom_container TYPE REF TO cl_gui_custom_container.

  REFRESH gt_bom_table.

  CREATE OBJECT g_custom_container
    EXPORTING
      container_name = g_container_name.

*     Create GRID object with reference to parent name
  CREATE OBJECT g_grid
    EXPORTING
      i_parent = g_custom_container.

  PERFORM u_prepare_fieldcatalog.
  gs_layout-zebra      = 'X'.
  gs_layout-no_toolbar = 'X'.
  gs_layout-cwidth_opt = 'X'.

  PERFORM get_data.

*-- Display data
  CALL METHOD g_grid->set_table_for_first_display
    EXPORTING
      is_layout            = gs_layout
*     it_toolbar_excluding = gt_exclude
      i_bypassing_buffer   = abap_true
    CHANGING
      it_fieldcatalog      = gt_fieldcatalog
      it_outtab            = gt_bom_table. " Data




ENDMODULE.                 " STATUS_1000  OUTPUT


However what i did not notice is when you move from Item 0001 Customer fields to Item 0003 customer fields, the data is not updated.

The perform GET_DATA updates the correct information each time, however this does not seem to be reflected in the table display.

I have tried to refresh the data and clear the structures on the PAI however it always seems to display the same data unless exit out of the items each time which is not practical.

Is there another way i can refresh the ALV grid each time the PBO module is called?
Baz

AsPiRiNg tUlY iDiOt Image

http://www.catb.org/~esr/faqs/smart-questions.html

Image

check out my Podcasts http://dj-baz.podomatic.com
Baz
 
Posts: 4736
Joined: Fri Nov 08, 2002 5:54 am
Location: He's out there! somewhere!!!!

Re: Update data in cl_gui_alv_grid=>set_table_for_first_display

Postby Gothmog » Tue Jul 07, 2015 9:09 am

Have you tried using method REFRESH_TABLE_DISPLAY in your PBO?
Code: Select all
IF g_custom_container IS NOT BOUND.
*  (...do as you do now)
ELSE.
  g_grid->refresh_table_display( ).
ENDIF.
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67
Gothmog
 
Posts: 1941
Joined: Wed Sep 12, 2007 4:46 am
Location: Probably not home

Re: Update data in cl_gui_alv_grid=>set_table_for_first_display

Postby Baz » Tue Jul 07, 2015 9:36 am

I had done and there was no difference.

But now i have added a the PERFORM GET_DATA before the refresh table display and it works! :D

Thanks again Gothmog! been banging my head a while on that one....
Baz

AsPiRiNg tUlY iDiOt Image

http://www.catb.org/~esr/faqs/smart-questions.html

Image

check out my Podcasts http://dj-baz.podomatic.com
Baz
 
Posts: 4736
Joined: Fri Nov 08, 2002 5:54 am
Location: He's out there! somewhere!!!!

Re: Update data in cl_gui_alv_grid=>set_table_for_first_display

Postby Rich » Mon Jul 13, 2015 4:39 am

Baz wrote:But now i have added a the PERFORM GET_DATA before the refresh table display and it works! :D



Errrm......
Regards

Rich

Image
Abap KC:http://www.richard-harper.me.uk/Kb
SFMDR:http://www.se37.com
Rich
 
Posts: 7112
Joined: Thu Oct 31, 2002 4:47 pm
Location: Liverpool


Return to ABAP

Who is online

Users browsing this forum: No registered users and 11 guests





loading...


This website is not affiliated with, sponsored by, or approved by SAP AG.