The STATICS Statement

If you want to retain the value of a variable beyond the runtime of a procedure (subroutine or function module - for more information, see Modularizing ABAP Programs), you define the variable with the STATICS statement in that procedure. The STATICS statement is a variation of the DATA statement. The syntax is as follows:

Syntax

STATICS <s>[<length>] <type> [<value>] [<decimals>].

To define field strings in a procedure as statically valid, you write:

STATICS: BEGIN OF <fstring>,
<component declaration>,
..............
           END OF <fstring>.

The parameters of these statements are identical to those for the DATA statement, described in The Basic Form of the DATA Statement and The DATA Statement for Structures.

If you call a procedure from your program several times, the procedure always uses the last value of a variable defined with STATICS in the procedure. A static variable cannot be addressed from outside of the procedure.