CONSTANTS : ABAP Keyword a day
CONSTANTS
Variants
1. CONSTANTS c. … VALUE [ val | IS INITIAL ].
2. CONSTANTS c(len) … VALUE [ val | IS INITIAL ].
3. CONSTANTS: BEGIN OF crec,
…
END OF crec.
Effect
The CONSTANTS statement defines global and local constants. Constants allow you to read statically declared data objects . They always have a particular data type. Data types and data objects are essential components of the ABAP/4 type concept . In contrast to variables defined with the DATA statement, you cannot change the value of a constant once it has been defined. Apart from the additions … TYPE typ OCCURS n , … LIKE f1OCCURS n and WITH HEADER LINE , all the additions used with the DATA statement are allowed. However, in contrast to the DATA statement, the addition … VALUE val or VALUE IS INITIAL obligatory with variants 1 and 2. See additions with DATA .
Example
CONSTANTS CHAR1 VALUE ‘X’.
CONSTANTS INT TYPE I VALUE 99.
CONSTANTS: BEGIN OF CONST_REC,
C(2) TYPE I VALUE ‘XX’,
N(2) TYPE N VALUE ‘12′,
X TYPE X VALUE ‘FF’,
I TYPE I VALUE 99,
P TYPE P VALUE 99,
F TYPE F VALUE ‘9.99E9′,
D TYPE D VALUE ‘19950101′,
T TYPE T VALUE ‘235959′,
END OF CONST_REC.
———————
ABAPer, mail: abap.community@gmail.com http://abaplearner.blogspot.com
If you like this post, you may as well like these too:
- ABAP Source Code: Types, data, constants REPORT ZSOURCE0402.* Type flag defines an abstract typeTYPES FLAG TYPE C. * Field address_flag will allocate space in main memory at runtimeDATA ADDRESS_FLAG TYPE FLAG VALUE ‘X’.* Constants are...
- CLEAR : ABAP Keyword a day CLEARBasic formCLEAR f.Additions 1. … WITH g2. … WITH NULL EffectResets the contents of f to its initial value. For predefined types (see DATA ), the following initial values...
- DATA : ABAP Keyword a day DATA Variants1. DATA f.2. DATA f(len).3. DATA: BEGIN OF rec,…END OF rec.4. DATA: BEGIN OF itab OCCURS n,…END OF itab.5. DATA: BEGIN OF COMMON PART c,…END OF COMMON PART.EffectDefines...
- ASSIGN: ABAP Keyword a day ASSIGN Variants:1. ASSIGN f TO .2. ASSIGN (f) TO .3. ASSIGN TABLE FIELD (f) TO .4. ASSIGN LOCAL COPY OF MAIN TABLE FIELD (f) TO .5. ASSIGN COMPONENT idx...
- ADD-CORRESPONDING : ABAP Keyword a day ADD-CORRESPONDING Basic form ADD-CORRESPONDING rec1 TO rec2. Effect Interprets rec1 and rec2 as field strings. If, for example, rec1 and rec2 are tables, executes the statement for their header...

















Leave a Reply