Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

UN-DATA command for local variables

0 Kudos

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

8 REPLIES 8

Sandra_Rossi
Active Contributor

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

horst_keller
Product and Topic Expert
Product and Topic Expert

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.

0 Kudos

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

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?

horst_keller
Product and Topic Expert
Product and Topic Expert

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 ...

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

0 Kudos

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

I have already started my planning to use Test-seams 😉

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

Did you mean that? Kinda different ...

0 Kudos

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