Beruflich Dokumente
Kultur Dokumente
P: Packed #
T: Time
F: Floating Point #
X: Hexadecimal #
STRING
XSTRING
3/14/2014
N: Numeric Text
P: Packed #
T: Time
F: Floating Point #
X: Hexadecimal #
STRING
XSTRING
3/14/2014
Declaring Variables
DATA: PLAYER(35) TYPE C, NICKNAME(35), POINTS TYPE I, GAMES TYPE I AVERAGE(5) TYPE P, STARTER, ACQUIRED TYPE D.
VALUE 10,
3/14/2014
Initial Values
C: (blank) N: zeroes I: zero D: 00000000
P: zero
T: 000000
F: zeroes
X: 00
The CLEAR statement sets a field back to its initial value, not its default value.
3/14/2014 ABAP Data Declarations | 5
3/14/2014
Use the LIKE addition to declare fields with the same format (i.e., data type and length)
DATA:
3/14/2014
Declaring Constants
The VALUE addition is required.
CONSTANTS: TEAM1(20) TYPE C VALUE 76ers, TEAM2 TYPE TEAM1 VALUE Celtics, TOT_GAMES TYPE I VALUE 82.
If you attempt to change the value of a constant, a syntax error will occur.
3/14/2014
A user-defined data type created with the TYPES statement is used to specify a fields data type in the TYPE addition of the DATA or CONSTANTS statements.
3/14/2014
These fields are not aligned because of the different standard output lengths of the numeric type fields.
3/14/2014
10
DATA:
MOVE President TO TITLE. COMPUTE SALARY = 5000000. CNVSALARY = SALARY * 3. ADD 1000 TO SALARY.
3/14/2014
11
Arithmetic Expressions
Operators + - * / ** DIV and MOD Functions SQRT, EXP, LOG, SIN, COS, STRLEN, . . .
COUNTER = COUNTER + 1. SALARY = BASE * BONUS_PERCENT. LENGTH = STRLEN( NAME ). ANSWER = ( 10 + SQRT( NUM1 ) ) / ( NUM2 - 10 ).
3/14/2014
12
3/14/2014
13
Selection Screen
3/14/2014 ABAP Data Declarations | 14
Selection Texts
These selection texts will be used on the selection screen instead of the parameter names.
3/14/2014
16
<FSYMBOL> = 1234567890.
WRITE: / Field Symbol =, <FSYMBOL>. ULINE. WRITE: / Text Line =, TEXT_LINE.
3/14/2014
17
FIELD
SY-UZEIT
Selection Screen
List
18
Summary
DATA statement is used to declare a variable (or field) in an ABAP program "LIKE" and "TYPE" statements are used to declare fields with reference to other variables or fields CONSTANTS statement is used to declare a constant Text elements can be used to maintain a programs title and column headings,
selection texts, and text symbols. These text elements can be maintained in multiple languages A field symbol does not reserve space for the field, but points to the field ASSIGN statement associates a field to a field symbol at runtime The system carries out automatic type conversion if variables are not of the same type ABAP allows to display and change portions of a field by specifying an offset and length
3/14/2014
19