Skip to Content
avatar image
Former Member

Editable ALV Grid Refresh Issue

Ok, so this is hard to explain but I will try my best...

I have an issue with an editable grid not refreshing to a blank state after the user exits then re-executes the program.

When the user successfully enters and saves data in the editable grid, the program clears all internal tables and destroys all obejcts related to the grid. However, when the program is re-executed from the selection screen the program displays the editable grid again with the data that was just entered in the previous session. In debugging mode, I can see that the internal table for the grid is empty and that the object is not carried over from the previous run.

This only happens if the user goes into the transaction, enters data, saves the data, backs to the selection screen, and then re-executes. It DOES NOT happen if the user executes, enters data, saves the data, and then exits all the way out to the SAP Easy Acess Menu.

I have tried the refresh grid method, it does not fix this issue. The grid is contained within a custom control on a custom dynpro.

Any ideas would be much appreciated, will award points for solution.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Apr 11, 2006 at 01:01 PM

    Are you destroying and FREEing both the grid object as well as <b>the container object</b>?

    Here is an example PAI.

      case sy-ucomm.
        when 'BACK' or 'CANC'.
    <b>    if not alv_container is initial.
            call method alv_container->free.
            clear: alv_container.
            free : alv_container.
          endif.</b>
          if sy-subrc = 0.
            set screen 0.
            leave screen.
          else.
            leave program.
          endif.
        when 'EXIT'.
          if not alv_container is initial.
            call method alv_container->free.
            clear: alv_container.
            free : alv_container.
          endif.
          leave program.
      endcase.

    Regards,

    Rich Heilman

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      It was the 'call method alv_container->free.' statement i was missing with the CLEAR and FREE statements.

      Thanks,

      Brian.

  • avatar image
    Former Member
    Apr 11, 2006 at 01:04 PM

    Brian,

    Would it be possible to post the code here?

    Sounds like its an issue with the variables.

    Also, I am guessing that you would be creating the containers in PAI. Put a IF condition to check for existence of the same before creating the containers.

    Regards,

    Ravi

    Message was edited by: Ravikumar Allampallam

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 11, 2006 at 01:05 PM

    This has nothing to do with the ALV grid. When the user goes back to the selection screen, your variables that hold the data including the internal table that is used in the grid are still holding the previous contents. You will have to clear the contents when the user goes back to the selection screen. There are two way to do this. In the very begining, in your start-of-selection, clear all the variables, internal tables and then start the processing. Another option is to use FREE MEMORY at the end of code as the last executable statement in END-OF-SELECTION.

    Add comment
    10|10000 characters needed characters exceeded