The new requirement which MIGHT be easily solved by the trick mentioned in the topic needs to be verified.
Besides the dirty kind of realization the consultant said, that he allows us to use dirty assigns.
So I started, inside a BADI method, and got two dirty assigns to work properly.
One is assigning an object which has no references to GUI objects and the other assigns only a data table. Both reside in the same, other program.
Now I want to get a fieldsymbol to be assigned from one of the same program's ALV grids.
SY-SUBRC returns 0, but the fieldsymbol later on points to INITIAL. I can imagine, that this is, in terms of security, not allowed.
Anyway I just ask in here to get the confirmation or correction for my assumption.
It is not related to security as far as I know. There are techniques to avoid the possibility of dirty assign, but that's another story. When defined as global the references to GUI controls still stay there as a normal, reachable, variables, but those can be initialized after some time.
Looked up the official CFW documentation for backing me up and there they write:
So that means references to GUI controls on server side can be cleaned, initialized either by the handling program explicitly or automatically by the system itself (kind of "garbage collector").
More information about controls lifetime here.