Data declaration
After learning about the objects in the Data Dictionary, we can start talking about the syntax declaration in ABAP. The easiest way to declare variables is as follows:
data: lv_first_variable TYPE c.
Variables are named data objects that are used to store values within the allotted memory area of a program. It is good practice to properly name local variables. It is assumed that the first two characters in the variable name determine its use. The first letter indicates whether the variable is global or local. If the local variable starts with l
, then in the case of global variables, g
is the first letter. The second character determines what type the object is:
- Variable:
v
- Line:
s
- Internal table:
t
Each variable must have a type that describes what is stored inside. A variable may have the following types:
- Elementary types
- References
- User-defined types
- Generic ABAP types
In the ABAP language, you can use predefined types to define local data types and objects in a program and to specify...