Application Development and Automation 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: 
Read only

UN-DATA command for local variables

0 Likes
1,903

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
Read only

Sandra_Rossi
Active Contributor
1,777

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

Read only

retired_member
Product and Topic Expert
Product and Topic Expert
1,777

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

0 Likes
1,777

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?

Read only

retired_member
Product and Topic Expert
Product and Topic Expert
1,777

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

Read only

1,777

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

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,777

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

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

Read only

retired_member
Product and Topic Expert
Product and Topic Expert
0 Likes
1,777

Did you mean that? Kinda different ...

Read only

0 Likes
1,777

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