Skip to Content

ALV not getting refreshed when call screen is executed second time

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

Add comment
10|10000 characters needed characters exceeded

2 Answers

  • Best Answer
    Posted on Sep 17, 2011 at 06:31 AM

    Hi amber,

    when you press back before LEAVE TO SCREEN 9001,

    try this,

    clear obj_alv.

    free: obj_alv.

    hope this may help u,

    Thanks & Regards,

    Kiran

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 18, 2011 at 01:37 PM

    @Manu:-

    I am also have same issue i make one GUI status , the process of screen as follow

    Screen 100 -


    > this User Slection screen, Here user start to make input and one Push button 'Display" when user click this Display the Programme Goes to Screen--101

    Screen 101------> this is the result screen here ALV grid Display shows the result,

    Now user click the Back Button (Standard Tool Bar) , then he see the first screen means screen 100 (Input screen)

    Now user changes the value and again click Display for result ,so the problem is User can not see the correct result after pressing back , ALV shows the old result below is my code where i exporting the filed catalog.

     PERFORM get_fieldcatalog.
    
      CALL METHOD alv_grid->set_table_for_first_display
        EXPORTING
          is_layout        = layout
          is_variant       = variant
          i_save           = 'U'
          i_structure_name = 'I_ALV2'
    
        CHANGING
    
          it_outtab        = i_alv2[]
          it_fieldcatalog  = fieldcat[].
    

    Plz give me some suggestion how to solve this issue.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      Check answer above...

      your screen 100 is the screen 9001 in example while your screen 101 is the screen 9002. This is basically the same issue...

      When the BACK function is triggered, clear your objects.

      Kr,

      Manu.