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: 

declaring variable

Former Member
0 Kudos
84

How to declare a static variable in the report program...

1 ACCEPTED SOLUTION

Former Member
0 Kudos
55

Hi Mahesh,

Its as simple as declaring normal variables. We will use STATICS instead of DATA Keyword.

Check the following syntaxes to declare a static variable.

1. STATICS f.

2. STATICS f(len).

3. STATICS: BEGIN OF rec,

...

END OF rec.

4. STATICS: BEGIN OF itab OCCURS n,

...

END OF itab.

Static validity means that, unlike normal local variables, the life of static variables does not depend on the defining procedure, but on the program at runtime. Static variables are thus not redefined on the stack each time the defining procedure is called, but exist independently of this in the program and keep their value, regardless of calls to the defining procedure.

Thanks,

Vinay

2 REPLIES 2

Former Member
0 Kudos
56

Hi Mahesh,

Its as simple as declaring normal variables. We will use STATICS instead of DATA Keyword.

Check the following syntaxes to declare a static variable.

1. STATICS f.

2. STATICS f(len).

3. STATICS: BEGIN OF rec,

...

END OF rec.

4. STATICS: BEGIN OF itab OCCURS n,

...

END OF itab.

Static validity means that, unlike normal local variables, the life of static variables does not depend on the defining procedure, but on the program at runtime. Static variables are thus not redefined on the stack each time the defining procedure is called, but exist independently of this in the program and keep their value, regardless of calls to the defining procedure.

Thanks,

Vinay

Former Member
0 Kudos
55

Hi,

STATICS: To declare variables with static validity in procedures

variables defined with STATICS are static attributes that are only visible in the corresponding method

Regards

Sudheer