7/25/2019 CURS 2 - Tipuri de Date
1/27
7/25/2019 CURS 2 - Tipuri de Date
2/27
DATA TYPES
7/25/2019 CURS 2 - Tipuri de Date
3/27
Predefned data types
SAP AG 1999
string
Predefined ABAP Types
p
i
f
n
c
d
t
x
xstring
Data type
Numeric types
4
8
1 .. 16
Integer
Floating point numer
Pac!ed numer
"tring#$e%adecimal
Fi%ed
lengt$
Description "tatic lengt$ in
ytes
"e&uence of digits
"e&uence of c$aracters
Date
Time
'e%idecimal code
"e&uence of c$aracters
'e%idecimal code
1 .. 6(()(
1 .. 6(()(
8
6
1 .. 6(()(
are split into*
+ules for storage
,alue range
Arit$metic used
-perations on its
$aracter types
'e%adecimal
+untime system ad/usts lengt$
automatically
$aracter string operations
0alloed for all types2
3 date calculations
3 time calculations
Attriutes
,ariale
lengt$
7/25/2019 CURS 2 - Tipuri de Date
4/27
Numeric types : TYPE i -
INTEGER Deault feld lengt ! " #ytes
$a%imum feld lengt ! " #ytes
Initial &alue ! '
Te &alue range ( type I num#ers is -)**+, t( )**+,-, andincludes (nly whole
num#ers N(n-integer results ( aritmetic (perati(ns .egracti(ns/ are r(unded0 n(t
truncated
DATA int TYPE i. int = 4 / 10. " result: 0 int = 5 / 10. " result: 1
Y(u can use type I data (r c(unters0 num#ers ( items0 inde%es0time peri(ds0 and s( (n
7/25/2019 CURS 2 - Tipuri de Date
5/27
Numeric types: TYPE p -
PA12EDDeault lengt ! 3
$a%imum lengt ,4 .in #ytes/
Initial &alue ! '
Type P data all(5s digits ater te decimal p(int Te num#er (decimal places is generic0 and is determined in te pr(gram Te&alue range ( type P data depends (n its si6e and te num#er (digits ater te decimal p(int Te &alid si6e can #e any &alue r(m ,t( ,4 #ytes T5( decimal digits are packe into one !te# whilethe last !te c(ntains (ne digit and te sign 7p t( ," digits are
all(5ed ater te decimal p(int Te initial &alue is 6er(8en 5(r9ing 5it type P data0 it is a g((d idea t( set te pr(gramattri#ute Fixed point arithmetic.Otherwise, type P numbers aretreated as integers.
Y(u can use type P data (r suc &alues as distances0 5eigts0am(unts ( m(ney0 and s( (n
7/25/2019 CURS 2 - Tipuri de Date
6/27
Numeric types: TYPE -; decimals0 depending (n te $oatin%point arith&etic o' the harware plat'or&. (ince tpe ) atais internally c(n&erted t( a #inary system0 r(unding err(rs can (ccurAlt(ug te A?AP pr(cess(r tries t( minimi6e tese e@ects0 y(u
s(uld n(t use type data i ig accuracy is reuired Instead0 usetype P data
Y(u use type felds 5en y(u need t( c(pe 5it &ery large &alueranges and r(unding err(rs are n(t critical
You shoul there'ore onl use $oatin%*point nu&!ers 'orappro+i&ations.
7/25/2019 CURS 2 - Tipuri de Date
7/27
Numeric types -summary
SAP AG 1999
"ummary* +ecommendations for sing NumericData Types
If you need t$is*If you need t$is* se t$is predefined ABAP type*se t$is predefined ABAP type*
Integers onlyType i5 since calculations using integer
arit$metic are fastest
Decimal numers for
usiness calculations Type p
Decimal numers for
roug$ calculations
performed on ery small
or ery large numers
Type f
7/25/2019 CURS 2 - Tipuri de Date
8/27
1aracter types: TYPE c -1BARInitial lengt ! ,
$a%imum lengt ! 4>>+>
Initial &alue ! SPA1E
7/25/2019 CURS 2 - Tipuri de Date
9/27
1aracter types: TYPE n C
N7$1Initial lengt ! ,
$a%imum lengt ! 4>>+>
Initial &alue ! '1an c(ntain (nly digits: 'F
1an #e used (r aritmetic calculati(ns
7/25/2019 CURS 2 - Tipuri de Date
10/27
1aracter types: TYPE d CDATE;engt ! 3
Initial &alue ! ''''''''
(rmat YYYY$$DD
1an #e used (r calculati(ns0 (r e%ample:1an add a num#er t( a date0 te result is a date
1an su#stract a num#er r(m a date0 te result is adate
1an su#stract ) dates0 te result is a num#er .indays/
I (ne date is m(&ed int( a numeric feld0 te resultis te num#er ( days since ',',''',
7/25/2019 CURS 2 - Tipuri de Date
11/27
1aracter types: TYPE t CTI$E;engt ! 4
Initial &alue ! ''''''
(rmat BB$$SS1an use te same calculati(ns as (r a date
feld0 #ut te &alues 5ill #e in sec(nds (re%ample i 5e e%tract t5( timestamps0 te
result is in sec(nds
7/25/2019 CURS 2 - Tipuri de Date
12/27
Be%adecimal types: TYPE%Initial lengt ! ,
$a%imum lengt ! 4>>+>
Deault &alue ! %'',ne !te is represented #y a two*i%it
he+aeci&al ispla. The -els with thistpe are calle he+aeci&al -els.
7/25/2019 CURS 2 - Tipuri de Date
13/27
ARIA?;E ;ENGTB TYPES :
string AND %stringSTRING ! seuence ( caracters
HSTRING ! e%adecimal c(de
Te lengt is adusted aut(matically #y tesystem at runtime
7/25/2019 CURS 2 - Tipuri de Date
14/27
;
7/25/2019 CURS 2 - Tipuri de Date
15/27
;.>/ TYPE nTYPES: tynum TYPE p DE1I$A;S )
TYPES: tymatnr TYPE matnr
7/25/2019 CURS 2 - Tipuri de Date
16/27
;
7/25/2019 CURS 2 - Tipuri de Date
17/27
TYPES IN A?APDI1TI
7/25/2019 CURS 2 - Tipuri de Date
18/27
A?AP DI1TI
7/25/2019 CURS 2 - Tipuri de Date
19/27
A?AP DI1TI
7/25/2019 CURS 2 - Tipuri de Date
20/27
7/25/2019 CURS 2 - Tipuri de Date
21/27
;ITERA;SNum#er literals
DATA nu&!er TYPE i 7A28E *194.
;?@.
,7E 100 T, nu&!er.
Te%t literalsDATA te+tB10CTYPE c 7A28E AFDG.
;
7/25/2019 CURS 2 - Tipuri de Date
22/27
TEHT SY$?
7/25/2019 CURS 2 - Tipuri de Date
23/27
1
7/25/2019 CURS 2 - Tipuri de Date
24/27
7/25/2019 CURS 2 - Tipuri de Date
25/27
7sing $
7/25/2019 CURS 2 - Tipuri de Date
26/27
7sing $
7/25/2019 CURS 2 - Tipuri de Date
27/27
7SING 8RITE T
Top Related