Chapter 04_ABAP Data Declarations
Chapter 04_ABAP Data Declarations
Objectives
I: Integer D: Date
P: Packed # T: Time
STRING XSTRING
I: Integer D: Date
P: Packed # T: Time
STRING XSTRING
Declaring Variables
Initial Values
C: (blank) N: zeroes
I: zero D: 00000000
P: zero T: 000000
F: zeroes X: 00
Declaring Constants
WRITE: / FLOAT,
/ FLOAT EXPONENT 1 DECIMALS 3,
/ FLOAT EXPONENT 0 DECIMALS 2,
/ PACK,
/ PACK DECIMALS 1,
/ INT DECIMALS 2.
9.876543210000000E+03
987.654E+01
9876.54
These fields are not aligned 12
because of the different 12.0
standard output lengths of
32.00
the numeric type fields.
Demonstration
Practice
DATA: TITLE(25),
SALARY TYPE P,
CNVSALARY TYPE SALARY,
Arithmetic Expressions
Operators Functions
+ - * / ** SQRT, EXP, LOG,
DIV and MOD SIN, COS, STRLEN, . . .
COUNTER = COUNTER + 1.
SALARY = BASE * BONUS_PERCENT.
LENGTH = STRLEN( NAME ).
ANSWER = ( 10 + SQRT( NUM1 ) ) / ( NUM2 - 10 ).
Sub-Fields in ABAP
* Start of Month
INV_DATE+6(2) = ‘01’. 90 xx 1996
CUSTOMER+6(4) = ‘ABCD’. 123456ABCD ----- 06/01/1996
WRITE: / CUSTOMER, ‘------’, INV_DATE.
Demonstration
Practice
ADD 10 TO NUM.
WRITE: / NUM,
‘----’,
NAME.
“Selection Screen”
Demonstration
Practice
<F1> = 32.
Line 1: 12 12 12 12
Line 2: 32 32 32 32
Demonstration
Practice
IF SY-SUBRC = 0.
WRITE: / ‘The contents of field’, FIELD, <FSYMBOL>.
ELSE.
WRITE: / ‘Failure assigning field’, FIELD, ‘to field symbol’.
ENDIF.
Demonstration
Practice
Summary
Questions