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 OO data is not refreshing when selection changes on previous screen

Sougata
Active Contributor
0 Likes
1,468

Hi All,

I have a module pool with 2 screens. First screen has plant and 1 button. When button is pressed in screen 1 the 2nd screen shows some data as per the plant selection in screen 1. The output of screen 2 is coded in OO ALV.

Now the problem is first time when plant is input and button is pressed the data is fine in screen 2. However 2nd time onwards the data is not getting updated on ALV when plant selection is changed! It gets stuck to the data it produced the very first time.

I've debugged the program and table which passes to method "set_table_for_first_display" is fine i.e. it selects new data everytime as per plant and fills this table. I've also tried GUI FLUSH, calling method "refresh_table_display", FREE, clear, unassign etc. etc. at diff. points but nothing seems to work

<b>I'll be generously giving away points with any help.</b>

Thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
620

Hi,

1. Please refresh the output table before the select query which you are passing to set_table_for_first_display.

2. The ALV container needs to be freed & again generated everytime you call the screen.

so on the BACK button of Screen 2 in PAI, release & clear the container

In the PBO of Screen 2, Assign grid to container.

Here is the sample program:



PROGRAM TEST.
DATA: OK_CODE LIKE SY-UCOMM,
      GT_SFLIGHT TYPE TABLE OF SFLIGHT,
      G_CONTAINER TYPE SCRFNAME VALUE 'BCALV_GRID_DEMO_0100_CONT1',
      GRID1  TYPE REF TO CL_GUI_ALV_GRID,
      G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
*---------------------------------------------------------------------*
*       MAIN                                                          *
*---------------------------------------------------------------------*

SELECT * FROM SFLIGHT INTO TABLE GT_SFLIGHT.

CALL SCREEN 100.


*---------------------------------------------------------------------*
*       MODULE PBO OUTPUT                                             *
*---------------------------------------------------------------------*
MODULE PBO OUTPUT.
  SET PF-STATUS 'MAIN100'.
  IF G_CUSTOM_CONTAINER IS INITIAL.  " Check this
    CREATE OBJECT G_CUSTOM_CONTAINER  " DO this
           EXPORTING CONTAINER_NAME = G_CONTAINER.
    CREATE OBJECT GRID1  "DO this
           EXPORTING I_PARENT = G_CUSTOM_CONTAINER.
    CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
         EXPORTING I_STRUCTURE_NAME = 'SFLIGHT'
         CHANGING  IT_OUTTAB        = GT_SFLIGHT.
  ENDIF.
ENDMODULE.
*---------------------------------------------------------------------*
*       MODULE PAI INPUT                                              *
*---------------------------------------------------------------------*
MODULE PAI INPUT.
*   to react on oi_custom_events:
    call method cl_gui_cfw=>dispatch.
  CASE OK_CODE.
    WHEN 'EXIT'.
      PERFORM EXIT_PROGRAM.
    WHEN OTHERS.
*     do nothing
  ENDCASE.
  CLEAR OK_CODE.
ENDMODULE.
*---------------------------------------------------------------------*
*       FORM EXIT_PROGRAM                                             *
*---------------------------------------------------------------------*
FORM EXIT_PROGRAM.
 CALL METHOD G_CUSTOM_CONTAINER->FREE. " Do under BACK button
 CALL METHOD CL_GUI_CFW=>FLUSH. "Do under back button
  LEAVE PROGRAM.
ENDFORM.

Hi,

1. Please refresh the output table before the select query which you are passing to set_table_for_first_display.

2. The ALV container needs to be freed & again generated everytime you call the screen.

so on the BACK button of Screen 2 in PAI, release & clear the container

In the PBO of Screen 2, Assign grid to container.

Here is the sample program:



PROGRAM TEST.
DATA: OK_CODE LIKE SY-UCOMM,
      GT_SFLIGHT TYPE TABLE OF SFLIGHT,
      G_CONTAINER TYPE SCRFNAME VALUE 'BCALV_GRID_DEMO_0100_CONT1',
      GRID1  TYPE REF TO CL_GUI_ALV_GRID,
      G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
*---------------------------------------------------------------------*
*       MAIN                                                          *
*---------------------------------------------------------------------*

SELECT * FROM SFLIGHT INTO TABLE GT_SFLIGHT.

CALL SCREEN 100.


*---------------------------------------------------------------------*
*       MODULE PBO OUTPUT                                             *
*---------------------------------------------------------------------*
MODULE PBO OUTPUT.
  SET PF-STATUS 'MAIN100'.
  IF G_CUSTOM_CONTAINER IS INITIAL.  " Check this
    CREATE OBJECT G_CUSTOM_CONTAINER  " DO this
           EXPORTING CONTAINER_NAME = G_CONTAINER.
    CREATE OBJECT GRID1  "DO this
           EXPORTING I_PARENT = G_CUSTOM_CONTAINER.
    CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
         EXPORTING I_STRUCTURE_NAME = 'SFLIGHT'
         CHANGING  IT_OUTTAB        = GT_SFLIGHT.
  ENDIF.
ENDMODULE.
*---------------------------------------------------------------------*
*       MODULE PAI INPUT                                              *
*---------------------------------------------------------------------*
MODULE PAI INPUT.
*   to react on oi_custom_events:
    call method cl_gui_cfw=>dispatch.
  CASE OK_CODE.
    WHEN 'EXIT'.
      PERFORM EXIT_PROGRAM.
    WHEN OTHERS.
*     do nothing
  ENDCASE.
  CLEAR OK_CODE.
ENDMODULE.
*---------------------------------------------------------------------*
*       FORM EXIT_PROGRAM                                             *
*---------------------------------------------------------------------*
FORM EXIT_PROGRAM.
 CALL METHOD G_CUSTOM_CONTAINER->FREE. " Do under BACK button
 CALL METHOD CL_GUI_CFW=>FLUSH. "Do under back button
  LEAVE PROGRAM.
ENDFORM.

1 REPLY 1
Read only

Former Member
0 Likes
621

Hi,

1. Please refresh the output table before the select query which you are passing to set_table_for_first_display.

2. The ALV container needs to be freed & again generated everytime you call the screen.

so on the BACK button of Screen 2 in PAI, release & clear the container

In the PBO of Screen 2, Assign grid to container.

Here is the sample program:



PROGRAM TEST.
DATA: OK_CODE LIKE SY-UCOMM,
      GT_SFLIGHT TYPE TABLE OF SFLIGHT,
      G_CONTAINER TYPE SCRFNAME VALUE 'BCALV_GRID_DEMO_0100_CONT1',
      GRID1  TYPE REF TO CL_GUI_ALV_GRID,
      G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
*---------------------------------------------------------------------*
*       MAIN                                                          *
*---------------------------------------------------------------------*

SELECT * FROM SFLIGHT INTO TABLE GT_SFLIGHT.

CALL SCREEN 100.


*---------------------------------------------------------------------*
*       MODULE PBO OUTPUT                                             *
*---------------------------------------------------------------------*
MODULE PBO OUTPUT.
  SET PF-STATUS 'MAIN100'.
  IF G_CUSTOM_CONTAINER IS INITIAL.  " Check this
    CREATE OBJECT G_CUSTOM_CONTAINER  " DO this
           EXPORTING CONTAINER_NAME = G_CONTAINER.
    CREATE OBJECT GRID1  "DO this
           EXPORTING I_PARENT = G_CUSTOM_CONTAINER.
    CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
         EXPORTING I_STRUCTURE_NAME = 'SFLIGHT'
         CHANGING  IT_OUTTAB        = GT_SFLIGHT.
  ENDIF.
ENDMODULE.
*---------------------------------------------------------------------*
*       MODULE PAI INPUT                                              *
*---------------------------------------------------------------------*
MODULE PAI INPUT.
*   to react on oi_custom_events:
    call method cl_gui_cfw=>dispatch.
  CASE OK_CODE.
    WHEN 'EXIT'.
      PERFORM EXIT_PROGRAM.
    WHEN OTHERS.
*     do nothing
  ENDCASE.
  CLEAR OK_CODE.
ENDMODULE.
*---------------------------------------------------------------------*
*       FORM EXIT_PROGRAM                                             *
*---------------------------------------------------------------------*
FORM EXIT_PROGRAM.
 CALL METHOD G_CUSTOM_CONTAINER->FREE. " Do under BACK button
 CALL METHOD CL_GUI_CFW=>FLUSH. "Do under back button
  LEAVE PROGRAM.
ENDFORM.