SAP STATICS ABAP Statements



Get Example source ABAP code based on a different SAP table
  


ID STATICS
• STATICS ABAP Statement

STATICS
Short Reference

ABAP_SYNTAX
STATICS stat $[options$].

What does it do?
Declares static variables stat. The statement STATICS for declaring static variables can only be used in static methods, function modules, and subroutines.
The naming conventions apply to the name stat. The syntax of the additions options is the same as for the statement DATA for declaring regular variables. Only the additions READ-ONLY and BOXED, and the declaration of LOB handle structures are not possible.
As with regular local variables, variables declared using STATICS are only visible within their procedure. However, the lifetime of a variable declared using STATICS corresponds to that of a global data object. The variable is created once when the compilation unit is loaded into the ABAP_ISESS , and its content is assigned the start value of the VALUE addition. Calling and ending the procedure have no effect on the lifetime and content.



Latest notes:

In instance methods, the statement STATICS is not allowed. Instead, static attributes of the class declared using CLASS-DATA can be used.
NON_V5_HINTS
ABAP_HINT_END



Example ABAP Coding

The method meth produces the same result for the variable local for each call, since it is instantiated again in every call. However, the static variable static already exists and its value is increased by 1 for each call.
ABEXA 00690
ABAP_EXAMPLE_END

Return to menu