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.
Rich Heilman replied
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.