-1

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.

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
icbytes
  • 1,831
  • 1
  • 17
  • 27
  • Can you give a code example of what you're talking about? – Bryan Cain Apr 28 '17 at 13:27
  • Unfortunately not, this would be really much code. But I figured out, why I received an empty reference. I was inside a PBO badi method and the grid simply was not instantiated in that time. I got working differently. – icbytes Apr 30 '17 at 11:14
  • What you call "dirty assign" is probably this special form of ASSIGN, `ASSIGN ('(programname)globalvariable') TO `, which permits to read a global variable from an ABAP program loaded into memory, but which is not officially supported by SAP. – Sandra Rossi Dec 26 '20 at 08:58

2 Answers2

0

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:

The lifetime of a control is regulated by the lifetime management. Lifetime management automatically destroys controls at the frontend when they are no longer needed. The application program of course also supports an explicit destruction of controls.

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.

szako
  • 1,271
  • 1
  • 9
  • 12
0

using dirty assigns is in general a very bad idea, as it breaks at least two principles of software design (Encapsulation and Interfacing) and therefore might damage the domains of security and robustness. For some Explanation of what can went wrong when using dirty assigns you can read this blog of me Agreements must be kept

lichtbringer
  • 120
  • 9