Skip to Content
0

UN-DATA command for local variables

Nov 28, 2016 at 11:04 AM

87

avatar image

Hello,

I try to follow the programming paradigm, that the lifespan of variables should be kept as short as possible. I miss an UNDATA-statement to kill a local variable after use. It should make code much better: After you are done, the variable is killed. The variable name hereby becomes available for reuse.

This looks so simple to realize. Why does it not exist? Note, that my focus is not on reducing memory, but to shorten the lifespan.

Any reply from the SAP ABAP-developers? Thank you in advance, / Ulrich

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Sandra Rossi Nov 28, 2016 at 01:29 PM
1

If I remember well, Horst Keller said a few weeks ago that it could soon arrive (7.52?)

Show 7 Share
10 |10000 characters needed characters left characters exceeded

Huh, did I? Point me there, what it was about. For the time being the request can be fulfilled with data reference variables.

var = NEW i( 123 ).

... var->* ...

CLEAR var.
1

oh sorry then, but maybe you can talk to the ABAP/kernel guys :D

Didn't you talk about kind of start/end blocks within the procedures, where the declared data may only be used there, or something like that?

0

Hmm, no currently I'm not aware of such plans. The visibility/usability of data objects in ABAP is in fact kind of queer. You know that: statically visible behind declaration, dynamically usable in whole context. Even the new inline declarations or the LET expressions rather enhance the queerness instead of offering real local visibility. Therefore ...

1

Thanks for correcting me Horst :) Anyway, 7.40+ is so cool (and I'm impatient to know what comes in future releases...)

1

We'll be upgrading to ABAP 750 next year, yayyy!!!

I have already started my planning to use Test-seams ;-)

0

Did you mean that? Kinda different ...

0

Nope, I didn't think to “static single assignment”. Probably it was a dream and I thought it would become real :D

0