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: 

Statics keyword

Former Member
0 Kudos

Statics can be used only within Form....EndForm. Is there any similar thing which can be used outside Form so that one can persist data between calls to the subroutine

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Mala,

Static Local Data Objects

If you want to keep the value of a local data object after exiting the subroutine, you must use the STATICS statement to declare it instead of the DATA statement. With STATICS you declare a data object that is globally defined, but only locally visible from the subroutine in which it is defined.

But if you want to have a varibale outside the subroutines which persists their values between subroutine calls,it is better to define them as global variables and they will be available.

In case you have any further clarifications,do let me know.

Regards,

Puneet Jhari.

3 REPLIES 3

Clemenss
Active Contributor
0 Kudos

Hi Mala,

outside FORM variables are global: They are initialized at program start and will retain their values until end of program run.

STATICS means that the field will not lose it's value when the FORM processing is left. Next time the FORM is called, the value is still stored in the STATIC field. This means the variable field is like a global variable with the difference that you can not see it from outside the form.

Regards,

Clemens

Former Member
0 Kudos

Hi,

If you declare that variable globally (like in a top include). then that variable will be available..

Thanks

Naren

Former Member
0 Kudos

Hi Mala,

Static Local Data Objects

If you want to keep the value of a local data object after exiting the subroutine, you must use the STATICS statement to declare it instead of the DATA statement. With STATICS you declare a data object that is globally defined, but only locally visible from the subroutine in which it is defined.

But if you want to have a varibale outside the subroutines which persists their values between subroutine calls,it is better to define them as global variables and they will be available.

In case you have any further clarifications,do let me know.

Regards,

Puneet Jhari.