bc400 abap workbench concepts and tools
TRANSCRIPT
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
1/406
BC400 ABAP Workbench Concepts and
Tools
BC400
Release 46D 26.03.2003
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
2/406
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
3/406
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
4/406
0
SAP AG 2001
BC400 ABAP Workbench Concepts and Tools
SAP AG
BC400BC400
ABAP Workbench:ABAP Workbench:Foundations andFoundations and
ConceptsConcepts
R/3 System
Release 4.6D
Material Number 5004 8586
Ot!ber "00#
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
5/406
0.2
SAP AG 2002
Copyright 2002 SAP A! All rights reser"ed!
#o part o$ this publication %ay be reproduced or trans%itted in
any $or% or $or any purpose &ithout the e'press per%ission o$
SAP A! The in$or%ation contained herein %ay be changed
&ithout prior notice!
All rights reser"ed!
Copyright
Trademarks:
S!me s!$t%are &r!'uts mar(ete' by SAP AG a)' its 'istribut!rs !)tai) &r!&rietary s!$t%are
!m&!)e)ts !$ !t*er s!$t%are +e)'!rs.
Mir!s!$t,- NDOS,- N,- 12C1,- !r',- P!%erP!i)t,a)' S Ser+er,are reistere'
tra'emar(s !$ Mir!s!$t C!r&!rati!).
BM,- DB",- OS/",- DB"/6000,- Parallel Sys&le,- M7S/1SA,- RS/6000,- A2,- S/30,- AS/400,-
OS/30,- a)' OS/400,are reistere' tra'emar(s !$ BM C!r&!rati!).
ORAC1,is a reistere' tra'emar( !$ ORAC1 C!r&!rati!).
N9ORM2,:O)i)e $!r SAP a)' N9ORM2,Dy)ami Ser+erMare reistere' tra'emar(s !$
)$!rmi S!$t%are )!r&!rate'.
;N2,- 2/O&e),- OS9/#,- a)' M!ti$,are reistere' tra'emar(s !$ t*e O&e) Gr!u&.
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
6/406
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
7/406
0.4
SAP AG 1999
TS
e"el 3e"el 2
ABAP Workbench:Founa!"on an#once$!s
BC400 % a&s
e"el 3e"el 2
#or$ora!e en!"!& Des"(n
TS+)0 2 a&s
SAP n!erne! ,ransac!"onSer)er: A*"n"s!ra!"on
TS010 2 a&s
De)elo$"n( Web Scenar"osan '"n"A$$s us"n( ,SFlo; /o("c
TS++0 2 a&s
De)elo$"n(as&Web,ransac!"ons
TS+00 2 a&s
SAP n!erne! ,ransac!"onSer)er: Founa!"ons
TS0)0 3 a&s
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
8/406
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
9/406
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
10/406
+
SAP AG 2001
Course 7"er"ie&
Course oals
Course 7b6ecti"es
Course Content
(ain Business Scenario
%portant 8atabase Tables $or the Flight 8ata (odel
Contents:
>C? SAP AG BC400 #
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
11/406
1.2
SAP AG 2001
At the conclusion o$ this unit you &ill be ableto:
Course oals
9'plain the basics o$ the ABAP progra%%inglanguage including:
Basic synta' ele%ents
8i$$erent types o$ user dialogs
o& to read database accesses
8escribe the "arious uses o$ the ABAP Workbenchincluding:
Support through de"elop%ent tools
Support in organi;ation and transport
>C? SAP AG BC400 "
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
12/406
1.3
SAP AG 2001
Course 7b6ecti"es
Create an ABAP progra% containing user dialogsand database accesses
8escribe the di$$erent types o$ de"elop%ent ob6ectsand their typical uses
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
13/406
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
14/406
1.5
SAP AG 2001
n"! 11
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
15/406
1.6
SAP AG 2001
n this course you &ill de"elop se"eral
progra%s designed to assist tra"el agencies!
So%e o$ their typical needs include:
8eter%ining $light connections on speci$ic dates
Processing bookings $or speci$ic $lights
9"aluating additional $light in$or%ation such as
PriceCapacity
8eparture city
8eparture airport
8estination airport
8estination city
(ain Business Scenario
>C? SAP AG BC400 6
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
16/406
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
17/406
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
18/406
2.2
SAP AG 2001
8escribe the architecture o$ the ->3 Syste%
8escribe ho& to e'ecute a si%ple dialog progra%using the ABAP runti%e syste%
At the conclusion o$ this unit you &ill be able to:
Progra% Flo& o$ an ABAP Progra%:
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
19/406
2.3
SAP AG 2001
Syste% Architecture and ABAP Progra%
Syste% Architecture and ABAP Progra%Syste% Architecture and ABAP Progra%
Sa%ple Progra% &ith Selection Screen and istSa%ple Progra% &ith Selection Screen and ist
>C? SAP AG BC400 3
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
20/406
2.4
SAP AG 2001
Client>Ser"er Architecture
Presentation
Ser"er
ayer
Application
Ser"er
ayer
8atabase
8ispatcher
Work
Process
SAPC? SAP AG BC400 4
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
21/406
2.5
SAP AG 2001
9'cerpt $or an ABAP Progra%
Presentation
Ser"er
ayer
Application
Ser"er
ayer
8atabase
Work Process
ABAP Progra%
*is ra&*i a) be sim&li$ie' $!r m!st t!&is 'isusse' 'uri) t*is !urse. *e i)terati!)bet%ee) a sngle user a)' a sngle ABAP &r!ram %ill be !$ &rimary i)terest t! us 'uri) t*is
!urse.
*e eat &r!esses i)+!l+e' i) user 'is&at*i) !) a) a&&liati!) ser+er are se!)'ary t!u)'ersta)'i) *!% t! %rite a) ABAP &r!ram. *ere$!re- %e %ill %!r( %it* a sim&li$ie'
ra&*i t*at '!es )!t e&liitly s*!% t*e 'is&at*er a)' t*e %!r( &r!ess. Certai) sli'es %ill-
*!%e+er- i)lu'e t*ese 'etails %*e)e+er t*ey are rele+a)t t! ABAP &r!rammi).
ABAP &r!rams are &r!esse' !) t*e a&&liati!) ser+er. *e 'esi) !$ user dalogsa)'database dalogsis- t*ere$!re- !$ &artiular im&!rta)e %*e) %riti) a&&liati!) &r!rams.
>C? SAP AG BC400 5
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
22/406
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
23/406
2.7
SAP AG 2001
nteraction Bet&een Ser"er ayers
Progra%
Start
ABAP -unti%e Syste%
ABAP Progra%
ABAP
Processing
Block
ABAP
Processing
Block
8atabase
Table
Ti%e
O)e t*e user &er$!rms a user ati!) >seleti)Enter, a $u)ti!) (ey- a me)u $u)ti!) !r a
&us*butt!)- $!r eam&le?- !)tr!l is &asse' $r!m t*e &rese)tati!) ser+er t! t*e a&&liati!) ser+er.
O)ly ertai) &arts !$ t*e ABAP &r!ram are &r!esse'.
$ a $urt*er user 'ial! is triere' $r!m %it*i) t*e ABAP &r!ram- t*e system tra)smits t*e sree)
a)' &asses !)tr!l !)e aai) t! t*e &rese)tati!) ser+er.
>C? SAP AG BC400
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
24/406
2.8
SAP AG 2001
Sa%ple Progra% &ith Selection Screen and ist
Syste% Architecture and ABAP Progra%Syste% Architecture and ABAP Progra%
Sa%ple Progra% &ith Selection Screen and istSa%ple Progra% &ith Selection Screen and ist
>C? SAP AG BC400 8
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
25/406
2.9
SAP AG 2001 Ti%e
Progra%
Start
Progra% Start
8atabase
Table
-epository
*e)e+er a user l!s !) t! t*e system- a sree) is 'is&laye'. 9r!m t*is sree)- t*e user a) starta) ABAP &r!ram +ia a me)u &at* !r by e)teri) a tra)sati!) !'e.
>C? SAP AG BC400
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
26/406
2.10
SAP AG 2001 Ti%e
Progra%
Start
Syste% oads Progra% Conte't
8ata 7b6ects
ABAP
ProcessingBlock
ABAP -unti%e Syste%
ABAP Progra%
Selection Screen
-epository
8atabase
Table
*e system $irst l!a's t*e &r!ram !)tet !)t! t*e a&&liati!) ser+er. *e &r!ram !)tet!)tai)s mem!ry areas $!r +ariables a)' !m&le 'ata !bets- i)$!rmati!) !) t*e sree)s $!r
user 'ial!s- a)' ABAP &r!essi) bl!(s. *e ru)time system ets t*e &r!ram i)$!rmati!)
$r!m t*e Re&!sit!ry- %*i* is a s&eial &art !$ t*e 'atabase.
*e sam&le &r!ram *as a seleti!) sree) as t*e user 'ial!- a +ariable a)' a struture as 'ata!bets- a)' !)e ABAP &r!essi) bl!(. *e list t*at is use' t! 'is&lay t*e 'ata is reate'
'y)amially at ru) time.
*e ABAP ru)time system !)tr!ls t*e subseue)t &r!ram $l!%.
>C? SAP AG BC400 #0
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
27/406
2.11
SAP AG 2001 Ti%e
Progra%
Start
-unti%e Syste% Sends Selection Screen
8ata 7b6ects
ABAP
ProcessingBlock
ABAP -unti%e Syste%
ABAP Progra%
8atabase
Table
-epository
Beause t*e &r!ram !)tai)s a seleti!) sree)- t*e ABAP ru)time system se)'s it t! t*e
&rese)tati!) ser+er. *e &rese)tati!) ser+er !)tr!ls t*e &r!ram $l!% $!r as l!) as t*e user e)ters
'ata i) t*e i)&ut $iel's.
Seleti!) sree)s all!% users t! e)ter seleti!) riteria reuire' by t*e &r!ram.
>C? SAP AG BC400 ##
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
28/406
2.12
SAP AG 2001 Ti%e
Progra%
Start
nput ?alues Are nserted into 8ata 7b6ects
8ata 7b6ects
ABAP
ProcessingBlock
ABAP -unti%e Syste%
ABAP Progra%
8atabase
Table
-epository
As s!!) as t*e user *as $i)is*e' e)teri) 'ata !) t*e seleti!) sree)- *e !r s*e a) trier $urt*er
&r!essi) !$ t*e &r!ram by seleti) 1eute.
*e e)tere' 'ata is aut!matially &lae' i) its !rres&!)'i) 'ata !bets i) t*e &r!ram a)' t*e
ABAP ru)time system resumes !)tr!l !$ &r!essi).
) !ur sim&le &r!ram eam&le- t*ere is !)ly !)e ABAP &r!essi) bl!(. *e ABAP ru)time
system triers seue)tial &r!essi) !$ t*is ABAP &r!essi) bl!(.
$ t*e e)tries ma'e by t*e user '! )!t *a+e t*e !rret ty&e- a) err!r messae is triere'
aut!matially. *e user must !rret t*e e)tries.
>C? SAP AG BC400 #"
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
29/406
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
30/406
2.14
SAP AG 2001 Ti%e
Progra%
Start
8atabase -eturns 8ata -ecord to Progra%
8atabase
Table
8ata 7b6ects
ABAP
ProcessingBlock
ABAP -unti%e Syste%
ABAP Progra% -epository
*e 'atabase retur)s t*e reueste' 'ata re!r' t! t*e &r!ram a)' t*e ru)time system e)sures t*at
t*is 'ata is st!re' i) t*e a&&r!&riate 'ata !bets.
$ a si)le re!r' is aesse'- t*is 'ata !bet is usually a struture t*at !)tai)s !m&!)e)ts $!r all
t*e reuire' 'atabase $iel's.
>C? SAP AG BC400 #4
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
31/406
2.15
SAP AG 2001 Ti%e
Progra%
Start
-unti%e Syste% Sends ist
8atabase
Table
8ata 7b6ects
ABAP
ProcessingBlock
ABAP -unti%e Syste%
ABAP Progra% -epository
*e lay!ut !$ t*e subseue)t list 'is&lay %as als! &r!ramme' i)t! t*e &r!essi) bl!(. A$ter
!m&leti!)- t*e ru)time &r!ram se)'s t*is list as a sree) t! t*e &rese)tati!) ser+er.
>C? SAP AG BC400 #5
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
32/406
2.16
SAP AG 2001
Course Content
Syste% Architecture and ABAP Progra%Syste% Architecture and ABAP Progra%
Sa%ple Progra% &ith Selection Screen and istSa%ple Progra% &ith Selection Screen and ist
>C? SAP AG BC400 #6
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
33/406
2.17
SAP AG 2001
n"! 1 ntroduction
n"! 2 Progra% Flo& in an ABAP Progra%
n"! 3 ntroduction to the ABAP Workbench
n"! 4 ntroduction to the ABAP 8ictionary
n"! % Basic ABAP anguage 9le%ents
n"! 6 8ata -etrie"aln"! < nternal Progra% (odulari;ation &ith Subroutines
n"! = The ABAP -unti%e Syste%
n"! 9
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
34/406
2.18
SAP AG 2001
n"! 11
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
35/406
2.19
SAP AG 2001
8escribe in basic ter%s the architecture o$ the ->3Syste%
8escribe in basic ter%s the e'ecution o$ a si%pledialog progra% using the ABAP runti%e syste%
ou are no& able to:
Progra% Flo& o$ an ABAP Progra%: C? SAP AG BC400 #
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
36/406
3
SAP AG 2001
ntroduction to the ->3 -epository
Working &ith the 7b6ect #a"igator
7rgani;ing 8e"elop%ents
8e"eloping an ABAP Progra%
Contents:
ntroduction to the ABAP Workbench
>C? SAP AG BC400 #
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
37/406
3.2
SAP AG 2001
8escribe the structure o$ the ->3 -epository andits search tools
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
38/406
3.3
SAP AG 2001
ntroduction to the ->3 -epository
ntroduction to the ->3 -epositoryntroduction to the ->3 -epository
Working &ith the 7b6ect #a"igatorWorking &ith the 7b6ect #a"igator
7rgani;ing 8e"elop%ents7rgani;ing 8e"elop%ents
8e"eloping ABAP Progra%s8e"eloping ABAP Progra%s
>C? SAP AG BC400 3
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
39/406
3.4
SAP AG 2001
The ->3 -epository
Presentation
Ser"er
ayer
Application
Ser"er
ayer
8atabase
ABAP Progra%
-epositoryCusto%i;ing tables
Application tables
Cross=client Client=speci$ic
*e 'atabase !)tai)s a&&liati!) a)' Cust!mii) tables t*at are usually clent-specfc.
*e 'atabase als! !)tai)s t*e R/3 Re&!sit!ry. *e ABAP Diti!)ary is &art !$ t*e R/3 Re&!sit!ry.
*e %&' %epostory!)tai)s all t*e 'e+el!&me)t !bets- $!r eam&le- &r!rams- 'e$i)iti!)s !$
'atabase tables- !r e)tral 'ata ty&e 'e$i)iti!)s. De+el!&me)t !bets are t*ere$!re als! ()!%) as
Re&!sit!ry !bets.
Re&!sit!ry !bets are ne$er clent-specfcH t*ere$!re- t*ey a) be +ie%e' a)' use' i) all lie)ts.
>C? SAP AG BC400 4
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
40/406
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
41/406
3.6
SAP AG 2001
SAP
SAP Application ierarchy
Cross=Application Co%ponents
Accounting = eneral
Financial Accounting
!!!
FBAS Financial Accounting Basis
!!!
F= eneral edger Acctg
F=C Consolidation
!!!
Treasury
Controlling
Application co%ponent
8e"elop%ent class
Selected subtree
n$or%ation Syste%
CA
AC
F
T-
C7
!!!
*e struture !$ t*e a&&liati!) !m&!)e)ts is s*!%) i) t*e applcaton herarchy. 9r!m t*e SAP
1asy Aess me)u- y!u aess t*e a&&liati!) *ierar*y by *!!si)
Tools ABAP Workbench Overview Application Hierarchy.
*e a&&liati!) !m&!)e)ts are 'is&laye' i) a tree struture i) t*e a&&liati!) *ierar*y. 1&a)'i)
a !m&!)e)t 'is&lays all t*e 'e+el!&me)t lasses t*at are assi)e' t! t*at !m&!)e)t.
@!u a) selet a subtree !r bra)* a)' )a+iate $r!m t*e a&&liati!) *ierar*y t! t*e R/3 Re&!sit!ry
)$!rmati!) System. *e system t*e) !llets all 'e+el!&me)t lasses $!r t*e bra)* selete' a)'
&asses t*em t! t*e Re&!sit!ry )$!rmati!) System.
>C? SAP AG BC400 6
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
42/406
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
43/406
3.8
SAP AG 2001
Working With the 7b6ect #a"igator
ntroduction to the ->3 -epositoryntroduction to the ->3 -epository
Working &ith the 7b6ect #a"igatorWorking &ith the 7b6ect #a"igator
7rgani;ing 8e"elop%ents7rgani;ing 8e"elop%ents
8e"eloping ABAP Progra%s8e"eloping ABAP Progra%s
>C? SAP AG BC400 8
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
44/406
3.9
SAP AG 2001
Function BuilderFunction Builder
Screen PainterScreen Painter
ABAPABAP8ictionary8ictionaryABAP 9ditorABAP 9ditor
7b6ect
#a"igator
(enu Painter(enu Painter
ABAP Workbench Tools
8ebugger8ebugger
Class BuilderClass Builder
F -
((
S8
((
W(
Cust!
*e ABAP Workbench!)tai)s 'i$$ere)t t!!ls $!r e'iti) Re&!sit!ry !bets. *ese t!!ls a) be
use' t*r!u*!ut t*e e)tire s!$t%are 'e+el!&me)t yle. *e m!st im&!rta)t t!!ls $!r reati) a)'
e'iti) Re&!sit!ry !bets are as $!ll!%sE
*e ABAP (dtor $!r e'iti) s!ure tet
*e ABAP Diti!)ary $!r &r!essi) 'atabase table 'e$i)iti!)s- e)tral 'ata ty&es- a)' m!re
*e Sree) Pai)ter $!r !)$iuri) sree)s >sree)s %it* $u)ti!)s $!r user 'ial!s?
)enu Panter $!r 'esi)i) t*e user i)ter$ae >me)u bar- sta)'ar' t!!lbar- a&&liati!) t!!lbar?
>seeInterfaces)
*e *uncton Bulder$!r &r!essi) $u)ti!) m!'ules
*e Class Buil'er $!r &r!essi) e)tral lasses
@!u a) start t*ese t!!ls i) t*ree %aysE
Diretly $r!m t*e 1asy Aess me)u. ;si) t*e +b,ect a$gator. *is *as a tree 'iaram !$ all !bets %it*i) a 'e+el!&me)t lass !r
&r!ram. D!uble:li( !) a) !bet t! start t*e res&eti+e t!!l.
By '!uble:li(i) $r!m !)e t!!l t! t*e )et- a)' ba( aai).
>C? SAP AG BC400
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
45/406
3.10
SAP AG 2001
Screen Structure in the 7b6ect #a"igator
Si;e o$ display area can be changed
-ight=clickConte't %enu
Full screen
on>o$$
Conte't %enu-ight=click
#a"igation area
Tool area
*e Obet Na+iat!r sree) is 'i+i'e' i)t! t%! areasE
A )a+iati!) area$!r 'is&layi) a) !bet list as a *ierar*y tree A t!!l area $!r 'is&layi) a)' e'iti) a 'e+el!&me)t !bet usi) t*e !rret t!!l
@!u a) 'is&lay !r *i'e t*e *ierar*y area.
@!u a) selet $u)ti!)s $r!m a !)tet me)u i) b!t* sree) areas. @!u are i+e) a *!ie !$ !)ly
t*!se $u)ti!)s t*at are &r!+i'e' $!r 'is&layi) !r e'iti) t*e !bet t! %*i* y!u are &!i)ti).
Ri*t:li( !) t*e !bet t! !&e) t*e !)tet me)u.
>C? SAP AG BC400 #0
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
46/406
3.11
SAP AG 2001
Working &ith the #a"igation Area
8ictionary ob6ectsProgra%s
SAPBC400WB89TT#STA
SAPBC400WBT9TT#STA
Function groups
BC400
Classes
CBC400
BC400
Development Class
C!""
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
47/406
3.12
SAP AG 2001
#a"igation in the Tool Area
#a"igation stack
Functions o$ the
current tool
Sho& na"igation
&indo&
ide na"igation
&indo&
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
48/406
3.13
SAP AG 2001
Synchroni;ation o$ #a"igation and Tool Areas
8isplay
Change
!!!
8isplay ob6ect list
8ouble=click on a
-epository ob6ect
&ithout subob6ects orchoose conte't %enu:
8isplay>change in tool
area
Na+iati!) i) t*e )a+iati!) area is l!ially ndependent from)a+iati!) i) t*e t!!l area. *is
all!%s $!r sree)s t! be use' i) a $leible ma))er.
$ y!u %is*- y!u a) sy)*r!)ie t*e t%! areasE
@!u a) dsplay an ob,ect i) t*e t!!l area by '!uble:li(i) it- !r by seleti) t*e !)tet me)u$r!m %it*i) t*e )a+iati!) area. *e system aut!matially selets t*e a&&r!&riate t!!l $!r
&r!essi) t*e !bet y!u selete'.
! dsplay the ob,ect lstt*at bel!)s t! a) !bet y!u are urre)tly &r!essi) i) t*e t!!l area-*!!seDisplay obect list.
! create ob,ects $r!m a) !bet list- y!u a) use t*e !)tet me)u $!r t*at !bet ty&e. $ t*ere is )!
e)try i) t*e !bet list $!r t*e reuire' !bet ty&e- y!u a) reate a)y )umber !$ !bets usi)E!it
obect!r Other obect.
>C? SAP AG BC400 #3
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
49/406
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
50/406
3.15
SAP AG 2001
8e"elop%ent Syste% Production Syste%
Transporting -epository 7b6ects
F -
((
S8
((
W(
Cust!
Change
-e5uest-e5uest
F -
((
S8
((
W(
Cust!
De+el!&me)t &r!ets are al%ays im&leme)te' i) a 'e+el!&me)t system a)' t*e) tra)s&!rte' t! t*e
)et system.
Re&!sit!ry !bets are aut!matially assi)e' t! a tra)s&!rt r!ute base' !) t*eir bel!)i) t! a
&artiular 'e+el!&me)t lass a)' !) t*eir atual $u)ti!).
A 'eisi+e riteri!) $!r !mbi)i) t*e 'e+el!&me)t &r!ets is- t*ere$!re- %*i* Re&!sit!ry !bets
)ee' t! be tra)s&!rte' t!et*er beause !$ t*eir 'e&e)'e)ies.
@!u s*e'ule t*e group transport !$ t*e Re&!sit!ry !bets usi) a change reuest.
>C? SAP AG BC400 #5
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
51/406
3.16
SAP AG 2001
Scheduling a 8e"elop%ent Pro6ect
Schedule: (onday
-e5uest is released
Tea%:
Pro6ect (anager:
F-
F-
BC400=00
BC400=0+
BC400=02
BC400=03
!!!
Friday!!!
ocking 7b6ects $or #onocking 7b6ects $or #on=Pro6ect=Pro6ect(e%bers(e%bers
S*e'uli) a 'e+el!&me)t &r!et usi) a *a)e reuest !+ers t*e $!ll!%i) as&etsE
All em&l!yees i) t*e &r!et start t*eir %!r( !) a 'e$i)e' 'ate.
1m&l!yees *a+e t*e *a)e t! $!ll!% u& a)' *e( t*eir ati+ities se&arately.
*e res&eti+e Re&!sit!ry !bets a) be &r!esse' by all em&l!yees i)+!l+e' i) t*e &r!et. 9!r
t*!se 'e+el!&ers %*! '! )!t bel!) t! t*e team- t*e Re&!sit!ry !bets remai) l!(e' u)til t*e
&r!et is !m&lete'.
*e r!u& triers t*e tra)s&!rt !$ all t*e res&eti+e Re&!sit!ry !bets.
>C? SAP AG BC400 #6
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
52/406
3.17
SAP AG 2001
Workbench 7rgani;er: Change -e5uests
Pro6ect -epresentation in theWorkbench 7rgani;er
Tea%:
Pro6ect (anager:F-
F-
BC400=00
BC400=0+
BC400=02
BC400=03
!!!
#han(e reues!s "n)ol)"n( user B#40000
#han(eable
,rans$or!able
,3>9000%1 #ARS8?
,3>9000%2 #ARS8?
,3>9000%3 B#40000
Re$or! source
@B#40000F/G,/S,
ABAP $ro(ra*
,3>9000%4 B#40001
,3>9000%% B#40002
,3>9000%6 B#40003
,3>9000%< ...
-e5uest nu%ber
Pro6ect
(anager
Task nu%ber
-epository ob6ects
created or correctedby e%ployee
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
53/406
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
54/406
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
55/406
3.20
SAP AG 2001
8e"eloping ABAP Progra%s
ntroduction to the ->3 -epositoryntroduction to the ->3 -epository
Working &ith the 7b6ect #a"igatorWorking &ith the 7b6ect #a"igator
7rgani;ing 8e"elop%ents7rgani;ing 8e"elop%ents
8e"eloping ABAP Progra%s8e"eloping ABAP Progra%s
>C? SAP AG BC400 "0
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
56/406
3.21
SAP AG 2001
Features o$ the ABAP Progra%%ing anguage
There$ore it is designed $or dialog=based business applications!
The ABAP progra%%ing language !!!
as de$ined types
9nables %ulti=language applications
as S e%bedded &ithin it
as been enhanced as an ob6ect=oriented language
s plat$or%=independent
s do&n&ards co%patible
! su&&!rt 'ata &r!essi) by ty&es- ABAP !)tai)s a systemati ty&e *ierar*y. y&e !)+ersi!)s
a)' ty&e asti) are su&&!rte'.
;si) tra)slatable tet eleme)ts- y!u a) 'e+el!& multi:la)uae a&&liati!)s.
*e OP1N S sta)'ar' embe''e' i) ABAP all!%s 'iret 'atabase aesses.
ABAP Obets is t*e !bet:!rie)te' e)*a)eme)t !$ t*e ABAP &r!rammi) la)uae.
*e ABAP ru)time system is !)e !$ t*e R/3 Basis !m&!)e)ts a)' is &lat$!rm:i)'e&e)'e)t.
ABAP !)ti)ues t! e+!l+e $r!m release t! release. $ a) !l' sy)ta stateme)t is re&lae' by a better
!)e- y!u a) still ru) t*e !l' stateme)t.
>C? SAP AG BC400 "#
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
57/406
3.22
SAP AG 2001
DATA .a/s$a%% TYPE s$a%%0
START1OF1SELECTION0
SELECT 2 FROM s$a%%INTO CORRESPONDING FIELDS OF .a/s$a%%0
NE31LINE0 3RITE .a/s$a%%1$a%%#40
3RITE .a/s$a%%1$a%%name0 3RITE .a/s$a%%1)%l0
ENDSELECT0
eneral ABAP Synta'
Additions and operands,dependent on key&ords.ABAPABAPkey&ordkey&ord
START1OF1SELECTION0START1OF1SELECTION0
SELECTSELECT
ENDSELECT0ENDSELECT0
3RITE3RITE
00
00
00
Period as sy%bol $or closingPeriod as sy%bol $or closing
thetheABAPABAPstate%entstate%ent
DATADATA 00
NE31LINE0NE31LINE0
3RITE3RITE3RITE3RITE 00
ABAP &r!rams !)sist u& !$ i)'i+i'ual stateme)ts.
1a* stateme)t e)'s %it* a &eri!'.
*e $irst %!r' i) a stateme)t is alle' a key#ord.
!r's must al%ays be se&arate' by at least !)e s&ae.
Stateme)ts a) be i)'e)te'.
Stateme)ts a) ta(e u& m!re t*a) !)e li)e.
A si)le li)e a) !)tai) multi&le stateme)ts.
*e ABAP ru)time system is )!t ase se)siti+eH t*at is- it '!es not 'isti)uis* bet%ee) l!%erase
a)' u&&erase letters $!r (ey%!r's- a''iti!)s- a)' !&era)'s. ! ma(e it easier t! se&arate t*em
+isually- i) t*is !urse all (ey%!r's a)' t*eir a''iti!)s are i) u&&erase a)' all !&era)'s are i)
l!%erase.
9!r i)'e)tati!)s a)' $!r !)+erti) u&&erase a)' l!%erase letters- use t*e Pretty Pai)ter $u)ti!).
C*!!se %tilities&ettin's ABAP E!itorPretty Printer
>C? SAP AG BC400 ""
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
58/406
3.23
SAP AG 2001
2 $omments 0002 $omments 0002 $omments 000
DATA .a/s$a%% TYPE s$a%%0
START1OF1SELECTION0
SELECT 2 FROM s$a%% 5 $omments 000 INTO CORRESPONDING FIELDS OF .a/s$a%%0
NE31LINE0 3RITE .a/s$a%%1$a%%#46
.a/s$a%%1$a%%name6 .a/s$a%%1)%l0
ENDSELECT0
::
66
66
00
eneral ABAP Synta'
ChainedChainedState%entState%ent
22
22
22
55
Co%%entsCo%%ents
;se a) asteris( >J? t! i)tr!'ue comment lnes. *e ABAP ru)time system i)!res t*e !mme)t
li)e.
$ y!u %a)t t! e)ter a !mme)t i) t*e mi''le !$ a starte' li)e- e)ter '!uble u!tes.@!u a) !mbi)e
!)seuti+e stateme)ts #th an dentcal begnnng i)t! a si)le chaned statementE
Cl!se t*e i'e)tial bei))i) &art %it* a !l!). Se&arate i)'i+i'ual eleme)ts t*at !me a$ter t*e !l!) by !mmas. ;se bla)( s&aes a)' li)e brea(s be$!re a)' a$ter t*e se&arat!rs >!l!)s- !mmas- a)' &eri!'s?. *e ABAP ru)time system !)si'ers t*e i)'i+i'ual &arts !$ a *ai)e' stateme)t t! be si)le
stateme)ts.
>C? SAP AG BC400 "3
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
59/406
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
60/406
3.25
SAP AG 2001
With T7P nclude
Create Progra%
Progra% DBC40000S
Creating an ABAP Progra%
Attributes
ABAP: Progra% Attributes !!!
Title !!!
Type
Status
Application
Fi'ed point arith%etic
9'ecutable progra%
Test progra%
Co%ply &ith custo%er na%espaceG
9r!m t*e Obect (avi'ator,y!u a) reate a &r!ram usi) !)e !$ t*e $!ll!%i) !&ti!)sE
) t*e )a+iati!) area- *!!sePro'ramas t*e !bet ty&e a)' e)ter a &r!ram )ame. Be sure t!!m&ly %it* t*e ust!mer )ames&ae !)+e)ti!)s. $ t*e &r!ram '!es )!t eist- t*e system
'is&lays t*e 'ial! seue)e t*at lets y!u reate a &r!ram. >*is &r!e'ure is &!ssible !)ly as !$
Release 4.6C.?
Dis&lay t*e 'e+el!&me)t lass $!r %*i* y!u %a)t t! reate t*e &r!ram. Start t*e 'ial! seue)e$!r reati) a &r!ram usi) t*e 'e+el!&me)t lass !)tet me)u !r t*ePro'ram)!'e.
Selet Other obect!rE!it obect. Selet t*ePro'ram obectstab a)' e)ter t*e )ame. Selet"reate
) t*is !urse- 'eselet With Top Incl$!e>by rem!+i) t*e *e( mar( $r!m t*e *e(b!?. >$ y!u
'!)Ft '! t*is- y!ur s!ure tet %!ul' be 'istribute' t! se+eral &r!rams.?
C*a)e t*e title t! a mea)i)$ul s*!rt tet.
C*!!se Test pro'ramas t*e &r!ram status $!r all ABAP !urses.
>C? SAP AG BC400 "5
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
61/406
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
62/406
3.27
SAP AG 2001
nacti"e and Acti"e 8e"elop%ent 7b6ects
Progra% +
inacti"e "ersion
Sa"ed
$or de"elop%ent
and testing
Acti"ely integrated
$or syste%=&ide
usage
Progra% 3
inacti"e "ersion
Progra% 2
acti"e "ersion
Progra% 3
acti"e "ersion
Progra% +
acti"e "ersion
Acti"ate
*e)e+er y!u reate a 'e+el!&me)t !bet- !r *a)e a)' t*e) sa+e it- t*e system st!res a) nact$e
$erson!)ly i) t*e R/3 Re&!sit!ry.
Be$!re a Re&!sit!ry !bet is a+ailable !) a system:%i'e basis- it must $irst be a+ailable as a) act$e
$erson. *is ati+e +ersi!) !$ y!ur &r!ram %ill be use' %*e)e+er a user %a)ts t! eeute y!ur
&r!ram.
$ y!ur &r!ram is a+ailable i) b!t* +ersi!)s- y!u a) s%it* $r!m !)e +ersi!) t! t*e !t*er i) 'is&lay
m!'e.
*e)e+er y!u ati+ate a &r!ram- t*e system $irst 'is&lays a list !$ all i)ati+e !bets t*at y!u *a+e
&r!esse'. *is is alle' t*e #orklst.$ y!u !)ti)ue t! ati+ate t*e &r!ram- t*e $!ll!%i)
*a&&e)sE
*e system sa+es t*e &r!ram- t*at is- it st!res !r !+er%rites t*e i)ati+e +ersi!).
*e system &er$!rms a sy)ta *e(. *e system st!res t*e ati+e +ersi!) !r !+er%rites it.
>C? SAP AG BC400 "
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
63/406
3.28
SAP AG 2001
enerating -unti%e 7b6ects
sa"ed
$or de"elop%ent>testing
acti"ely integrated
$or syste%=&ide usage
Progra% 3
inacti"e "ersion
Progra% +
acti"e "ersion
Progra% 2
acti"e "ersion
Progra% 3
acti"e "ersion
For syste%=&ide usage
Progra%Progra%33
generated "ersiongenerated "ersion
enerate
,auto%atically.
Progra%Progra%33
te%poraryte%porary
generated "ersiongenerated "ersion
enerate
,auto%atically.
*e) y!u e)erate a 'e+el!&me)t !bet- t*e system reates >!m&iles? a se&arate ru)time !bet
>OAD? a)' st!res it i) t*e R/3 Re&!sit!ry.
*is e)erate' +ersi!) is t*e) t*e +ersi!) t*at is eeute' >i)ter&rete'?.
Ge)erati!) ta(es &lae aut!matially- but it a) be triere' e&liitly.
$- $!r eam&le- a user %a)ts t! eeute y!ur &r!ram a)' t*ere is still )! e)erate' +ersi!)- t*e
system %ill use t*e ati+e +ersi!) $!r e)erati!).
@!u a)- *!%e+er- 'etermi)e %*i* +ersi!) y!u %a)t t! eeuteE
! eeute t*e ati+e +ersi!)- start y!ur &r!ram $r!m t*e )a+iati!) area. ! eeute t*e i)ati+e +ersi!)- test a) eeutable &r!ram $r!m t*e ABAP 1'it!r. *e system
tem&!rarily reates a e)erate' +ersi!).
) t*is %ay- 'e+el!&me)t a) !)ti)ue #thout changng the current system status. All *a)es t!t*e 'e+el!&me)t !bet be!me +isible system %i'e !)ly %*e) t*e &r!ram is ati+ate' aai). it*
i)ati+e +ersi!)s- y!u *a+e a l!al- se&arate +ie% !$ t*e R/3 Re&!sit!ry- %*i* &r!+i'es t*e basis $!r
a local runtme system.
>C? SAP AG BC400 "8
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
64/406
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
65/406
3.30
SAP AG 2001
Syste%Syste% elp elp
Adding a Transaction Code to theSAP 9asy Access (enu
Fa"orites
SAP (enu
SAP Easy Access
7b6ect #a"igator
Add transaction
9nter Transaction (anually
Transaction code D00S
! i)lu'e a tra)sati!) !'e i) t*e y!ur r!le me)u $a+!ritesE
Dis&lay t*e i)itial sree) >SAP 1asy Aess me)u?. C*!!seavoritesInsert transaction. 1)ter a tra)sati!) !'e i) t*e 'ial! b! .
*e tra)sati!) !'e s*!rt tet a&&ears u)'er t*eavorites)!'e. @!u a) start t*e a&&r!&riate
&r!ram $r!m t*e !)tet me)u $!r t*is )e% )!'e.
>C? SAP AG BC400 30
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
66/406
3.31
SAP AG 2001
8escribe the structure o$ the ->3 -epository andits search tools
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
67/406
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
68/406
("ercses
1nt: 2ntroducton to the ABAP Workbench
Topc: 3e$elopng ABAP Programs
At t*e !)lusi!) !$ t*ese eerises- y!u %ill be able t!E
Create- e'it- sa+e- a)' &r!ess ABAP &r!rams
C*e( ABAP &r!rams $!r !rret sy)ta
est a)' ati+ate ABAP &r!rams
Create a) ABAP &r!ram t*at lists a''iti!)al i)$!rmati!) !) all eisti)
$li*t 'e&arture times.
Get t*e 'ata $r!m t*e 'atabase table SFLIGHT.
Pr!ramE =C!""/>>/GS/LIST
M!'el s!luti!)E SAPBC400WBS_GS_LIST
##sta)'s $!r t*e t%!:'iit r!u& )umber.
":# Create t*e eeutable &r!ram =C!""/>>/GS/LIST%it*!ut OP )lu'e.
":" De$i)e a %!r( area $!r t*e 'ata retrie+al a)' 'ata 'is&lay >)ame suesti!)E
.a/+l#(&t?EDATA .a/+l#(&t TYPE s+l#(&t0
":3 Pr!ram a l!!& aess t! all t*e 'ata re!r's i) t*e 'atabase table *256TESELECT 2 FROM s+l#(&t INTO .a/+l#(&t0 000ENDSELECT0
":4 *or each data record- 'is&lay t*e !)te)ts !$ t*e $iel's $a%%#4- $onn#4-+l4ate- seatso$$6 a)' seatsma?i) t*e listE
NE31LINE0 3RITE .a/+l#(&t1$a%%#40 3RITE 000
":5 C*e( y!ur &r!ram $!r sy)ta err!rs- test it- a)' ati+ate it
>C? SAP AG BC400 33
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
69/406
("eercses
1nt: 2ntroducton to the ABAP Workbench
Topc: Transacton Codes
At t*e !)lusi!) !$ t*ese eerises- y!u %ill be able t!E
Assi) tra)sati!) !'es t! ABAP &r!rams
A'' tra)sati!) !'es t! y!ur 9a+!rites list i) t*e SAP 1asy Aess
me)u
Gi+e y!ur $irst ABAP &r!ram a tra)sati!) !'e- i) a''iti!) t! its
te*)ial )ame- %*i* y!u use t! eeute it.
ra)sati!) !'eE =C!""/>>/GS
Pr!ramE =C!""/>>/GS/LIST
M!'el s!luti!)E SAPBC400WBS_GS LIST
##sta)'s $!r t*e t%!:'iit r!u& )umber.
3:# Create tra)sati!) !'e =C!""/>>/GS$!r t*e eeutable &r!ram=C!""/>>/GS/LIST.
Initial obect/ pro'ram an! selection screen -report transaction)
1eute y!ur &r!ram by e)teri) t*e )e% tra)sati!) !'e.
3:" )lu'e t*e tra)sati!) !'e =C!""/>>/GSi) y!ur $a+!rites i) t*e SAP:1asy:Aess:me)u.
1eute y!ur &r!ram by '!uble:li(i) t*e )e% $a+!rite e)try.
9r!m )!% !)- it is best i$ y!u al%ays %!r( %it* t*e Object
Navigator. t &r!+i'es y!u %it* a) !+er+ie% !$ all Re&!sit!ry
!bets i) y!ur 'e+el!&me)t lass. 9r!m *ere- y!u a) e'it ea*
!bet 'iretly by seleti) it $r!m t*is list.
>C? SAP AG BC400 34
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
70/406
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
71/406
4
SAP AG 2001
SAP Flight 8ata (odel
Transparent Tables
Structures
C? SAP AG BC400 #
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
72/406
4.2
SAP AG 2001
8escribe the SAP $light data %odel
8escribe the structure o$ a transparent table
8escribe the structure o$ a structure
ist the possible uses o$ transparent tables andstructures in ABAP progra%s
At the conclusion o$ this unit you &ill be able to:
ntroduction to the ABAP 8ictionary:
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
73/406
4.3
SAP AG 2001
8ata (odeling
-eal &orld
8ata %odel
ABAP 8ictionary
-elational
database
) t*e 'e+el!&me)t !$ busi)ess a&&liati!) s!$t%are- t*e real %!rl' must be &artly ma&&e' i)t*e $!rm !$ 'ata. A) e)tity re&rese)ts a busi)ess u)it.
1)tities all relate t! ea* !t*er. *e e)tities a)' relati!)s*i&s are !)tai)e' i) t*e 'ata m!'el !re)tity relati!)s*i& m!'el >1RM?.
*e !)+ersi!) !$ t*e table 'e$i)iti!)s a)' t*eir relati!)s*i&s i) t*e ABAP Diti!)ary are base'!) t*is 'ata m!'el.
*e atual a&&liati!) 'ata is &*ysially st!re' i) t*e 'atabase itsel$.
>C? SAP AG BC400 3
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
74/406
4.4
SAP AG 2001
8eparture airport
8estination airport
8estination city
8eparture city
Typical in5uiries at the tra"el agency:
Suitable airports Suitable $light connections Suitable $light ti%es Additional $light in$or%ation such as: price
a"ailability
Flight 8ata (odel $or ABAP Training Courses
ABAP trai)i) !urses- !)li)e '!ume)tati!)- a)' ABAP (ey%!r' '!ume)tati!) all use t*esame $li*t 'ata m!'el. All Re&!sit!ry !bets i) t*e $li*t 'ata m!'el are l!ate' i) t*e
'e+el!&me)t lassBC_DATAMODEL.
*is trai)i) !urse 'em!)strates !)e sim&le eer&t $r!m t*is 'ata m!'el- %*i* t*e i)strut!ra) re$i)e i$ )eessary. $ a &ers!) %a)ts t! tra+el $r!m !)e &lae t! a)!t*er- s*e as(s t*e tra+el
ae)y t*e $!ll!%i) uesti!)sE
*at !))eti!) !$$ers me t*e best a)' m!st 'iret $li*tK
At %*at times are $li*ts !$$ere' !) t*e 'ate %*e) %a)t t! tra+elK
t! arri+eK
*e &asse)erFs +ie% 'i$$ers $r!m t*at !$ a tra+el ae)y. ) t*e 'ata m!'el- %*i* is tail!re' t!suit ma)aeme)t !$ t*e )eessary 'ata- all 'ata is st!re'- !ra)ie' by te*)ial riteria- i)
tables !) a e)tral 'atabase. *e am!u)t !$ 'ata st!re' $ar eee's t*e 'ema)'s !$ t*e
&asse)er.
As a &r!rammer- y!u must be able t! !m&ile t*e 'ata i) &r!rams t! suit t*e reuireme)ts !$t*e tra+el ae)t.
>C? SAP AG BC400 4
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
75/406
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
76/406
4.6
SAP AG 2001
Con"erting ?G ,
Flight booking'A?D, #ARRD #8??D F/DA, B88>D #S,8'D #8?,R ...
SB77ESB77E
'A?D, #ARRD #8??D F/DA, SA,S'AE SA,S8## ...
SFTSFT
'A?D, #ARRD #8??D ARPFR8' ARP,8 DP,' ...
SPFSPF
'A?D, #ARRD #ARR?A' #RR#8D R/
SCA--SCA--
A tra)s&are)t table !)tai)s 'i$$ere)t !lum)s- t! all!% y!u t! ma)ae 'ata re!r's i) a struture'
%ay.
@!u 'e$i)e tra)s&are)t tables i) t*e ABAP Diti!)ary. ) t*is !)tet- t*e table key is es&eially
si)i$ia)t.
*e table (ey !$ a table combnes (ey $iel's- %*i* are als! alle'prmary key felds.
*e +alues i) t*e (ey $iel's all!% t*e system t! i'e)ti$yall 'ata re!r'sunuely.
9iel's t*at li)( t! !t*er tables are alle' foregn key felds. it* t*ese $!rei) (ey relati!)s*i&s y!u
a) ma)ae t*e 'ata *ierar*ially a)' !)siste)tly.
>C? SAP AG BC400 6
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
77/406
4.7
SAP AG 2001
uses
uses
Table including data
Technical Structure o$ a Transparent Table
Transparent tableTransparent table
8ata ele%ent
8o%ain
Field
@!u )!rmally use a 'ata eleme)t t! assi) a ty&e t! a table $iel'.
Sema)ti &r!&erties- su* as $iel' labels- are st!re' i) t*e 'ata eleme)t.
@!u )!rmally use a '!mai) $!r t*e te*)ial &r!&erties. *e 'ata ty&e- am!) !t*er t*i)s- is st!re'
i) t*e '!mai).
*e ABAP Diti!)ary !)tai)s t*e &lat$!rm:i)'e&e)'e)t 'esri&ti!) !$ t*e rele+a)t 'atabase table.
*e 'atabase table *as t*e same )ame as t*e tra)s&are)t table i) t*e ABAP Diti!)ary. *e $iel's
als! *a+e t*e same )ames i) b!t* t*e 'atabase a)' t*e ABAP Diti!)ary.
>C? SAP AG BC400
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
78/406
4.8
SAP AG 2001
Transparent Tables in the ABAP 8ictionary
Table 9dit oto u)'eriel! type?. *e &hort te1tst!re' %it* t*e 'ata eleme)t is liste' *ere. *e te*)ial attributes !$ t*e $iel' are liste' aai)
u)'erData type-+en'th- a)'Dec places. >A 'ata eleme)t )!rmally uses a '!mai).?
*is is a logcal $e#!$ t*e table. t is a &urely te*)ial 'esri&ti!). *e) it is &*ysially!)+erte'- t*e table is i) t*e database- %*ere y!u als! $i)' t*e table content!r t*e atual
a&&liati!) 'ata.
>C? SAP AG BC400 8
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
79/406
4.9
SAP AG 2001
Structures in the ABAP 8ictionary
Structure 9dit oto
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
80/406
4.10
SAP AG 2001
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
81/406
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
82/406
4.12
SAP AG 2001
8escribe the SAP $light data %odel
8escribe the structure o$ a transparent table
8escribe the structure o$ a structure
ist the possible uses o$ transparent tables andstructures in ABAP progra%s
ou are no& able to:
ntroduction to the ABAP 8ictionary:C? SAP AG BC400 #"
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
83/406
4.13ABAP 'ictionary E$ercises
1nt: 2ntroducton to the ABAP 3ctonary
Topc: 1sng 5lobal tructures
for 3ata +b,ects and 3alogs
At t*e !)lusi!) !$ t*ese eerises- y!u %ill be able t!E
1stablis* t*e te*)ial )ames !$ 'ata ty&es a)' 'ata !bets t*at are
use' i) user 'ial!s.
Ru) %*ere:use' lists %it*i) a) ABAP &r!ram.
@!u *a+e t! eami)e a s&ei$ie' ABAP &r!ram t! see %*et*er l!bal
'ata ty&es are use' i) it- a)' i$ s!- %*i* !)es.
Pr!ramE SAPBC400WBT_GETTING_STARTED
#:# O&e) t*e !bet list $!r 'e+el!&me)t lass BC400. 9i)' t*e &r!ram
SAPC!""3T/GETTING/STARTED- a)' !&e) its !bet list. *r!u*!ut t*eeerise- ma(e sure t*at y!u remai) i) dsplay mode.
#:" Ru) t*e &r!ram t! $i)' !ut *!% it %!r(s.
#:3 *ere is a) i)&ut $iel' !) t*e seleti!) sree).
#:3:# *at i)$!rmati!) must y!u &ass t! t*e &r!ramK
>;se L9# $!r $iel' *el&.?
#:3:" *at +alues a) y!u e)terK
>;se L94 $!r i)&ut *el&.?
#:3:3 *at i)$!rmati!) '!es t*e &r!ram &r!+i'eK
#:3:4 *at is t*e te*)ial )ame !$ t*e i)&ut $iel'K
>;se t*e Technical informationi) L9# $iel' *el&.?
>C? SAP AG BC400 #3
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
84/406
#:4 %! 'is&lay $iel's a&&ear !) t*e sree).
#:4:# 9i)' !ut t*e sree) )umber.
>C*!!se &ystem&tat$s.?
#:4:" *at i)$!rmati!) is 'is&laye'K
>;se L9#$iel' *el&.?
#:4:3 *at are t*e te*)ial )ames !$ t*e 'is&lay $iel'sK D! t*e $iel's bel!) t! a
struture %it* a l!bally 'e$i)e' ty&eK
>;se t*e Technical informationi) L9# $iel' *el&.?
#:5 ;se t*e !bet list t! a)alye t*e s!ure !'e !$ t*e &r!ram.
#:5:# *at 'ata !bets are t*ereK *ere are t*ey 'e$i)e' i) t*e &r!ramK
#:5:" *ere i) t*e &r!ram are t*ey use'K
>;se t*e %*ere:use' list i) t*e ABAP1'it!r.?
#:5:3 *at 'ata !bet !rres&!)'s t! t*e i)&ut $iel' !) t*e seleti!) sree)K>Sear* t*e !bet list $!r a 'ata !bet %it* t*e same )ame as t*e $iel' t*at
y!u $!u)' i) ste& #:3:4.?
>C? SAP AG BC400 #4
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
85/406
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
86/406
)
SAP AG 2001
8ata Types and 8ata 7b6ects
Basic ABAP State%ents
C? SAP AG BC400 #
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
87/406
5.2
SAP AG 2001
8e$ine ele%entary and structured data ob6ects
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
88/406
5.3
SAP AG 2001
8ata Types and 8ata 7b6ects
8ata Types and 8ata 7b6ects8ata Types and 8ata 7b6ects
Basic ABAP State%entsBasic ABAP State%ents
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
89/406
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
90/406
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
91/406
5.6
SAP AG 2001
8e$ining 8ata 7b6ects
Prede$ined
ABAP types
?
ocal types
#
+
st%#n(
?st%#n(
t
4
lobal
types
$
n
p
TYPES t'pe/name TYPE 000
DATA 4o/name TYPE t'pe/name0DATADATA
DATA 4o/name/ne. LI@E 4o/name0DATADATA
@!u a) use a &re'e$i)e' ABAP ty&e- a l!al- !r a l!bal ty&e t! ty&e a 'ata !bet.
*e $!ll!%i) &re'e$i)e' ABAP ty&es are !m&leteE
4 3ate >$!rmatE 7777))33? t Time >$!rmatE 66))? # 2)teer + *l!ati) &!i)t )umber st%#n( tri) >!$ +ariable le)t*? ?st%#n( Byte seue)e >*e8a'eimal stri)- !$ +ariable le)t*?
@!u must 'e$i)e t*e le)t* $!r t*ese &re'e$i)e' ty&esE
$ C*arater
n umeri *arater ? Byte >*e8a'eimal?p Pa(e' )umber > bi)ary !'e' 'eimals?. @!u must e)ter t*e )umber !$ 'eimal
&laes.
9!r m!re i)$!rmati!) !) &re'e$i)e' ABAP ty&es- re$er t! t*e (ey%!r' '!ume)tati!) !) TYPES!r
DATA.
@!u a) use LIKEt! re$er t! t*e ty&e !$ a &re'e$i)e' 'ata !bet.
>C? SAP AG BC400 6
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
92/406
5.7
SAP AG 2001
8e$ining 9le%entary 8ata 7b6ects
S/CARR/ID8ata
ele%ent
TYPES t/pe%$enta(eB TYPE p DECIMALS 0
DATA: n)m,e% TYPE # ;ALUE 4- t- #- +- st%#n(- a)' ?st%#n(? are !m&lete. *is mea)st*ey a) 'e$i)e a) eleme)tary 'ata !bet !$ t*ese ty&es as $!ll!%sEDATA do_nameTYPE pede!"ned_ABAP_$pe%
9!r t*e &re'e$i)e' ABAP ty&es $- n-p- a)' ?- y!u must 'e$i)e t*e le)t*. *is mea)s y!us*!ul' $irst 'e$i)e a) eleme)tary ty&eETYPES $pe_name&en'( TYPE pede!"ned_ABAP_$pe0
@!u use it t! 'e$i)e t*e 'ata !betEDATA do_nameTYPE $pe_name09!r ty&ep- y!u a) als! 'e$i)e t*e )umber !$ 'eimal &laes usi) t*e DECIMALSa''iti!).
@!u a) use t*e;ALUE
a''iti!) t! &re:assi) t*e +alue !$ a) eleme)tary 'ata !bet.
9!r !m&atibility reas!)s- y!u a) still !)strut 'ata !bets i) t*e DATAstateme)t %it*!ut$irst *a+i) t! 'e$i)e t*e ty&e l!ally i) t*e &r!ram %it* a TYPESstateme)t.
) t*e ase !$ i)!m&letely &re'e$i)e' ABAP ty&es- t*e system a''s sta)'ar' +alues t! ma(e u&t*e missi) ty&e i)$!rmati!).
$ t*ere is )! ty&e s&ei$iati!) at all- t*e system 'e$i)es a ty&e c 'ata !bet %it* a le)t* !$!)e.9!r t*e sta)'ar' le)t*s a)' $!r m!re i)$!rmati!)- re$er t! t*e (ey%!r' '!ume)tati!) $!r
TYPESa)' DATA.
*e same sy)ta a&&lies t! l!bal ty&es as t! user:'e$i)e' ty&esEDATA do_nameTYPE '&o)a&_$pe_name
>C? SAP AG BC400
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
93/406
5.8
SAP AG 2001
Fi'ed 8ata 7b6ects
iteral:iteral:
Constant:Constant: Fi'ed data ob6ect &ith 8 code
Fi'ed data ob6ect &ithout 8 code
#u%eric literal:
Positi"e integers: +23
#egati"e integers: =+23
#u%eric literal: Type i or p#u%eric literal: Type i or p Te't literal
Character string: KaBcd9K
8eci%al nu%bers: K+23!4)K
Floating point nu%bers: K+23!4)90+K
Te't literal: Type cTe't literal: Type c
CONSTANTS $onst/name TYPE t'pe/name ;ALUE l#te%al IS INITIAL 0CONSTANTSCONSTANTS
@!u assi) a +alue t! ea* $ie' 'ata !bet i) t*e s!ure !'e. *ere$!re- it a))!t be *a)e'at ru) time.
@!u a) use lterals t! tra)s$er $ie' +alues t! ABAP stateme)ts. *ere are )umeri literals a)'tet literals. *e latter are al%ays e)l!se' i) i)+erte' !mmasE
@!u a) 'is&lay i)teers as numerc lterals>i) t*e ase !$ )eati+e )umbers- %it* a&ree'i) si)?. *e system t*e) ma&s t*em !)t! t*e 'ata ty&e - i$ t*ey are %it*i) t*e +alue
ra)e !$ 4:byte i)teers.
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
94/406
5.9
SAP AG 2001
Basic ABAP State%ents
8ata Types and 8ata 7b6ects8ata Types and 8ata 7b6ects
Basic ABAP State%entsBasic ABAP State%ents
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
95/406
5.10
SAP AG 2001
?alue Assign%ents
ABAP runti%e syste%
MO;E $/+ TO $a%%#4C? SAP AG BC400 #0
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
96/406
5.11
SAP AG 2001
Calculations
COMPUTE pe%$enta(e 7 o$$ 2
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
97/406
5.12
SAP AG 2001
CASE 4ata/o,-e$t/
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
98/406
5.13
SAP AG 2001
oops
DO n TIMES 0000
ENDDO0
3HILE Klo(#$al/e?p%ess#on0
END3HILE0
LOOP AT 000
ENDLOOP0
SELECT 000
ENDSELECT0
DO0
IF Ka,o%t/$on4#t#on0 EXIT0 ENDIF0ENDDO0
oop counter:
sy=inde'
oop counter:
s'1#n4e?
State%ents
State%ents
State%ents
State%ents
State%ents
) ABAP t*ere are $!ur l!!& !)struti!)s- %*ereby LOOP1ENDLOOPa)' SELECT1ENDSELECTre&rese)t s&eial ases. ) t*e DOa)'3HILEl!!&s- t*e system st!res t*e )umber!$ t*e urre)t l!!& &ass i) t*e ,$/"nde1$iel'. $ t*ese l!!&s are )este'- ,$/"nde1!)tai)s
t*e )umber !$ t*e urre)t >t*at is- i))er? l!!&.
1ncondtonal&nde" controlled loops*e stateme)ts bet%ee) DOa)' ENDDOare eeute' u)til t*e l!!& is le$t !+er !t*er stateme)ts.
@!u als! *a+e t*e !&ti!) !$ s&ei$yi) t*e maimum )umber !$ l!!& &assesH !t*er%ise- y!u
may et a) e)'less l!!&.
6eader controlled loops
*e stateme)ts bet%ee)3HILEa)' END3HILEare eeute' !)ly i$ t*e !)'iti!)2&o'".a&_e1pe,,"on3*as bee) met.
@!u a) use t*e stateme)ts CHEC@a)' EXIT$!r 'i$$ere)t e$$ets !) t*e %ay t*e l!!& is&r!esse'. 9!r eam&le- y!u a) !)strut a footer-controlled l!!&.
>C? SAP AG BC400 #3
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
99/406
5.14
SAP AG 2001
8ialog (essages
MESSAGE nnnme,,a'e_.&a,, 3ITH 5 6 7 4 0
Typet
Beha"ior (essage appears in
s
#
.
e
a
?
Progra% continues &ithout
interruption
Progra% continues a$ter
interruption
Conte't dependent
Conte't dependent
Progra% aborted
-unti%e errorMESSAGE/TYPE/X
is triggered
Status line in ne't screen
(odal dialog bo'
Status bar
Status bar
(odal dialog bo'
Short du%p
(eaning
Status %essage
n$or%ation
Warning
9rror
Ter%ination
Short du%p
@!u a) use t*eMESSAGEstateme)t t! se)' 'ial! messaes. @!u must s&ei$y t*e t*ree:'iit
messae )umber a)' t*e messae lass.
9urt*erm!re- y!u a) use t*e3ITHa''iti!) t! i)lu'e u& t! $!ur +alues. *e system- 'e&e)'i) !)
t*e messae tet- i)serts t*ese +alues i)t! t*e messae tet.
@!u !)tr!l t*e 'ial! be*a+i!r usi) t*e ty&e abbre+iati!) t. *ere are si 'i$$ere)t ty&es !$
messaeE
a Ab!rt *e &r!ram is e)'e' a$ter a 'ial! b!.? 1"it *e &r!ram e)'s i) a s*!rt 'um&.e (rr!r Ru)time be*a+i!r is !)tet 'e&e)'e)t.. War)i) Ru)time be*a+i!r is !)tet 'e&e)'e)t.# 2)$!rmati!) *e &r!ram !)ti)ues a$ter a 'ial! b!.s uess*e messae a&&ears i) t*e status bar !) t*e subseue)t sree).
9!r $urt*er i)$!rmati!) ab!ut t*e sy)tati alter)ati+es !$ t*e MESSAGEstateme)t- re$er t! t*e
(ey%!r' '!ume)tati!).
>C? SAP AG BC400 #4
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
100/406
5.15
SAP AG 2001
-unti%e Beha"ior o$ 8ialog (essages
9ditor elp
ABAP 7"er"ie&ABAP Ter%
ABAP #e&s
ABAP 8ocu and 9'a%ples
el$
i
ABAP 8ocu%entation and 9'a%ples
@
@
@
@
@
BC = ABAP Progra%%ing
ABAP ntroduction
ABAP Progra%%ing anguage
ABAP i) t*e
$!ll!%i) 'ial! b!?
>C? SAP AG BC400 #5
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
101/406
5.16
SAP AG 2001
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
102/406
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
103/406
5.18
SAP AG 2001
S&itching to 8ebugging (ode at -unti%e
>h
Syste% elpSyste% elp
hM into the co%%and
$ield and then select N9nterO
7r:
Choose %enu Syste)
$ y!u %a)t t! 'ebu !)ly ertai) &arts !$ a &r!ram- start t*e &r!ram $irst a)' t*e) s%it* t!'ebui) m!'e be$!re a sree) *a)e. @!u a) '! t*is i) t%! %aysE
C*!!se &ystem%tilitiesDeb$' ABAP !rDeb$' screen.
1)ter *&i) t*e !mma)' $iel' a)' seletEnter.
>C? SAP AG BC400 #8
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
104/406
5.19
SAP AG 2001
8ebugging (ode: Single Step and Field Contents
F"el ?a*e
@F8R'S
1 4 F"el alue
SELECT SINGLE 2 FROM s$a%%INTO CORRESPONDING FIELDS OF .a/s$a%%
3HERE $a%%#4 7 pa/$a%%0 IF s'1s),%$ 7 "0 MO;E1CORRESPONDING .a/s$a%% TO s,$!""/$a%%#e%0
CALL SCREEN C? SAP AG BC400 #
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
105/406
5.20
SAP AG 2001
8ebugging (ode: Breakpoints
ar"an! 1 4 ar"an!
SELECT SINGLE 2 FROM s$a%%INTO CORRESPONDING FIELDS OF .a/s$a%%
3HERE $a%%#4 7 pa/$a%%0 IF s'1s),%$ 7 "0 MO;E1CORRESPONDING .a/s$a%% TO s,$!""/$a%%#e%0
CALL SCREEN
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
106/406
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
107/406
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
108/406
5.23
SAP AG 2001
8e$inition o$ Structures &ith lobal Types
DATA .a/+o$$ TYPE s,$!""+o$$0
TALES sp+l#0
DATADATA
TALESTALES
;a-occ
carr" sea!s*aconn" -la!e sea!socc $ercen!a(e
s$-l"
carr" c"!&-ro*conn" coun!r&-r a"r$-ro**an! ...coun!r&!o
SC!""FOCCStructure
SPFLITransparent
table
) ABAP- y!u a) 'e$i)e struture' 'ata !bets >sim&ly alle' strutures?. *is all!%s y!u t!
!mbi)e +alues t*at bel!) t!et*er l!ially i)t! !)e !bet.
Strutures a) be )este'. *is mea)s t*at !m&!)e)ts a) !)sist !$ m!re strutures !r e+e) tables.
*ere are t%! %ays t! 'e$i)e struturesE
9!r DATA ,-._nameTYPE ,-._$pe8y!u a) use local or global$pe,,-._$pe.
TALES '&o)a&_,-._$pe'e$i)es a struture t*at is te*)ially ma)ae' i) a s&eialmem!ry area. t *as t*e same )ame as t*e l!bal struture- '&o)a&_,-._$pe.
9!r t*is +aria)t- t*e l!bal struture must be $lat- t*at is- all !m&!)e)ts must *a+e a)
eleme)tary ty&e. Si)e Release 4.0- TABLESstrutures ser+e !)ly as i)ter$aes $!r sree)
$iel's..
>C? SAP AG BC400 "3
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
109/406
5.24
SAP AG 2001
8e$inition o$ Structures &ith ocal Types
TYPES: EGIN OF st/+l#(&t#n+o6$a%%#4 TYPE s/$a%%/#46 $onn#4 TYPE s/$onn/#46 +l4ate TYPE s/4ate6 seatsma? TYPE s+l#(&t1seatsma?6 seatso$$ TYPE s+l#(&t1seatso$$6 pe%$enta(eB TYPE p DECIMALS 6 END OF st/+l#(&t#n+o 0
DATA .a/+l#(&t#n+o TYPE st/+l#(&t#n+o0
EGIN OFEGIN OF
;a-l"(h!"n-o
carr" sea!s*aconn" -la!e sea!socc $ercen!a(e
END OFEND OF
@!u a) als! 'e$i)e struture ty&es l!ally usi) t*e TYPESstateme)t. *e !m&!)e)ts aree)l!se' by t*e $!ll!%i) stateme)ts as s*!%) i) t*e ra&*iEEGIN OF ,-.-e_$pe_name0000END OF ,-.-e_$pe_name0
1a* i)'i+i'ual !m&!)e)t a) i) tur) be assi)e' a)y ty&e y!u %is*.
9!r m!re i)$!rmati!)- re$er t! t*e (ey%!r' '!ume)tati!) $!r TYPES.
@!u 'e$i)e t*e 'ata !bet itsel$ i) t*e usual %ay.
9!r !m&atibility reas!)s- y!u a) als! 'iretly 'e$i)e a struture' 'ata !betE
DATA: EGIN OF ,-.-e_name000
END OF ,-.-e_$pe_name
>C? SAP AG BC400 "4
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
110/406
5.25
SAP AG 2001
Addressing Structure Co%ponents
DATA: .a/s$a%% TYPE s$a%%0
.a/s$a%% 1$a%%#4 7 9LH90
SELECT SINGLE 2 FROM s$a%% INTO .a/s$a%% 3HERE $a%%#4 7 .a/s$a%% 1$a%%#40
3RITE:* .a/s$a%% 1$a%%#46 .a/s$a%% 1$a%%name6 .a/s$a%% 1)%l0
11
;ascarr
*an! currcoecarr" carrna*e url
11
11
1111
C!m&!)e)ts !$ a struture are al%ays a''resse' usi) a *y&*e)E
,-.-e_name1.omponen_name% 9!r t*is reas!)- '! )!t use *y&*e)s i) )ames.
>C? SAP AG BC400 "5
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
111/406
5.26
SAP AG 2001
Copying Structure Co%ponents &ith the Sa%e #a%e
DATA: .a/s+l#(&t TYPE s+l#(&t6 .a/+o$$ TYPE s,$!""+o$$0
MO;E1CORRESPONDING .a/s+l#(&t TO .a/+o$$0MO;E1CORRESPONDINGMO;E1CORRESPONDING
;a-occ
carr" sea!s*aconn" -la!e sea!socc $ercen!a(e
;as-l"(h!
carr" ...conn" -la!e sea!s*a*an! ...sea!socc
TOTO
*e stateme)tMO;E1CORRESPONDING,o-.e_,-.TO a'e_,-.!&ies t*e!)te)ts !$ t*e struture ,o-.e_,-.i)t! t*e struture a'e_,-.!m&!)e)t by
!m&!)e)t. *e +alue assi)me)t %!r(s !)ly i$ t*e !m&!)e)ts *a+e i'e)tial )ames.
All !t*er !m&!)e)ts remai) u)*a)e'.
>C? SAP AG BC400 "6
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
112/406
5.27
SAP AG 2001
Structures in 8ebugging (ode
ar"an!
'a"n $ro(ra*
Source coe o-
SELECT SINGLE 2 FROM s$a%%INTO CORRESPONDING FIELDS OF .a/s$a%%
3HERE $a%%#4 7 pa/$a%%0 IF s'1s),%$ 7 "0 MO;E1CORRESPONDING .a/s$a%% TO s,$!""/$a%%#e%0
CALL SCREEN
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
113/406
5.28
SAP AG 2001
Working &ith nternal Tables
8ata Types and 8ata 7b6ects8ata Types and 8ata 7b6ects
Basic ABAP State%entsBasic ABAP State%ents
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
114/406
5.29
SAP AG 2001
nternal Tables
Table can be
e'tended dyna%ically
)ter)al tables are 'ata !bets t*at all!% y!u t! retai) se+eral 'ata re!r's %it* t*e samestruture i) mem!ry. ) &ri)i&le- t*e )umber !$ 'ata re!r's is u)limite'. t is restrite' !)ly
by t*e a&aity limits !$ s&ei$i system i)stallati!)s.
*e ABAP ru)time system 'y)amially ma)aes t*e le)t* !$ i)ter)al tables. *is elimi)atesa)y %!r( !)er)i) %!r(i) mem!ry ma)aeme)t.
*e i)'i+i'ual 'ata re!r's i) a) i)ter)al table are ()!%) as table lnes!r table e)tries. 9!rt*is reas!)- t*e i)'i+i'ual !m&!)e)ts i) a li)e are re$erre' t! as columns!$ t*e i)ter)al table.
*e li)e ty&e !$ a) i)ter)al table a) be a)y ABAP 'ata ty&e- eleme)tary !r struture'- !r it a)be a)!t*er i)ter)al table.
)ter)al tables are a sim&le %ay !$ &r!essi) lare 'ata re!r's i) a struture' $!rm %it*i) a&r!ram. y&ial uses i)lu'eE
Q em&!rarily st!ri) 'ata $r!m 'atabase tables $!r $uture &r!essi)
Q Struturi) a)' $!rmatti) 'ata $!r !ut&ut
Q 9!rmatti) 'ata $!r use by !t*er ser+ies
>C? SAP AG BC400 "
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
115/406
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
116/406
5.31
SAP AG 2001
nde' access
Eey access
#7#=
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
117/406
5.32
SAP AG 2001
8e$inition o$ nternal Tables &ith lobal Types
ine type and access
Eey Eey de$inition
Eey category
Eey co%ponents
ine type
8ata access type
SBC400F7CC
Standard table
Eey co%ponents
#on=uni5ue
CA--8
C7##8
F8AT9
SC!""/T/SC!""FOCCSC!""/T/SC!""FOCCTable typeTable type
DATA #ta,/+l#(&t#n+o TYPE s,$!""/t/s,$!""+o$$0DATADATA
"!ab-l"(h!"n-o
carr" sea!s*aconn" -la!e sea!socc $ercen!a(e
able ty&es a) be 'e$i)e' l!ally i) a &r!ram !r l!bally i) t*e ABAP Diti!)ary.
9!r DATA "a)_nameTYPE "a)_$pey!u a) use local or globalty&es "a)_$pe. 9!r 'etaile' i)$!rmati!) !) t*e 'e$i)iti!) !$ l!bal table ty&es i) t*e ABAP Diti!)ary- re$er t! t*e
SAP ibrary u)'erBasis ABAP Workbench B"2ABAP Dictionary Types Table types.
>C? SAP AG BC400 3"
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
118/406
5.33
SAP AG 2001
8e$inition o$ nternal Tables &ith ocal Types
TYPES: tt/+l#(&t#n+oTYPE STANDARD TALE OF s,$!""+o$$ 3ITH NON1UNI8UE @EY $a%%#4 $onn#4 +l4ate0
DATA #ta,/+l#(&t#n+o TYPE tt/+l#(&t#n+o0
STANDARD TALE OFSTANDARD TALE OF
"!ab-l"(h!"n-o
carr" sea!s*aconn" -la!e sea!socc $ercen!a(e
3ITH NON1UNI8UE @EY3ITH NON1UNI8UE @EY
@!u a) als! 'e$i)e i)ter)al table ty&es l!ally usi) t*e TYPEstateme)t.
*e table ty&e is s&ei$ie' bet%ee) TYPEa)' TABLE OF.
*e li)e ty&e !mes a$ter TABLE OF.
*e (ey $iel's are liste' a$ter t*e WITa''iti!). N!te t*at t*e !r'er !$ t*e (ey $iel's &lays a&art *ere.
9!r 'etaile' i)$!rmati!) ab!ut 'e$i)i) l!al table ty&es- re$er t! t*e (ey%!r' '!ume)tati!)!) TYPES.
@!u 'e$i)e t*e 'ata !bet itsel$ i) t*e usual %ay.
9!r !m&atibility reas!)s- y!u a) als! 'iretly 'e$i)e a) i)ter)al table as $!ll!%sEDATA "a)_nameTYPE a)&e_9"ndTALE OF ,-._$pe3ITH 9e$_de!0
>C? SAP AG BC400 33
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
119/406
5.34
SAP AG 2001
7"er"ie&: Typing Structured 8ata 7b6ects
DATA .a TYPE sp+l#0SELECT 000 FROM sp+l# INTO .a 000
TALES s,$!""+o$$0
DATA .a TYPE s,$!""+o$$0
DATA #t TYPE s,$!""/t/s,$!""+o$$0
ABAP progra% ABAP 8ictionary 8atabase
SPFLISPFLI
Transparent tableTransparent table
,8escription.
SC!""FOCCSC!""FOCC
StructureStructure
SC!""FOCCSC!""FOCC
StructureStructure
SC!""/T/SC!""FOCCSC!""/T/SC!""FOCC
Table typeTable type
AA +1 !!!
AA *4 !!!!!! !!! !!! 400 !!! 402 !!!
AA +1 !!!AA *4 !!!!!! !!! !!! 400 !!! 402 !!!
SPF
>C? SAP AG BC400 34
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
120/406
5.35
SAP AG 2001
7"er"ie&: Accessing Single -ecords
Append
nsert
-ead
Change
8elete
APPEND .a TO #ta,0
INSERT .a INTO TALE #ta, K$on4#t#on0
READ TALE #ta, INTO .a K$on4#t#on0
MODIFY TALE #ta, FROM .a K$on4#t#on 0
DELETE #ta, K$on4#t#on0
APPENDAPPEND
INSERTINSERT
READ TALEREAD TALE
MODIFYMODIFY
DELETEDELETE
*e $!ll!%i) si)le re!r' !&erati!)s are a+ailable $!r i)ter)al tablesE ) ea* ase.are&rese)ts a struture t*at must *a+e t*e same ty&e as t*e li)e ty&e !$ t*e i)ter)al table #ta,.
APPEND A&&e)'s t*e !)te)ts !$ a struture t! a) i)ter)al table. *is !&erati!) s*!ul'be use' %it* sta)'ar' tables !)ly.
INSERT )serts t*e !)te)ts !$ a struture i)t! a) i)ter)al table. ) a sta)'ar' table it isa&&e)'e'- i) a s!rte' table it is i)serte' i) t*e ri*t &lae- a)' i) a *as*e' table it is i)serte'
a!r'i) t! t*e *as* al!rit*m.
READ C!&ies t*e !)te)ts !$ a li)e i) a) i)ter)al table t! a struture.
MODIFY
O+er%rites a li)e i) a) i)ter)al table %it* t*e !)te)t !$ a struture.
DELETE Deletes a li)e !$ a) i)ter)al table.
COLLECT Aumulates t*e !)te)ts !$ a struture i)t! a) i)ter)al table. *is stateme)tmay be use' !)ly $!r tables %*!se )!):(ey $iel's are all )umeri. *e )umeri
+alues are summarie' $!r i'e)tial (eys
9!r 'etaile' i)$!rmati!) ab!ut t*e ABAP stateme)ts 'esribe' *ere- re$er t! t*e rele+a)t(ey%!r' '!ume)tati!).
>C? SAP AG BC400 35
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
121/406
5.36
SAP AG 2001
7"er"ie&: Processing Sets o$ -ecords
oop: For all single
record operations
77P AT itab #T7 &a NconditionO!
9#877P!!
DELETE #ta, K$on4#t#on0
INSERT LINES OF #ta,K$on4#t#on
INTO #ta,< K$on4#t#onC? SAP AG BC400 36
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
122/406
5.37
SAP AG 2001
Synta' 9'a%ple: Filling ine by ine
2 +#ll st%)$t)%e .#t& val)es:.a/+l#(&t#n+o1$a%%#4 7 000 0
.a/+l#(&t#n+o1$onn#4 7 000 0.a/+l#(&t#n+o1+l4ate 7 000 0.a/+l#(&t#n+o1seatsma? 7 000 0.a/+l#(&t#n+o1seatso$$ 7 000 0.a/+l#(&t#n+o1pe%$enta(e 7 000 0
2 #nse%t st%)$t)%e #nto #nte%nal ta,le:INSERT .a/+l#(&t#n+o INTO TALE #ta,/+l#(&t#n+o0
2 4e+#ne #nte%nal ta,le an4 .o%a%ea:DATA: #ta,/+l#(&t#n+o TYPE s,$!""/t/s,$!""+o$$6 .a/+l#(&t#n+o LI@E LINE OF #ta,/+l#(&t#n+o0
"!ab-l"(h!"n-o
;a-l"(h!"n-o
@!u a) i)sert li)es i)t! a) i)ter)al table by $irst $illi) a struture %it* t*e reuire' +alues a)' t*e)
i)serti) it i)t! t*e i)ter)al table usi) t*e INSERTstateme)t.
9!r sta)'ar' tables- t*is mea)s t*at t*e li)e is a&&e)'e' t! t*e table. 9!r s!rte' tables a)' *as*
tables- t*e system i)serts t*e li)e a$ter re$erri) t! t*e (ey.
>C? SAP AG BC400 3
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
123/406
5.38
SAP AG 2001
Synta' 9'a%ple: -eading Contents
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
124/406
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
125/406
5.40
SAP AG 2001
Synta' 9'a%ple: -eading
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
126/406
5.41
SAP AG 2001
7perations on the Whole nternal Table
Sort
8elete the entire
content o$ the
internal table
SORT #ta, K$on4#t#ons0
REFRESH #ta,0REFRESHREFRESH
SORTSORT
*e $!ll!%i) !&erati!)s a$$et t*e #holei)ter)al table.
SORT@!u a) use t*is t! s!rt a)y )umber !$ !lum)s i) a sta)'ar' !r *as*e' table i) ase)'i) !r
'ese)'i) !r'er. @!u may %a)t t! ta(e ulture:s&ei$i s!rt rules i)t! a!u)t.
REFRESH*is 'eletes t*e e)tire !)te)ts !$ a) i)ter)al table. A &art !$ t*e &re+i!usly use' %!r(i)
mem!ry remai)s a+ailable $!r $uture i)serti!)s.
FREE*is 'eletes t*e e)tire !)te)ts !$ t*e i)ter)al table a)' releases t*e &re+i!usly use' %!r(i)
mem!ry.
CLEAR;)li(e all !t*er 'ata !bets- t*is stateme)t *as t*e same e$$et as t*e REFRESstateme)t !)
i)ter)al tables %it* )! *ea'er li)e.
>C? SAP AG BC400 4#
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
127/406
5.42
SAP AG 2001
Synta' 9'a%ple: Sorting a Standard Table
SORT #ta,/+l#(&t#n+o Y pe%$enta(e DESCENDING0
2 4e+#ne #nte%nal ta,le an4 .o%a%ea:DATA: #ta,/+l#(&t#n+o TYPE s,$!""/t/s,$!""+o$$6 .a/+l#(&t#n+o LI@E LINE OF #ta,/+l#(&t#n+o0
"!ab-l"(h!"n-o
;a-l"(h!"n-o
YY DESCENDINGDESCENDING
#a%e o$ colu%n,s.
by &hich to sort
Ascending
or
descending@
@!u a) s!rt sta)'ar' tables by a)y !lum)- sim&ly by e)teri) t*e !lum) )ame a$ter t*e Ya''iti!) t! t*e SORTstateme)t.
SORT "a) ASCENDING DESCENDING Y !5 ASCENDING DESCENDING 0%% !n ASCENDING DESCENDING AS TEXT STALE 0
S!rti) t*e i)ter)al table by t*e table (ey !r s&ei$ie' $iel' !r'erE it*!ut a) a''iti!) t*e
system s!rts i) ase)'i) !r'er.
$ y!u use t*eAS TEXTa''iti!)- t*e system %ill- %*ile s!rti) by *arater:ty&e $iel's- ta(et*e ulture:s&ei$i s!rt rule i)t! a!u)t.
+nly i$ y!u use t*e STALEa''iti!) %ill t*e relati+e !r'er !$ 'ata re!r's- %*i* are i'e)tial
i) t*e s!rt (ey- remai) i)tat 'uri) s!rti).
) t*is eam&le- t*e 'ata re!r's !$ t*e i)ter)al table are s!rte' i) 'ese)'i) !r'er by t*e&ere)tae !u&a)y !$ $li*ts.
9!r m!re 'etails- re$er t! t*e (ey%!r' '!ume)tati!) $!r SORT.
>C? SAP AG BC400 4"
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
128/406
5.43
SAP AG 2001
nternal Tables in 8ebugging (ode
ar"an!
LOOP AT #t/+l#(&t#n+o INTO .a/+l#(&t#n+o0
3RITE: * .a/+l#(&t#n+o1$a%%#46.a/+l#(&t#n+o1$onn#46
F"e $o"n! ar"!h*e!"c 1% 30
E SAP
Wa!ch$o"n!
ABAP 'e"&**er
chwschws
,able
SCSBR# 0
it$lightin$o
8ouble=click the
data ob6ect +
2
3
4
)
*
1
H
AA
AA
AA
AA
nternal table it$lightin$o Type STA#8A-8
CA--8
00+1
00+1
00+1
00+1
0400
0400
0400
0400
C7##8
20000)+2
20000124
20000H2H
2000+224
20000*2*
200001+)
2000+++3
2000+2+2
F8AT9
!!!
!!!
!!!
!!!
!!!
!!!
!!!
!!!
!!!
**
+20
)*0
410
240
+23
213
2H0
P9-C9#TA9
Table
@!u a) trae t*e li)e !)te)ts !$ a) i)ter)al table by e)teri) t*e )ame i) t*e le$t !lum). ! see t*e
table 'is&lay- '!uble:li( t*is e)try.
>C? SAP AG BC400 43
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
129/406
5.44
SAP AG 2001
Co%parison: nternal Tables &ith>&ithout eader ines
nternal table
Work area
INSERT .a INTO #ta, INDEX n0
DELETE TALE #ta, FROM .a0
READ TALE #ta, INTO .a INDEX n03RITE .a1$a%%#40
INSERT #ta, INDEX n0
DELETE TALE #ta,0
READ TALE #ta, INDEX n03RITE #ta,1$a%%#40
%plicit synta':9'plicit synta':
itabitab
&a&a
nternal table
eader
itabitab
itabitab
INTOINTO
FROMFROM
INTOINTO
DATA #ta, TYPE STANDARD TALE OF s$a%%
3ITH NON1UNI8UE @EY $a%%#40
DATA .a TYPE s$a%%0
DATA #ta, TYPE STANDARD TALE OF s$a%%
3ITH NON1UNI8UE @EY $a%%#4 3ITH HEADER LINE03ITH HEADER LINE3ITH HEADER LINE
@!u a) 'e$i)e i)ter)al tables %it* !r %it*!ut a *ea'er li)e >3ITH HEADER LINEa''iti!)?.A) nternal table #th header lne !)sists !$ a %!r( area >t*e *ea'er li)e? a)' t*e atual table
b!'y. B!t* !bets are a''resse' #th the same name.
it is i)ter&rete' as t*e table b!'y.
! a+!i' !)$usi!)- use nternal tables #thout header lnes. *is is es&eially a&&are)t i) t*ease !$ )este' tables.@!u a) !$te) use a s*!rte)e' sy)ta >APPEND8 INSERT8 MODIFY8
COLLECT8 DELETE8 READ8 LOOP AT? $!r ertai) !&erati!)s !) i)ter)al tables %it*
*ea'er li)e. it*i) ABAP !bets- y!u a) )!% !)ly use i)ter)al tables %it*!ut a *ea'er.
@!u a) al%ays u)iuely a''ress t*e b!'y !$ a) i)ter)al table "a)by usi) t*e sy)ta"a). *is is true rear'less !$ %*et*er t*e i)ter)al table *as a *ea'er !r )!t.("ample:DATA #ta,< TYPE TALE OF # 3ITH HEADER LINE0DATA #ta, LI@E #ta,
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
130/406
5.45
SAP AG 2001
8e$ine ele%entary and structured data ob6ects
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
131/406
5.46ABAP +an*&a*e E%e)ents E$ercises
1nt: Basc ABAP anguage (lements
Topc: Basc ABAP tatements
At t*e !)lusi!) !$ t*ese eerises- y!u %ill be able t!E
De$i)e eleme)tary 'ata !bets
Assi) +alues
m&leme)t !)'iti!)al bra)*i)
Per$!rm alulati!)s
Create a) ABAP &r!ram $!r t*e $!ur basi alulati!) ty&es. @!u must
be able t! e)ter t*e +alues a)' arit*meti !&erat!r !) a seleti!) sree).Dis&lay t*e result i) a list.
Pr!ramE =C!""/>>/COMPUTE
M!'el s!luti!)E SAPBC400TSS_COMP+TE
##sta)'s $!r t*e t%!:'iit r!u& )umber.
#:# Create t*e eeutable &r!ram =C!""/>>/COMPUTE#thoutOP )lu'e.
#:" De$i)e t*e i)&ut &arameters $!r t%! i)teers >)ame suesti!)Epa/#ntC? SAP AG BC400 46
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
132/406
#:6 $ t*e user tries t! 'i+i'e by er!- 'is&lay a) a&&r!&riate stateme)t !) t*e list
sree).
) a later u)it y!u %ill lear) *!% y!u a) im&leme)t t*e err!r
*a)'li) %it* a m!re elea)t user 'ial!.
>C? SAP AG BC400 4
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
133/406
("ercses
1nt: Basc ABAP anguage (lements
Topc: Workng #th tructures
At t*e !)lusi!) !$ t*ese eerises- y!u %ill be able t!E
;se t*e Debuer t! trae t*e 'ata $l!% a)' u)'ersta)' t*e
!))eti!)s bet%ee) &r!essi) bl!(s.
;se t*eMO;E1CORRESPONDINGstateme)t t! assi) +alues bet%ee)strutures.
@!u *a+e t! eami)e a s&ei$ie' ABAP &r!ram t! asertai) %*e) a)'*!% ertai) 'ata is tra)s&!rte' bet%ee) ertai) struture' 'ata !bets.
Pr!ramE SAPBC400WBS_GETTING_STARTED
":# Start t*e &r!ram SAPC!""3S/GETTING/STARTED. O) t*e seleti!) sree)-e)ter t*e airli)e !'e TLHF. ) t*e !mma)' $iel'- e)ter I*&I a)' t*e) eeute t*e
&r!ram. @!u are )!% i) 'ebui) m!'e.
":" Ma(e sure t*at all !$ t*e 'ata !bets are i)itial. ra)s$er all !$ t*e 'ata !bets
'e$i)e' i) t*e &r!ram t! t*e $iel' +ie%. 9i)' !ut ab!ut t*e struture a)' ty&e !$ t*e
i)'i+i'ual !m&!)e)ts.
":3 Ste& t*r!u* t*e &r!ram- !)e stateme)t at a time- by *!!si) &in'le step>95?.
*i* $iel's !$ t*e struture ;a_,.a'!es t*e SELECTstateme)t $illK *at is
t*e +alue !$ system $iel' ,$/,-).a$ter t*e stateme)tK
":4 N!% !bser+e *!% $iel's are !&ie' $r!m t*e struture ;a_,.at! t*e struture
,).400_.a"e. *i* $iel' +alues are !&ie'K
":5 *e stateme)t CALL SCREEN 500&r!esses sree) #00. O) t*e sree)- e)ter
a&&r!&riate +alues $!r t*e user )ame- 'ate- a)' time- a)' !)ti)ue %it* t*e
&r!ram. N!% !bser+e *!% $iel's are !&ie' $r!m t*e struture
,).400_.a"et! t*e struture ;a_,.a.
":6 9i)ally- !bser+e *!% t*e WRITEstateme)t !)struts t*e list.
>C? SAP AG BC400 48
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
134/406
A$ter t*e $irst WRITEstateme)t- a) etra butt!) a&&ears i) t*e
a&&liati!) t!!lbar- %*i* all!%s y!u t! 'is&lay t*e urre)t !)te)ts
!$ t*e list bu$$er at a)y time.
": Restart t*e &r!ram i) Debui) m!'e. Set a brea(&!i)t at t*e MO*E/
CORRESPONDINGstateme)t. Be$!re t*e sree) is &r!esse'- assi) a )ame t! t*estruture !m&!)e)t ,).400_.a"e/-namei) t*e Debuer.
*e butt!) use' t! *a)e t*e $iel' +alues at ru)time is )et t! t*e
i)&ut/!ut&ut $iel'.
":8 Re&eat ste& ":#. N!% set a brea(&!i)t at t*e CALL SCREENstateme)t.
A''iti!)ally- set a $iel' !)te)t:'e&e)'e)t %at*&!i)t $!r t*e !)'iti!) t*at a $iel'
+alue !$ t*e struture ;a_,.a*a)es. C*!!se "ontin$e>98? t! !)ti)ue t*e
&r!ram a)' *e( %*y t*e 'ebui) !$ t*e &r!ram is st!&&e' i) ea* ase.
>C? SAP AG BC400 4
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
135/406
("ercses
1nt: Basc ABAP anguage (lements
Topc: Workng #th 2nternal Tables
At t*e !)lusi!) !$ t*ese eerises- y!u %ill be able t!E
Sear* $!r suitable table (i)'s i) t*e ABAP Diti!)ary
De$i)e i)ter)al tables base' !) a l!bal table (i)'
9ill i)ter)al tables usi) array $et*
Pr!ess t*e !)te)t !$ i)ter)al tables usi) a l!!&.
Create a) ABAP &r!ram t*at lists a''iti!)al i)$!rmati!) !) all eisti)$li*t 'e&arture times.
Get t*e 'ata $r!m t*e 'atabase table SPFLI.
Pr!ramE =C!""/>>/ITA/LOOP
M!'el s!luti!)E SAPBC400TSS_ITAB_LOOP
##sta)'s $!r t*e t%!:'iit r!u& )umber.
3:# Create t*e eeutable &r!ram =C!""/>>/ITA/LOOP#thoutOP:)lu'e.
3:" Bu$$er t*e 'ata $r!m t*e 'atabase table SPFLIi) a) i)ter)al table. De$i)e a) i)ter)al
table %it* a li)e ty&e t*at is !m&atible %it* t*e li)e struture !$ SPFLI.
) t*e ABAP Diti!)ary- sear* $!r all i)ter)al table (i)'s t*at mat* t*is !)'iti!).
>;se t*e Where2$se! listi) t*e ABAP 1'it!r.?
3:3 De$i)e a) i)ter)al table >)ame suesti!)E #t/sp+l#? base' !) !)e !$ t*e l!baltable ty&es y!u *a+e $!u)'.
3:4 De$i)e a %!r( area t*at !rres&!)'s t! t*e i)ter)al table >)ame suesti!)E
.a/sp+l#?.
3:5 Pr!ram a) array $et* aess t! all t*e 'ata re!r's i) t*e 'atabase table SPFLIESELECT 2 FROM sp+l# INTO TALE #t/sp+l#0
3:6 Dis&lay t*e bu$$ere' 'ata i) a list.
>C? SAP AG BC400 50
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
136/406
;se t*e LOOPstateme)t t! '! t*is.
>C? SAP AG BC400 5#
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
137/406
5.47ABAP +an*&a*e E%e)ents So%&tions
1nt: Basc ABAP anguage (lements
Topc: Basc ABAP tatements
# )odel soluton:
REPORT sap,$!""tss/$omp)te0
PARAMETERS: pa/#nt< TYPE #6 pa/op
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
138/406
olutons
1nt: Basc ABAP anguage (lements
Topc: Workng #th tructures
":3 *i* !m&!)e)ts are $ille' by t*e SELECTstateme)t CK
man4t- $a%%#4- $a%%name- $)%%$o4e- )%l.
*at is t*e +alue !$ t*e system $iel' ,$/,-).a$ter t*e SELECTstateme)tK
Beause t*ere is a 'ata re!r' $!r t*e airli)e 6>u$t*a)sa? i) t*e 'atabase tableSCARR- s'1s),%$is set t! er!.
":4 *i* $iel' +alues are !&ie'K
man4t- $a%%#4- $a%%name- $)%%$o4e.
>C? SAP AG BC400 53
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
139/406
olutons
1nt: Basc ABAP anguage (lements
Topc: Workng #th 2nternal Tables
3 )odel soluton:
REPORT sap,$!""tss/#ta,/loop0
DATA: #t/sp+l# TYPE s,$!""/t/sp+l#0DATA: .a/sp+l# TYPE sp+l#0
SELECT 2 FROM sp+l# INTO TALE #t/sp+l#0
< a &ea, one daa,e ,e&e.edIF s'1s),%$ 7 "0
< moe ea.( ,"n'&e daa,e !om "nena& a)&e o< ,-.-e WA_SPFLI "n ode o ;"e daa on &", LOOP AT #t/sp+l# INTO .a/sp+l#0 3RITE: * .a/sp+l#1$a%%#46 .a/sp+l#1$onn#46 .a/sp+l#1$#t'+%om6 .a/sp+l#1$#t'to6 .a/sp+l#14ept#me6 .a/sp+l#1a%%t#me0 ENDLOOP0ENDIF0
>C? SAP AG BC400 54
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
140/406
*
SAP AG 2001
8ata -etrie"al $or 8atabase Tables
uerying the 8atabase
-eading 8atabase Tables
Authori;ation Checks
Pre"ie&
Contents:
8ata -etrie"al
>C? SAP AG BC400 #
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
141/406
6.2
SAP AG 2001
ist "arious &ays o$ $inding database tables
Progra% read access to speci$ic colu%ns andlines &ithin a particular database table
%ple%ent authori;ation checks
ist the read access options $or %ultiple databasetables
At the conclusion o$ this unit you &ill be able to:
8ata -etrie"al:
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
142/406
6.3
SAP AG 2001
ABAP
Processing
block
ABAP runti%e syste%
ABAP progra%
uerying the 8atabase
8ata ob6ects
&ascarr
8atabase
inter$ace
S99CT !!!
scarr
8atabase8atabaseSS8atabase8atabase==
speci$icspeci$ic
con"ersioncon"ersion
pacar
SCA--
SELECTSELECT
FROMFROM
7pen7penSS
8atabase
table
+pen C? SAP AG BC400 3
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
143/406
6.4
SAP AG 2001
Searching $or 8atabase Tables
Searching &ithin a particular application co%ponent:Application hierarchy!
Searching using a progra% :
Search in the ABAP 9ditor $or the S99CT state%ent
Change to debugging %ode during progra% e'ecution andset breakpoint in the S99CT state%ent
$ the progra% trans%its a screen display the structure $ieldusing F+ and technical in$or%ation or na"igate directly to the
data ele%ent ,double=click. or go directly to the data ele%ent
,by double=clicking it. and open the &here=used list in the
tables
@!u a) sear* $!r 'atabase tables +ia t*e A&&liati!)
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
144/406
6.5
SAP AG 2001
-eading 8atabase Tables
-eading 8atabase Tables-eading 8atabase Tables
Authori;ation ChecksAuthori;ation Checks
Pre"ie&Pre"ie&
>C? SAP AG BC400 5
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
145/406
6.6
SAP AG 2001
Which colu%ns@ Which table,s.@
WheretoWhereto@@
Which lines@
S99CT NresultO F-7( NtableO
#T7 NtargetO
W9-9 NconditionO
Particular
colu%n
I(ultiple linesR
Single line
Progra%%ing 8atabase -ead Access
! &r!ram 'atabase rea' aess- use t*e O&e) S stateme)t SELECT.
*eSELECTstateme)t !)tai)s a series !$ lauses- ea* !$ %*i* *as a 'i$$ere)t tas(E
*e SELECTlause 'esribes- am!) !t*er t*i)s- %*et*er t*e result !$ t*e seleti!)%ill be se+eral li)es !r a si)le 'ata re!r' a)' %*i* $iel's !$ t*e table are t! be rea'.
*e FROMlause )ames t*e s!ure >'atabase table !r +ie%? $r!m %*i* t*e 'ata is t!be selete'.
*e INTOlause 'etermi)es t*e i)ter)al 'ata !bets i)t! %*i* t*e selete' 'ata is t!be &lae'.
*e3HERElauses&ei$ies t*e !)'iti!)s t*at t*e seleti!) results must $ul$ill. t t*us'etermi)es t*e li)es t! be selete' $r!m t*e table.
9!r i)$!rmati!) ab!ut !t*er lauses- re$er t! t*e (ey%!r' '!ume)tati!) $!r SELECT.
>C? SAP AG BC400 6
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
146/406
6.7
SAP AG 2001
-eading by Single -ecord Access
pacar
SELECT SINGLE 2 FROM s$a%% INTO .a/s$a%%
3HERE $a%%#4 7 pa/$a%0IF s'1s),%$ 7 "0 000
SINGLESINGLE
8atabase
inter$ace
&ascarr
INTOINTO
3HERE3HERE
SCA--
8atabase
table
*e SELECT SINGLE= stateme)t all!%s y!u t! rea' a sngle record$r!m t*e 'atabase table.! e)sure t*at y!u rea' a u)iue e)try- all !$ t*e (ey $iel's must be $ille' by t*e3HERElause.
*e asteris( J a$ter SNG1 tells t*e 'atabase i)ter$ae t! rea' all !lum)s i) t*at li)e !$ t*e
'atabase table. $ y!u %a)t !)ly a s&ei$i seleti!) !$ !lum)s- y!u a) list t*e reuire' $iel's
i)stea'.
) t*e INTOlause- e)ter t*e 'esti)ati!) %*ere t*e 'atabase i)ter$ae is t! !&y t*e 'ata. *etaret area s*!ul' be struture' le$t usti$ie' ust li(e t*e reuire' !lum)s !$ t*e 'atabase table.
$ y!u use t*e CORRESPONDING FIELDS OFa''iti!) i) t*e INTO lause- y!u a) $ill t*etaret area !m&!)e)t by !m&!)e)t. *e system $ills !)ly t*!se !m&!)e)ts t*at *a+e
i'e)tial )ames t! !lum)s i) t*e 'atabase table. N!teE $ y!u '! )!t use t*is a''iti!)- t*esystem $ills t*e taret area le$t usti$ie'- irres&eti+e !$ its struture.
$ t*e system $i)'s a table e)try mat*i) y!ur !)'iti!)s- SY/S+BRC*as t*e +alue er! >0?.
*e SINGLEa''iti!) tells t*e 'atabase t*at !)ly !)e li)e )ee's t! be rea'. *e 'atabase a)t*e) termi)ate t*e sear* as s!!) as it *as $!u)' t*at li)e. *ere$!re- SELECT SINGLE
&r!'ues better &er$!rma)e $!r si)le:re!r' aess t*a) a SELECTl!!& i$ y!u su&&ly +alues
$!r all (ey $iel's
>C? SAP AG BC400
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
147/406
6.8
SAP AG 2001
-eading Se"eral ines 0? i$ t*e 'atabase i)ter$ae *as $!u)' at least !)e re!r'.
A$ter t*e ENDSELECTstateme)t- s'14,$nt!)tai)s t*e t!tal )umber !$ li)es rea'.
>C? SAP AG BC400 8
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
148/406
6.9
SAP AG 2001
-eading Se"eral ines
-
7/27/2019 BC400 ABAP Workbench Concepts and Tools
149/406
6.10
SAP AG 2001
ABAP progra%
DATA .a/s,$!""+o$$ TYPE s,$!""+o$$0
SELECT SINGLE $a%%#4 $onn#4 +l4ate seatsma? seatso$$ FROM s+l#(&t INTO .a/s,$!""+o$$ 3HERE $a%%#4 7 pa/$a% AND $onn#4 7 pa/$on AND +l4ate 7 pa/4ate0
#T7 Clause: Target Structure Suitable $orField ist
Sa%e type as
colu%n read
INTOINTO.a.a/s,$!""+o$$/s,$!""+o$$
$a%%#4 $onn#4 +l4ate seatsma? seatso$$$a%%#4 $onn#4 +l4ate seatsma? seatso$$
&asbc400$occ
*e &r!ram must !)tai) a 'ata !bet %it* a suitable ty&e $!r ea* !lum) t*at is reuire'$r!m a 'atabase table. 9!r &r!ram mai)te)a)e reas!)s- y!u must use t*e !rres&!)'i)
Diti!)ary !bets t! assi) ty&es t! t*e 'ata !bets. *e INTOlauses&ei$ies t*e 'ata !beti)t! %*i* y!u %a)t t! &lae t*e 'ata $r!m t*e 'atabase table. @!u a) use t*e INT