Static Variables
Static variables are declared in subroutines, function modules, and static methods.
The lifetime is linked to the context of the declaration.
With ‘CLASS-DATA’ statement, you can declare variables within the classes.
The ‘PARAMETERS’ statement can be used to declare the elementary data objects that are linked to input fields on a selection screen.
You can also declare the internal tables that are linked to input fields on a selection screen by using ‘SELECT-OPTIONS’ statement.
Following are the conventions used while naming a variable −
You cannot use special characters such as "t" and "," to name variables.
The name of the predefined data objects can’t be changed.
The name of the variable can’t be the same as any ABAP keyword or clause.
The name of the variables must convey the meaning of the variable without the need for further comments.
Hyphens are reserved to represent the components of structures. Therefore, you are supposed to avoid hyphens in variable names.
The underscore character can be used to separate compound words.
This program shows how to declare a variable using the PARAMETERS statement −
REPORT ZTest123_01.
PARAMETERS: NAME(10) TYPE C,
CLASS TYPE I,
SCORE TYPE P DECIMALS 2,
CONNECT TYPE MARA-MATNR.
Serkan AKKAVAK
Computer Engineer BSc
SAP Department Manager
Contact : serkurumsal@yandex.com
0 Comments