Quotation marks mean type C and text field literals
“back quotes” mean type STRING and string literals
Text field literals
1
2
3
REPORT YR_SEP_12.
Write'Tutorials Point'.
Write / 'ABAP Tutorial'.
String field literals
1
2
3
REPORT YR_SEP_12.
Write `Tutorials Point `.
Write / `ABAP Tutorial `.
The output is same in both the above cases
1
2
Tutorials Point
ABAP Tutorial
Note − When we try to change the value of the constant, a syntax or run-time error may occur. Constants that you declare in the declaration part of a class or an interface belong to the static attributes of that class or interface.
三、CONSTANTS Statements
1
CONSTANT <f> TYPE <type> VALUE <val>.
Note − We should use the VALUE clause in the CONSTANTS statement. The clause ‘VALUE’ is used to assign an initial value to the constant during its declaration.
Elementary constant
1
2
3
REPORT YR_SEP_12.
CONSTANTS PQR TYPE P DECIMALS 4 VALUE '1.2356'.
Write: / 'The value of PQR is:', PQR.
The output is
1
The value of PQR is: 1.2356
Complex constant
1
2
3
4
5
BEGINOF EMPLOYEE,
Name(25) TYPE C VALUE 'Management Team',
Organization(40) TYPE C VALUE 'Tutorials Point Ltd',
Place(10) TYPE C VALUE 'India',
ENDOF EMPLOYEE.
Reference constant
1
CONSTANTS null_pointer TYPE REF TOobject VALUE IS INITIAL.