SAP Tutorials Blog


Static variables have fixed-length types and reserve a data range in memory. For example:


data gv_name type c(50).

In this example, gv_name is a static variable. It has a data type c whose length is 50.


Note that the variable name starts with gv_ and its description. This is a common practice to make the code more readable. By convention, g means global, v stands for the variable. So gv_name indicates that it is a global variable. To declare local variables, you use lv_ prefix e.g., lv_name.


You can specify an initial value for a static variable by using the optional value keyword like this:


data gv_name type c(50) value 'John Doe'.

In this example, the gv_name takes the literal characters 'John Doe' as the initial value. If you do not specify the initial value for gv_name, its defaults value is blank.


Serkan AKKAVAK

Computer Engineer BSc

SAP Department Manager

Contact : serkurumsal@yandex.com