Skip to Content
0
Sep 16, 2011 at 09:41 AM

ALV not getting refreshed when call screen is executed second time

4095 Views

I have 2 screens 9001 and 9002. In 9001 , I am displaying the fields of a database table in a Table Control. The user has to select some of those fields and click on a button 'Generate ALV'. After clicking , the control navigates to 9002 where I am displaying ALV with data in the selected fields(the other fields remain empty). (using custom container)

Now there is BACK button in 9002 where i have written LEAVE TO SCREEN 9001. After this if the user again make changes in column selection and click on 'Generate ALV' , then still the old alv data is displayed. (Mind you the structure of alv is same , only the selected fields should show data).

I am using REFRESH_ALV_DISPLAY also and when i tested this function independently , its working fine (although for interactive alv in the same screen).

I am making use of <fs> for dynamic internal table and i checked it using breakpoints , during the 2nd time , it contains the correctly updated data so i think the problem lies with alv

Kindly check this code

MODULE STATUS_9002 OUTPUT.
  SET PF-STATUS 'ZALV'.
*  SET TITLEBAR 'xxx'.

  CREATE OBJECT C_CONT
    EXPORTING
      CONTAINER_NAME               = 'CUST_CONT'
      .
  IF SY-SUBRC <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


 IF OBJ_ALV IS INITIAL.
  CREATE OBJECT OBJ_ALV
    EXPORTING
      I_PARENT           = C_CONT
      .

  CALL METHOD OBJ_ALV->SET_TABLE_FOR_FIRST_DISPLAY
     EXPORTING
       I_STRUCTURE_NAME              = INP_TABLE
     CHANGING
      IT_OUTTAB                      = <itab>
          .
 ELSE.
   CALL METHOD OBJ_ALV->REFRESH_TABLE_DISPLAY
           .
  ENDIF.
ENDMODULE.                 " STATUS_9002  OUTPUT 

Edited by: amber22 on Sep 16, 2011 6:45 PM