cancel
Showing results for 
Search instead for 
Did you mean: 

Switching ALV on a dynpro container -> old ALV remains visible

jrgkraus
Active Contributor
0 Kudos
117

Hello, I have a dynpro with a custom container on it. I consecutively want to display two different ALV grids on this. The flow is like this:

  • call the screen
  • instantiate a container object on the screen container (PBO)
  • instantiate the first alv grid with the container object
  • display the first ALV
  • After the user leaves the display:
  • leave the screen
  • free the container object
  • call the screen again
  • instantiate a new container object on the screen
  • instantiate the second alv grid with the (new) container object
  • display the second ALV

As a result, the first ALV shows up again on my screen where I expected to see the second ALV. What am I missing?

Accepted Solutions (0)

Answers (3)

Answers (3)

T-Luxa
Newcomer
0 Kudos

Hello,

I assume the problem is related to the lifetime/linkage of container-1 to the dynpro. The default lifetime is "lifetime_imode"; you can set this either to "lifetime_dynpro" (see parameter lifetime in the constructor) or use the link() method (see below).

Since you are using a custom container, the link is obviously not being released by calling the free( ) method, make sure you also freed the reference variable for container-1. If this doesn't work you can set the link using the link() method for container-2.

I would prefer to use only one container for both grids and setting the visibility of the two grids by calling set_visibility(true/false). The optimal solution, of course, depends on your use case. The proposed solution consumes more memory, as both grids are stored in memory. This can be a problem if both grids contain a lot of data.

I hope this was helpful.

Enjoy!

ulrich_mhrke
Participant
0 Kudos

Did you call method FREE of the container object?

0 Kudos

Hi,

Which ALV class are you using? Did you clear the old ALV entries and assigned the second ALV to the container? It looks like you didn't refresh the assignement. Maybe you could provide some coding?