Anda di halaman 1dari 407

BC400 ABAP Workbench Concepts and

Tools
BC400
Release 46D 26.03.2003
0
SAP AG 2001
BC400 ABAP Workbench Concepts and Tools
SAP AG
BC400
BC400
ABAP Workbench:
ABAP Workbench:
Foundations and
Foundations and
Concepts
Concepts
R/3 System
Release 4.6D
Material Number 5004 8586
Ot!ber "00#
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
,
- ./NDO.S
,
- N0
,
- 12C13
,
- .!r'
,
- P!%erP!i)t
,
a)' S43 Ser+er
,
are re5istere'
tra'emar(s !$ Mir!s!$t C!r&!rati!).
/BM
,
- DB"
,
- OS/"
,
- DB"/6000
,
- Parallel Sys&le6
,
- M7S/1SA
,
- RS/6000
,
- A/2
,
- S/380
,
- AS/400
,
-
OS/380
,
- a)' OS/400
,
are re5istere' tra'emar(s !$ /BM C!r&!rati!).
ORAC31
,
is a re5istere' tra'emar( !$ ORAC31 C!r&!rati!).
/N9ORM/2
,
:O)3i)e $!r SAP a)' /N9ORM/2
,
Dy)ami Ser+er
0M
are re5istere' tra'emar(s !$
/)$!rmi6 S!$t%are /)!r&!rate'.
;N/2
,
- 2/O&e)
,
- OS9/#
,
- a)' M!ti$
,
are re5istere' tra'emar(s !$ t*e O&e) Gr!u&.
<0M3- D<0M3- 2M3- 2<0M3 are tra'emar(s !r re5istere' tra'emar(s !$ .3C
,
- .!rl' .i'e
.eb C!)s!rtium- Massa*usetts /)stitute !$ 0e*)!l!5y.
=A7A
,
is a re5istere' tra'emar( !$ Su) Mir!systems- /).
=A7ASCR/P0
,
is a re5istere' tra'emar( !$ Su) Mir!systems- /).- use' u)'er lie)se $!r
te*)!l!5y i)+e)te' a)' im&leme)te' by Netsa&e.
SAP- SAP 3!5!- R/"- R/7A- R/3- ABAP- SAP Ar*i+e3i)(- SAP Busi)ess .!r($l!%- .eb9l!%-
SAP 1arly.at*- BAP/- SAPP</R1- Ma)a5eme)t C!(&it- mySAP.!m 3!5! a)' mySAP.!m
are tra'emar(s !r re5istere' tra'emar(s !$ SAP AG i) Germa)y a)' i) se+eral !t*er !u)tries all
!+er t*e %!rl'. All !t*er &r!'uts me)ti!)e' are tra'emar(s !r re5istere' tra'emar(s !$ t*eir
res&eti+e !m&a)ies.
0.3
SAP AG 1999
ABAP Workbench
ABAP Workbench:
Founa!"ons an
#once$!s
BC400 % a&s
'ana("n( ABAP
De)elo$*en!s Pro+ec!s
(BC40 2 a&s
Da!a ,rans-er
BC420 % a&s
,echn".ues o- /"s!
Process"n( an 0n-oSe!
1uer&
BC40)
3 a&s
SAPscr"$!: For*s Des"(n
an ,e2! 'ana(e*en!
BC4*0 3 a&s
#A,,:,es! Workbench an
#o*$u!er A"e ,es! ,ool
CA*+0 ,-el! 4!0. 2 a&s
ABAP Per-or*ance
,un"n(
BC4/0 3 a&s ABAP Pro(ra**"n(
,echn".ues
BC402 3 a&s
Pro(ra**"n(
Da!abase 3$a!es
BC4+4 3 a&s
4nhance*en!s
an 'o"-"ca!"ons
BC42) 3 a&s
Reco**ene su$$le*en!ar&
courses are:
Bus"ness Process ,echnolo("es
CA/2)0 CA/2*0 CA/21
BC0/) 5Bus"ness 0n!e(. ,echn.6
BC*+/ 5A/467 BC*200 BC*2+
2e"el 2
ABAP 8b+ec!s: 8b+ec! 9
8r"en!e Pro(ra**"n( "n R:3
BC404 3 a&s
For* Pr"n!"n( 3s"n(
SAP S*ar! For*s
BC410 2 a&s
ABAP D"c!"onar&
BC430 2 a&s
D"alo( Pro(ra**"n(
us"n( 4n+o&SAP #on!rols
BC4+2 3 a&s
Pro(ra**"n(
3ser D"alo(s
BC4+0 % a&s
#o**un"ca!"on
0n!er-aces "n ABAP
BC4+) 2 a&s
2e"el 3
0.4
SAP AG 1999
4TS
2e"el 3 2e"el 2
ABAP Workbench:
Founa!"on an
#once$!s
BC400 % a&s
2e"el 3 2e"el 2
#or$ora!e 0en!"!& Des"(n
4TS+)0 2 a&s
SAP 0n!erne! ,ransac!"on
Ser)er: A*"n"s!ra!"on
4TS010 2 a&s
De)elo$"n( Web Scenar"os
an '"n"A$$s us"n( 0,S
Flo; /o("c
4TS++0
2 a&s
De)elo$"n(
4as&Web,ransac!"ons
4TS+00 2 a&s
SAP 0n!erne! ,ransac!"on
Ser)er: Founa!"ons
4TS0)0 3 a&s
0.5
SAP AG 2001
Course Prere5uisites
Progra%%ing kno&ledge
Contents o$ SAP)0 training course ,Basis
Technology.
0.6
SAP AG 2001
Target group
Participants: (e%bers o$ pro6ect tea%
2ength: ) days
0*e trai)i)5 materials are not teach-yourself programs. 0*ey complement the course nstructor!s
e"planatons. O) t*e s*eets- t*ere is s&ae $!r y!u t! %rite '!%) a''iti!)al i)$!rmati!).
0*ere may )!t be time 'uri)5 t*e !urse itsel$ $!r y!u t! !m&lete all t*e e6erises. 0*e e6erises
are i)te)'e' as a''iti!)al e6am&les !$ t*e t!&is 'isusse' 'uri)5 t*e !urse. Partii&a)ts a) als!
use t*em as a) ai' t! e)*a)i)5 t*eir ()!%le'5e a$ter t*e !urse *as $i)is*e'.
+
SAP AG 2001
Course 7"er"ie&
Course oals
Course 7b6ecti"es
Course Content
(ain Business Scenario
4%portant 8atabase Tables $or the Flight 8ata (odel
Contents:
>C? SAP AG BC400 #
1.2
SAP AG 2001
At the conclusion o$ this unit0 you &ill be able
to:
Course oals
9'plain the basics o$ the ABAP progra%%ing
language0 including:
Basic synta' ele%ents
8i$$erent types o$ user dialogs
:o& to read database accesses
8escribe the "arious uses o$ the ABAP Workbench0
including:
Support through de"elop%ent tools
Support in organi;ation and transport
>C? SAP AG BC400 "
1.3
SAP AG 2001
Course 7b6ecti"es
Create an ABAP progra% containing user dialogs
and database accesses
8escribe the di$$erent types o$ de"elop%ent ob6ects
and their typical uses
<se appropriate tools to create basic e'a%ples $or
the -epository ob6ects introduced in the course
At the conclusion o$ this course0 you &ill be able to:
>C? SAP AG BC400 3
1.4
SAP AG 2001
3n"! 1 4ntroduction
3n"! 2 Progra% Flo& in an ABAP Progra%
3n"! 3 4ntroduction to the ABAP Workbench
3n"! 4 4ntroduction to the ABAP 8ictionary
3n"! % Basic ABAP 2anguage 9le%ents
3n"! 6 8ata -etrie"al
3n"! < 4nternal Progra% (odulari;ation &ith Subroutines
3n"! = The ABAP -unti%e Syste%
3n"! 9 <ser 8ialog 2ist
3n"! 10 <ser 8ialog Selection Screen
Table o$ Contents 4
>C? SAP AG BC400 4
1.5
SAP AG 2001
3n"! 11 <ser 8ialog Screen
3n"! 12 <ser 4nter$ace
3n"! 13 Perspecti"e: 8e"elop%ent o$ 4nternet Applications
3n"! 14 Cross=Progra% (odulari;ation
3n"! 1% So$t&are 2ogistics and So$t&are Ad6ust%ent
Appendi'
Table o$ Contents 44
>C? SAP AG BC400 5
1.6
SAP AG 2001
4n this course0 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%ation0 such as
Price
Capacity
8eparture city
8eparture airport
8estination airport
8estination city
(ain Business Scenario
>C? SAP AG BC400 6
1.7
SAP AG 2001
4%portant 8atabase Tables $or the Flight 8ata
(odel
SCARR SCARR CARRID:
CARRNAME:
CURRCODE:
Airline 48
Airline na%e
2ocal currency o$ airline
SPFLI SPFLI CARRID:
CONNID:
COUNTRYFR:
CITYFROM:
AIRPFROM:
COUNTRYTO:
CITYTO:
AIRPTO:
Airline 48
Flight connection 48
Country key $or departure city
8eparture city
8eparture airport
Country key $or arri"al city
8estination city
8estination airport
SFLIGHT SFLIGHT CARRID:
CONNID:
FLDATE:
PRICE:
CURRENCY:
SEATSMAX:
SEATSOCC:
Airline 48
Flight connection 48
Flight date
Price
Currency
(a'i%u% nu%ber o$ seats on $light
Current nu%ber o$ occupied seats on $light
@!u %ill re$er t! t*is i)$!rmati!) as y!u '! t*e e6erises t*r!u5*!ut t*is !urse.
>C? SAP AG BC400 A
2
SAP AG 2001
Syste% Architecture and ABAP Progra%
Sa%ple Progra% &ith Selection Screen and 2ist
Contents:
Progra% Flo& in an ABAP Progra%
>C? SAP AG BC400 #
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 unit0 you &ill be able to:
Progra% Flo& o$ an ABAP Progra%: <nit
7b6ecti"es
>C? SAP AG BC400 "
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 2ist
Sa%ple Progra% &ith Selection Screen and 2ist
>C? SAP AG BC400 3
2.4
SAP AG 2001
Client>Ser"er Architecture
Presentation
Ser"er
2ayer
Application
Ser"er
2ayer
8atabase




8ispatcher
Work
Process
SAP<4 SAP<4 SAP<4 SAP<4 SAP<4 SAP<4
Work
Process
Work
Process
Work
Process
8ispatcher
Work
Process
Work
Process
Work
Process
Work
Process
0*e R/3 System *as a m!'ular s!$t%are ar*iteture t*at $!ll!%s soft#are-orented
lie)t/ser+er &ri)i&les.
0*e R/3 System all!ates t*e &rese)tati!)- a&&liati!) l!5i- a)' 'ata st!ra5e t! 'i$$ere)t
!m&uters. 0*is ser+es as t*e basis $!r t*e scalablty !$ t*e R/3 System.
0*e l!%est le+el is t*e database le$el. <ere 'ata is ma)a5e' %it* a relati!)al 'atabase
ma)a5eme)t system >RDBMS?. /) a''iti!) t! a&&liati!) 'ata- t*e 'atabase !)tai)s t*e
&r!5rams a)' t*e meta'ata t*at t*e R/3 System reBuires $!r sel$:ma)a5eme)t.
ABAP &r!5rams >b!t* t*e a&&liati!)s &r!+i'e' by SAP a)' t*e !)es y!u 'e+el!& y!ursel$? ru)
at t*e applcaton ser$er le$el. 0*e ABAP &r!5rams rea' 'ata $r!m t*e 'atabase le+el- &r!ess
t*e 'ata- a)' &!ssibly st!re 'ata t*ere.
0*e presentaton ser$er le$el !)tai)s t*e user i)ter$ae t*r!u5* %*i* ea* user a) aess
t*e &r!5ram- e)ter )e% 'ata- a)' 'is&lay t*e results !$ a %!r( &r!ess.
0*e te*)ial 'istributi!) !$ s!$t%are is i)'e&e)'e)t !$ its &*ysial l!ati!) !) t*e *ar'%are.
All le+els a) be i)stalle' +ertially >!) t!& !$ ea* !t*er !) !)e !m&uter? !r ea* le+el a) be
i)stalle' !) a se&arate !m&uter. 0*e &rese)tati!) a)' a&&liati!) ser+ers a) be 'i+i'e'
*!riC!)tally am!)5 a)y )umber !$ !m&uters. 0*e *!riC!)tal 'istributi!) !$ 'atabase
!m&!)e)ts- *!%e+er- 'e&e)'s !) t*e ty&e !$ 'atabase i)stalle'.
>C? SAP AG BC400 4
2.5
SAP AG 2001
9'cerpt $or an ABAP Progra%
Presentation
Ser"er
2ayer
Application
Ser"er
2ayer
8atabase
Work Process


ABAP Progra%
0*is 5ra&*i a) be sim&li$ie' $!r m!st t!&is 'isusse' 'uri)5 t*is !urse. 0*e i)terati!)
bet%ee) a sngle user a)' a sngle ABAP &r!5ram %ill be !$ &rimary i)terest t! us 'uri)5 t*is
!urse.
0*e e6at &r!esses i)+!l+e' i) user 'is&at*i)5 !) a) a&&liati!) ser+er are se!)'ary t!
u)'ersta)'i)5 *!% t! %rite a) ABAP &r!5ram. 0*ere$!re- %e %ill %!r( %it* a sim&li$ie'
5ra&*i t*at '!es )!t e6&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!5rammi)5.
ABAP &r!5rams are &r!esse' !) t*e a&&liati!) ser+er. 0*e 'esi5) !$ user dalogs a)'
database dalogs is- t*ere$!re- !$ &artiular im&!rta)e %*e) %riti)5 a&&liati!) &r!5rams.
>C? SAP AG BC400 5
2.6
SAP AG 2001
Black Black Bo' Bo'
?ie& $or the <ser
Presentation
Ser"er
2ayer
Application
Ser"er
2ayer
8atabase


Selection Screen 2ist Screen
M!st users are !)ly i)tereste' i) *!% a busi)ess tra)sati!) $l!%s a)' *!% t! e)ter 'ata i)t!
a)' 'is&lay 'ata $r!m a tra)sati!). 0*e te*)ial as&ets !$ &r!5rammi)5 are less i)teresti)5.
0*e user '!es )!t )ee' t! ()!% t*e &reise $l!% !$ t*e ABAP &r!5ram !) t*e a&&liati!)
ser+er. 0! t*e a+era5e user- t*e SAP system is li(e a Dbla( b!6.D
0e*)ially s&ea(i)5- t*ere are t*ree 'i$$ere)t ty&es !$ sree)sE 'y)ami sree)s !r 'y)&r!s-
seleti!) sree)s- a)' lists. 1a* ty&e !$ sree) &r!+i'es 'i$$ere)t ser+ies. 0*e 'e+el!&erFs tas(
is t! selet $!r ea* user 'ial!5 e6atly t*!se ty&es t*at are m!st suitable $!r t*e
a!m&lis*me)t !$ t*e tas(s !)er)e'. 9!r t*is reas!)- 'e+el!&ers s*!ul' *a+e &reise
()!%le'5e !$ t*e te*)ial as&ets.
>C? SAP AG BC400 6
2.7
SAP AG 2001
4nteraction Bet&een Ser"er 2ayers
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)5 Enter, a $u)ti!) (ey- a me)u $u)ti!) !r a
&us*butt!)- $!r e6am&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!5ram are &r!esse'.
/$ a $urt*er user 'ial!5 is tri55ere' $r!m %it*i) t*e ABAP &r!5ram- t*e system tra)smits t*e sree)
a)' &asses !)tr!l !)e a5ai) t! t*e &rese)tati!) ser+er.
>C? SAP AG BC400 A
2.8
SAP AG 2001
Sa%ple Progra% &ith Selection Screen and 2ist
Syste% Architecture and ABAP Progra%
Syste% Architecture and ABAP Progra%
Sa%ple Progra% &ith Selection Screen and 2ist
Sa%ple Progra% &ith Selection Screen and 2ist
>C? SAP AG BC400 8
2.9
SAP AG 2001
Ti%e
Progra%
Start


Progra% Start
8atabase
Table
-epository
.*e)e+er a user l!5s !) t! t*e system- a sree) is 'is&laye'. 9r!m t*is sree)- t*e user a) start
a) ABAP &r!5ram +ia a me)u &at* !r by e)teri)5 a tra)sati!) !'e.
>C? SAP AG BC400 8
2.10
SAP AG 2001
Ti%e
Progra%
Start


Syste% 2oads Progra% Conte't
8ata 7b6ects
ABAP
Processing
Block
ABAP -unti%e Syste%
ABAP Progra%
Selection Screen
-epository
8atabase
Table
0*e system $irst l!a's t*e &r!5ram !)te6t !)t! t*e a&&liati!) ser+er. 0*e &r!5ram !)te6t
!)tai)s mem!ry areas $!r +ariables a)' !m&le6 'ata !bGets- i)$!rmati!) !) t*e sree)s $!r
user 'ial!5s- a)' ABAP &r!essi)5 bl!(s. 0*e ru)time system 5ets t*e &r!5ram i)$!rmati!)
$r!m t*e Re&!sit!ry- %*i* is a s&eial &art !$ t*e 'atabase.
0*e sam&le &r!5ram *as a seleti!) sree) as t*e user 'ial!5- a +ariable a)' a struture as 'ata
!bGets- a)' !)e ABAP &r!essi)5 bl!(. 0*e list t*at is use' t! 'is&lay t*e 'ata is reate'
'y)amially at ru) time.
0*e ABAP ru)time system !)tr!ls t*e subseBue)t &r!5ram $l!%.
>C? SAP AG BC400 #0
2.11
SAP AG 2001
Ti%e
Progra%
Start


-unti%e Syste% Sends Selection Screen
8ata 7b6ects
ABAP
Processing
Block
ABAP -unti%e Syste%
ABAP Progra%
8atabase
Table
-epository
Beause t*e &r!5ram !)tai)s a seleti!) sree)- t*e ABAP ru)time system se)'s it t! t*e
&rese)tati!) ser+er. 0*e &rese)tati!) ser+er !)tr!ls t*e &r!5ram $l!% $!r as l!)5 as t*e user e)ters
'ata i) t*e i)&ut $iel's.
Seleti!) sree)s all!% users t! e)ter seleti!) riteria reBuire' by t*e &r!5ram.
>C? SAP AG BC400 ##
2.12
SAP AG 2001
Ti%e
Progra%
Start


4nput ?alues Are 4nserted into 8ata 7b6ects
8ata 7b6ects
ABAP
Processing
Block
ABAP -unti%e Syste%
ABAP Progra%
8atabase
Table
-epository
As s!!) as t*e user *as $i)is*e' e)teri)5 'ata !) t*e seleti!) sree)- *e !r s*e a) tri55er $urt*er
&r!essi)5 !$ t*e &r!5ram by seleti)5 16eute.
0*e e)tere' 'ata is aut!matially &lae' i) its !rres&!)'i)5 'ata !bGets i) t*e &r!5ram a)' t*e
ABAP ru)time system resumes !)tr!l !$ &r!essi)5.
/) !ur sim&le &r!5ram e6am&le- t*ere is !)ly !)e ABAP &r!essi)5 bl!(. 0*e ABAP ru)time
system tri55ers seBue)tial &r!essi)5 !$ t*is ABAP &r!essi)5 bl!(.
/$ t*e e)tries ma'e by t*e user '! )!t *a+e t*e !rret ty&e- a) err!r messa5e is tri55ere'
aut!matially. 0*e user must !rret t*e e)tries.
>C? SAP AG BC400 #"
2.13
SAP AG 2001
Ti%e
Progra%
Start


Progra% -e5uests 8ata -ecord $ro% 8atabase
8atabase
Table
ABAP
Processing
Block
ABAP -unti%e Syste%
ABAP Progra%
8ata 7b6ects
-epository
.it*i) t*e ABAP &r!essi)5 bl!(- a rea' aess t! t*e 'atabase is &r!5ramme'. 0*e &r!5ram
&asses t! t*e 'atabase i)$!rmati!) ab!ut %*i* 'atabase table t! aess a)' %*i* li)e i) t*e
table t! rea'.
>C? SAP AG BC400 #3
2.14
SAP AG 2001
Ti%e
Progra%
Start


8atabase -eturns 8ata -ecord to Progra%
8atabase
Table
8ata 7b6ects
ABAP
Processing
Block
ABAP -unti%e Syste%
ABAP Progra%
-epository
0*e 'atabase retur)s t*e reBueste' 'ata re!r' t! t*e &r!5ram a)' t*e ru)time system e)sures t*at
t*is 'ata is st!re' i) t*e a&&r!&riate 'ata !bGets.
/$ a si)5le re!r' is aesse'- t*is 'ata !bGet is usually a struture t*at !)tai)s !m&!)e)ts $!r all
t*e reBuire' 'atabase $iel's.
>C? SAP AG BC400 #4
2.15
SAP AG 2001
Ti%e
Progra%
Start


-unti%e Syste% Sends 2ist
8atabase
Table
8ata 7b6ects
ABAP
Processing
Block
ABAP -unti%e Syste%
ABAP Progra%
-epository
0*e lay!ut !$ t*e subseBue)t list 'is&lay %as als! &r!5ramme' i)t! t*e &r!essi)5 bl!(. A$ter
!m&leti!)- t*e ru)time &r!5ram se)'s t*is list as a sree) t! t*e &rese)tati!) ser+er.
>C? SAP AG BC400 #5
2.16
SAP AG 2001
Course Content
Syste% Architecture and ABAP Progra%
Syste% Architecture and ABAP Progra%
Sa%ple Progra% &ith Selection Screen and 2ist
Sa%ple Progra% &ith Selection Screen and 2ist
>C? SAP AG BC400 #6
2.17
SAP AG 2001
3n"! 1 4ntroduction
3n"! 2 Progra% Flo& in an ABAP Progra%
3n"! 3 4ntroduction to the ABAP Workbench
3n"! 4 4ntroduction to the ABAP 8ictionary
3n"! % Basic ABAP 2anguage 9le%ents
3n"! 6 8ata -etrie"al
3n"! < 4nternal Progra% (odulari;ation &ith Subroutines
3n"! = The ABAP -unti%e Syste%
3n"! 9 <ser 8ialog 2ist
3n"! 10 <ser 8ialog Selection Screen
Assign%ent 7"er"ie& 4
Which Co%ponents o$ an ABAP Progra% Are 8iscussed
and in Which Chapter@
>C? SAP AG BC400 #A
2.18
SAP AG 2001
3n"! 11 <ser 8ialog Screen
3n"! 12 <ser 4nter$ace
3n"! 13 Perspecti"e: 8e"elop%ent o$ 4nternet Applications
3n"! 14 Cross=Progra% (odulari;ation
3n"! 1% So$t&are 2ogistics and So$t&are Ad6ust%ent
Appendi'
Assign%ent 7"er"ie& 44
>C? SAP AG BC400 #8
2.19
SAP AG 2001
8escribe in basic ter%s the architecture o$ the ->3
Syste%
8escribe in basic ter%s the e'ecution o$ a si%ple
dialog progra% using the ABAP runti%e syste%
Aou are no& able to:
Progra% Flo& o$ an ABAP Progra%: <nit Su%%ary
>C? SAP AG BC400 #8
3
SAP AG 2001
4ntroduction to the ->3 -epository
Working &ith the 7b6ect #a"igator
7rgani;ing 8e"elop%ents
8e"eloping an ABAP Progra%
Contents:
4ntroduction to the ABAP Workbench
>C? SAP AG BC400 #
3.2
SAP AG 2001
8escribe the structure o$ the ->3 -epository and
its search tools
<se the 7b6ect #a"igator $or your de"elop%ent
&ork
#a%e and use the utilities $or orderly so$t&are
de"elop%ent
Create de"elop%ent classes0 ABAP progra%s0
and transaction codes
At the conclusion o$ this unit0 you &ill be able to:
4ntroduction to the ABAP Workbench:
<nit 7b6ecti"es
>C? SAP AG BC400 "
3.3
SAP AG 2001
4ntroduction to the ->3 -epository
4ntroduction to the ->3 -epository
4ntroduction to the ->3 -epository
Working &ith the 7b6ect #a"igator
Working &ith the 7b6ect #a"igator
7rgani;ing 8e"elop%ents
7rgani;ing 8e"elop%ents
8e"eloping ABAP Progra%s
8e"eloping ABAP Progra%s
>C? SAP AG BC400 3
3.4
SAP AG 2001
The ->3 -epository
Presentation
Ser"er
2ayer
Application
Ser"er
2ayer
8atabase


ABAP Progra%
-epository
Custo%i;ing tables
Application tables
Cross=client Client=speci$ic
0*e 'atabase !)tai)s a&&liati!) a)' Cust!miCi)5 tables t*at are usually clent-specfc.
0*e 'atabase als! !)tai)s t*e R/3 Re&!sit!ry. 0*e ABAP Diti!)ary is &art !$ t*e R/3 Re&!sit!ry.
0*e %&' %epostory !)tai)s all t*e 'e+el!&me)t !bGets- $!r e6am&le- &r!5rams- 'e$i)iti!)s !$
'atabase tables- !r e)tral 'ata ty&e 'e$i)iti!)s. De+el!&me)t !bGets are t*ere$!re als! ()!%) as
Re&!sit!ry !bGets.
Re&!sit!ry !bGets 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
3.5
SAP AG 2001
Structure o$ the ->3 -epository
( (
((
8e"elop%ent Classes
-epository 7b6ects
Function (odules
Progra%s
Tables
! ! !
F4
:-
((
S8
((
W(
Cust!
0*e R/3 Re&!sit!ry is sub'i+i'e' a!r'i)5 t! a&&liati!) !m&!)e)ts.
1a* a&&liati!) !m&!)e)t is $urt*er 'i+i'e' i)t! l!5ial sub'i+isi!)s alle' de$elopment classes.
Re&!sit!ry !bGets are !$te) ma'e u& !$ sub:!bGets t*at are t*emsel+es Re&!sit!ry !bGets.
.*e) y!u reate a Re&!sit!ry !bGet- y!u must assi5) it t! a 'e+el!&me)t lass.
>C? SAP AG BC400 5
3.6
SAP AG 2001
SAP
SAP Application :ierarchy
Cross=Application Co%ponents
Accounting = eneral
Financial Accounting
!!!
FBAS Financial Accounting Basis
!!!
F4=2 eneral 2edger Acctg
F4=2C Consolidation
!!!
Treasury
Controlling
B
B
Application co%ponent
8e"elop%ent class
Selected subtree
4n$or%ation Syste%
B
B
B
B
B
B
CA
AC
F4
T-
C7
!!!
0*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)5
Tools ABAP Workbench Overview Application Hierarchy.
0*e a&&liati!) !m&!)e)ts are 'is&laye' i) a tree struture i) t*e a&&liati!) *ierar*y. 16&a)'i)5
a !m&!)e)t 'is&lays all t*e 'e+el!&me)t lasses t*at are assi5)e' t! t*at !m&!)e)t.
@!u a) selet a subtree !r bra)* a)' )a+i5ate $r!m t*e a&&liati!) *ierar*y t! t*e R/3 Re&!sit!ry
/)$!rmati!) System. 0*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
3.7
SAP AG 2001
->3 -epository 4n$or%ation Syste%
-epository 4n$or%ation Syste%
Business engineering
ABAP 8ictionary
Basic ob6ects
8atabase tables
?ie&s
8ata ele%ents
Structures
Table types
!!!
7ther ob6ects
Fields
Progra%%ing
Function Builder
Progra% 2ibrary
Prog! en"iron%ent
Progra% sub=ob6ects
ABAP ob6ects
Class library
Co%ponents o$ classes
Co%ponents o$ inter$aces
9n"iron%ent
@!u a) use t*e Re&!sit!ry /)$!rmati!) System t! sear* $!r s&ei$i Re&!sit!ry !bGets. Suitable
sear* riteria are a+ailable $!r t*e +ari!us Re&!sit!ry !bGets.
.*i* !bGets are t! be $!u)' usi)5 t*e Re&!sit!ry /)$!rmati!) System 'e&e)'s !) *!% y!u 5et
t*ereE
9r!m %it*i) t*e a&&liati!) *iera*y- selet t*e Information system >'!uble:li( t*e selete'
a&&liati!) !m&!)e)t !r 'e+el!&me)t lass?. 0*is $ilters t*e t*e res&eti+e Re&!sit!ry !bGets.
9r!m t*e SAP 1asy Aess me)u- *!!se Tools ABAP Workbench Overview Information
system. 0*e system lists all t*e Re&!sit!ry ObGets a+ailable $!r sear*i)5.
>C? SAP AG BC400 A
3.8
SAP AG 2001
Working With the 7b6ect #a"igator
4ntroduction to the ->3 -epository
4ntroduction to the ->3 -epository
Working &ith the 7b6ect #a"igator
Working &ith the 7b6ect #a"igator
7rgani;ing 8e"elop%ents
7rgani;ing 8e"elop%ents
8e"eloping ABAP Progra%s
8e"eloping ABAP Progra%s
>C? SAP AG BC400 8
3.9
SAP AG 2001
Function Builder Function Builder
Screen Painter Screen Painter
ABAP ABAP 8ictionary 8ictionary ABAP 9ditor ABAP 9ditor
7b6ect
#a"igator
(enu Painter (enu Painter
ABAP Workbench Tools
8ebugger 8ebugger
Class Builder Class Builder
F4 :-
((
S8
((
W(
Cust!
0*e ABAP Workbench !)tai)s 'i$$ere)t t!!ls $!r e'iti)5 Re&!sit!ry !bGets. 0*ese t!!ls a) be
use' t*r!u5*!ut t*e e)tire s!$t%are 'e+el!&me)t yle. 0*e m!st im&!rta)t t!!ls $!r reati)5 a)'
e'iti)5 Re&!sit!ry !bGets are as $!ll!%sE
0*e ABAP (dtor $!r e'iti)5 s!ure te6t
0*e ABAP Diti!)ary $!r &r!essi)5 'atabase table 'e$i)iti!)s- e)tral 'ata ty&es- a)' m!re
0*e Sree) Pai)ter $!r !)$i5uri)5 sree)s >sree)s %it* $u)ti!)s $!r user 'ial!5s?
)enu Panter $!r 'esi5)i)5 t*e user i)ter$ae >me)u bar- sta)'ar' t!!lbar- a&&liati!) t!!lbar?
>see Interfaces)
0*e *uncton Bulder $!r &r!essi)5 $u)ti!) m!'ules
0*e Class Buil'er $!r &r!essi)5 e)tral lasses
@!u a) start t*ese t!!ls i) t*ree %aysE
Diretly $r!m t*e 1asy Aess me)u.
;si)5 t*e +b,ect -a$gator. 0*is *as a tree 'ia5ram !$ all !bGets %it*i) a 'e+el!&me)t lass !r
&r!5ram. D!uble:li( !) a) !bGet t! start t*e res&eti+e t!!l.
By '!uble:li(i)5 $r!m !)e t!!l t! t*e )e6t- a)' ba( a5ai).
>C? SAP AG BC400 8
3.10
SAP AG 2001
Screen Structure in the 7b6ect #a"igator
Si;e o$ display area can be changed
-ight=click
Conte't %enu
Full screen
on>o$$
Conte't %enu
-ight=click
#a"igation area
Tool area
0*e ObGet Na+i5at!r sree) is 'i+i'e' i)t! t%! areasE
A )a+i5ati!) area $!r 'is&layi)5 a) !bGet list as a *ierar*y tree
A t!!l area $!r 'is&layi)5 a)' e'iti)5 a 'e+el!&me)t !bGet usi)5 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 !)te6t me)u i) b!t* sree) areas. @!u are 5i+e) a *!ie !$ !)ly
t*!se $u)ti!)s t*at are &r!+i'e' $!r 'is&layi)5 !r e'iti)5 t*e !bGet t! %*i* y!u are &!i)ti)5.
Ri5*t:li( !) t*e !bGet t! !&e) t*e !)te6t me)u.
>C? SAP AG BC400 #0
3.11
SAP AG 2001
Working &ith the #a"igation Area
8ictionary ob6ects
Progra%s
SAPBC400WB8C9TT4#CSTA
SAPBC400WBTC9TT4#CSTA
Function groups
BC400
Classes
C2CBC400
BC400
Development Class
C!""
<se o$ na"igation
history
Appl#$at#on H#e%a%$&'
Development Class
P%o(%am
F)n$t#on G%o)p
Class * Inte%+a$e
Inte%net Se%v#$e
Lo$al O,-e$ts
Fa"orites
-e$resh ob6ect list
8isplay higher=le"el
ob6ect list
8ouble=click on a
-epository ob6ect &ith
subob6ects: 2ist o$
subob6ects
8ouble=click on a
-epository ob6ect &ith
subob6ects: 2ist o$
subob6ects
8ouble=click on a
-epository ob6ect &ith
subob6ects: 2ist o$
subob6ects
0*e Re&!sit!ry !bGets are !r5a)iCe' i) a *ierar*yE
A) a&&liati!) !m&!)e)t a) *a+e 'i$$ere)t 'e+el!&me)t lasses.
A 'e+el!&me)t lass a) !)tai) 'i$$ere)t Re&!sit!ry !bGetsE &r!5rams- $u)ti!) 5r!u&s- ABAP
Diti!)ary !bGets- a)' s! !).
1a* Re&!sit!ry !bGet a) *a+e 'i$$ere)t sub!bGets assi5)e' t! itE
Sub!bGets bel!)5i)5 t! a &r!5ramE 5l!bal 'ata- ty&es- e+e)ts- sub&r!5rams- a)' s! !)
Sub!bGets bel!)5i)5 t! a $u)ti!) 5r!u&E 5l!bal 'ata- $u)ti!) m!'ules- a)' s! !)
@!u a) e)ter t*e ty&e !$ !bGet list a)' t*e !bGet )ame i) t*e u&&er &art !$ t*e )a+i5ati!) area. 0*e
!bGet list is t*e) 'is&laye' i) t*e )a+i5ati!) area.
0! 'is&lay t*e sub!bGets- '!uble:li( a) !bGet %it*i) t*e !bGet list.
/$ a) !bGet is )!t i) a) !bGet list- y!u a) 'is&lay it by usi)5 t*e res&eti+e t!!l i) t*e t!!l area.
@!u a) )a+i5ate bet%ee) !bGet lists eit*er by eit*er hstory !r herarchy.
@!u a) a'' !bGet lists t*at y!u e'it $reBue)tly t! y!ur $a+!rites.
>C? SAP AG BC400 ##
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&
<se o$ na"igation
history
<se o$ na"igation
history
/) t*e t!!l area- y!u a) 'is&lay a %i)'!% s*!%i)5 y!ur )a+i5ati!) *ist!ry- t*at is- a list !$ t*e
!bGets y!u *a+e 'is&laye' si)e y!u starte' t*e ObGet Na+i5at!r i) t*e tool area.
0*e !bGet urre)tly 'is&laye' i) t*e t!!l area is *i5*li5*te' i) a 'i$$ere)t !l!r.
>C? SAP AG BC400 #"
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 or
choose conte't %enu:
8isplay>change in tool
area
Na+i5ati!) i) t*e )a+i5ati!) area is l!5ially ndependent from )a+i5ati!) i) t*e t!!l area. 0*is
all!%s $!r sree)s t! be use' i) a $le6ible ma))er.
/$ y!u %is*- y!u a) sy)*r!)iCe t*e t%! areasE
@!u a) dsplay an ob,ect i) t*e t!!l area by '!uble:li(i)5 it- !r by seleti)5 t*e !)te6t me)u
$r!m %it*i) t*e )a+i5ati!) area. 0*e system aut!matially selets t*e a&&r!&riate t!!l $!r
&r!essi)5 t*e !bGet y!u selete'.
0! dsplay the ob,ect lst t*at bel!)5s t! a) !bGet y!u are urre)tly &r!essi)5 i) t*e t!!l area-
*!!se Display obect list.
0! create ob,ects $r!m a) !bGet list- y!u a) use t*e !)te6t me)u $!r t*at !bGet ty&e. /$ t*ere is )!
e)try i) t*e !bGet list $!r t*e reBuire' !bGet ty&e- y!u a) reate a)y )umber !$ !bGets usi)5 E!it
obect !r Other obect.
>C? SAP AG BC400 #3
3.14
SAP AG 2001
7rgani;ing 8e"elop%ents
4ntroduction to the ->3 -epository
4ntroduction to the ->3 -epository
Working &ith the 7b6ect #a"igator
Working &ith the 7b6ect #a"igator
7rgani;ing 8e"elop%ents
7rgani;ing 8e"elop%ents
8e"eloping ABAP Progra%s
8e"eloping ABAP Progra%s
>C? SAP AG BC400 #4
3.15
SAP AG 2001
8e"elop%ent Syste% Production Syste%
Transporting -epository 7b6ects
F4 :-
((
S8
((
W(
Cust!
Change
-e5uest -e5uest
F4 :-
((
S8
((
W(
Cust!
De+el!&me)t &r!Gets are al%ays im&leme)te' i) a 'e+el!&me)t system a)' t*e) tra)s&!rte' t! t*e
)e6t system.
Re&!sit!ry !bGets are aut!matially assi5)e' t! a tra)s&!rt r!ute base' !) t*eir bel!)5i)5 t! a
&artiular 'e+el!&me)t lass a)' !) t*eir atual $u)ti!).
A 'eisi+e riteri!) $!r !mbi)i)5 t*e 'e+el!&me)t &r!Gets is- t*ere$!re- %*i* Re&!sit!ry !bGets
)ee' t! be tra)s&!rte' t!5et*er beause !$ t*eir 'e&e)'e)ies.
@!u s*e'ule t*e group transport !$ t*e Re&!sit!ry !bGets usi)5 a change re.uest.
>C? SAP AG BC400 #5
3.16
SAP AG 2001
Scheduling a 8e"elop%ent Pro6ect
Schedule: (onday
-e5uest is released
Tea%:
Pro6ect (anager:
F-A
F-A
BC400=00
BC400=0+
BC400=02
BC400=03
!!!
Friday !!!
2ocking 7b6ects $or #on 2ocking 7b6ects $or #on=Pro6ect =Pro6ect (e%bers (e%bers
S*e'uli)5 a 'e+el!&me)t &r!Get usi)5 a *a)5e reBuest !+ers t*e $!ll!%i)5 as&etsE
All em&l!yees i) t*e &r!Get 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.
0*e res&eti+e Re&!sit!ry !bGets a) be &r!esse' by all em&l!yees i)+!l+e' i) t*e &r!Get. 9!r
t*!se 'e+el!&ers %*! '! )!t bel!)5 t! t*e team- t*e Re&!sit!ry !bGets remai) l!(e' u)til t*e
&r!Get is !m&lete'.
0*e 5r!u& tri55ers t*e tra)s&!rt !$ all t*e res&eti+e Re&!sit!ry !bGets.
>C? SAP AG BC400 #6
3.17
SAP AG 2001
Workbench 7rgani;er: Change -e5uests
Pro6ect -epresentation in the
Workbench 7rgani;er
Tea%:
Pro6ect (anager:
F-A
F-A
BC400=00
BC400=0+
BC400=02
BC400=03
!!!
#han(e re.ues!s "n)ol)"n( user B#400900
#han(eable
,rans$or!able
0,3>9000%1 #ARS8?
0,3>9000%2 #ARS8?
0,3>9000%3 B#400900
Re$or! source
@B#400A00AF/0GB,/0S,
ABAP $ro(ra*
0,3>9000%4 B#400901
0,3>9000%% B#400902
0,3>9000%6 B#400903
0,3>9000%< ...
-e5uest nu%ber
Pro6ect
(anager
Task nu%ber
-epository ob6ects
created or corrected
by e%ployee
<ser
At t*e be5i))i)5 !$ a 'e+el!&me)t &r!Get- t*e pro,ect manager reates a *a)5e reBuest i) t*e
Workbench +rgan/er. 0*e &r!Get ma)a5er assi5)s all &r!Get team members t! t*e *a)5e
reBuest. 0*e .!r(be)* Or5a)iCer t*e) reates a task $!r ea* &r!Get 'e+el!&er.
9r!m )!% !)- %*e)e+er a) em&l!yee assi5)s a Re&!sit!ry !bGet t! t*is *a)5e reBuest- t*e
Re&!sit!ry !bGet is aut!matially e)tere' i) t*e em&l!yeeIs tas(. 0*us all Re&!sit!ry !bGets t*at a)
em&l!yee %!r(s !) 'uri)5 a 'e+el!&me)t &r!Get are !llete' %it*i) *is !r *er tas( $!l'er. 0*e
Re&!sit!ry !bGets are t*ere$!re l!(e' $!r all 'e+el!&ers %*! '! )!t bel!)5 t! t*is &artiular
&r!Get.
;)li(e t*e l!5ial $u)ti!)al 'i+isi!)s t*at se&arate Re&!sit!ry !bGets t*r!u5* t*e res&eti+e
'e+el!&me)t lass- *a)5e reBuests are &r!Get:relate' a)'- t*ere$!re- are limite' t! t*e tme
schedule i)+!l+e'. 0*us- alt*!u5* a &r!5ram al%ays bel!)5s t! !)ly !)e 'e+el!&me)t lass- it a)
bel!)5 t! 'i$$ere)t *a)5e reBuests at 'i$$ere)t times.
>C? SAP AG BC400 #A
3.18
SAP AG 2001
9'a%ple: Creating 8e"elop%ent Classes
#rea!e De)elo$*en! #lass
8e"elop%ent Class
Short Te't
Transport 2ayer
Person -esponsible
So$t&are Co%ponent
Application Co%ponent
DBC400C00
9'ercises group 00

D89?
BC400=00
:7(9
CA
Where should the de"elop%ent ob6ects be transported to@
To &hich application
co%ponent does the
de"elop%ent class belong@
Co%ply &ith custo%er na%espace
@!u a) reate a 'e+el!&me)t lass i) t*e ObGet Na+i5at!r.
As !$ Release 4.6C- y!u a) *!!se t*e !bGet ty&e Development "lass a)' e)ter t*e )ame !$ t*e
'e+el!&me)t lass i) t*e i)&ut $iel'. Ma(e sure y!u !m&ly %it* t*e ust!mer )ames&ae
!)+e)ti!)s. /$ t*e 'e+el!&me)t lass '!es )!t alrea'y e6ist- t*e system 'is&lays t*e "reate
Development "lass 'ial!5 b!6.
9!r Release 4.6A a)' 4.6B- y!u must *!!se E!it obect !r Other obect i) t*e i)itial sree). 1)ter
t*e )ame !$ t*e 'e+el!&me)t lass i) t*e i)&ut $iel' !) Other tab &a5e.
@!u s*!ul' *e( t*e setti)5s $!r t*e $!ll!%i)5 attributesE
Transport layer - /$ y!u arry !ut y!ur !%) 'e+el!&me)ts- y!u must set u& a tra)s&!rt layer $!r
ust!mer 'e+el!&me)ts.
Person responsble : 0*is &ers!) *as $ull res&!)sibility $!r t*e !bGets i) t*is 'e+el!&me)t lass.
0*e system aut!matially uses t*is user )ame as a 'e$ault +alue.
0oft#are component - 9!r ust!mer 'e+el!&me)ts y!u s*!ul' e)ter HOME as t*e s!$t%are
!m&!)e)t. 0! 5et 'etaile' i)$!rmati!) !) t*e $iel'- selet 9# *el&.
Applcaton component - ;se' t! s&ei$y t*e l!ati!) !$ t*e 'e+el!&me)t lass %it*i) t*e
a&&liati!) *ierar*y.
>C? SAP AG BC400 #8
3.19
SAP AG 2001
Assign%ent to a Change -e5uest
8e"elop%ent class>p!!
Pro%pt $or transportable Workbench re5uest
DBC400C00
'& re.ues!s
Pro%pt $or transportable Workbench re5uest
#han(e re.ues!s "n)ol)"n( user B#400900
#han(eable
,rans$or!able
0,3>9000%1 FRC
0,3>9000%2 FRC
0,3>9000%3 B#400900
0,3>9000%4 B#400901
8ouble=click
re5uest nu%ber
-e5uest 4T3E/00)+
9'ercises $or participants o$ BC400
Workbench re5uest
All Re&!sit!ry !bGets t*at are reate' !r *a)5e' must be assi5)e' t! t*e *a)5e reBuest !$ t*e
res&eti+e &r!Get. 9!r t*is !urse- t*e trai)er *as reate' a *a)5e reBuest $!r t*e &r!Get alle'
D16erises $!r Partii&a)ts !$ BC400D. 1a* 5r!u& *as a tas( %it*i) t*is *a)5e reBuest.
0! 'is&lay all *a)5e reBuests i) %*i* y!u *a+e a tas(- selet Own re#$ests.
.*e) y!u assi5) all Re&!sit!ry !bGets >'e+el!&me)t lasses- &r!5rams- a)' s! !)? t! t*is *a)5e
reBuest- t*e system ta(es are !$ t*e e6at assi5)me)t $!r y!ur tas(.
>C? SAP AG BC400 #8
3.20
SAP AG 2001
8e"eloping ABAP Progra%s
4ntroduction to the ->3 -epository
4ntroduction to the ->3 -epository
Working &ith the 7b6ect #a"igator
Working &ith the 7b6ect #a"igator
7rgani;ing 8e"elop%ents
7rgani;ing 8e"elop%ents
8e"eloping ABAP Progra%s
8e"eloping ABAP Progra%s
>C? SAP AG BC400 "0
3.21
SAP AG 2001
Features o$ the ABAP Progra%%ing 2anguage
There$ore0 it is designed $or dialog=based0 business applications!
The ABAP progra%%ing language !!!
:as de$ined types
9nables %ulti=language applications
:as SF2 e%bedded &ithin it
:as been enhanced as an ob6ect=oriented language
4s plat$or%=independent
4s do&n&ards co%patible
0! su&&!rt 'ata &r!essi)5 by ty&es- ABAP !)tai)s a systemati ty&e *ierar*y. 0y&e !)+ersi!)s
a)' ty&e asti)5 are su&&!rte'.
;si)5 tra)slatable te6t eleme)ts- y!u a) 'e+el!& multi:la)5ua5e a&&liati!)s.
0*e OP1N S43 sta)'ar' embe''e' i) ABAP all!%s 'iret 'atabase aesses.
ABAP ObGets is t*e !bGet:!rie)te' e)*a)eme)t !$ t*e ABAP &r!5rammi)5 la)5ua5e.
0*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)ta6 stateme)t is re&lae' by a better
!)e- y!u a) still ru) t*e !l' stateme)t.
>C? SAP AG BC400 "#
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' 4
Additions and operands
,dependent on key&ords.
ABAP ABAP
key&ord key&ord
START1OF1SELECTION0 START1OF1SELECTION0
SELECT SELECT
ENDSELECT0 ENDSELECT0
3RITE 3RITE
0 0
0 0
0 0
Period as sy%bol $or closing Period as sy%bol $or closing
the the ABAP ABAP state%ent state%ent
DATA DATA 0 0
NE31LINE0 NE31LINE0
3RITE 3RITE
3RITE 3RITE 0 0
ABAP &r!5rams !)sist u& !$ i)'i+i'ual stateme)ts.
1a* stateme)t e)'s %it* a &eri!'.
0*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)5le li)e a) !)tai) multi&le stateme)ts.
0*e ABAP ru)time system is )!t ase se)siti+eH t*at is- it '!es not 'isti)5uis* bet%ee) l!%erase
a)' u&&erase letters $!r (ey%!r's- a''iti!)s- a)' !&era)'s. 0! 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)5 u&&erase a)' l!%erase letters- use t*e Pretty Pai)ter $u)ti!).
C*!!se %tilities &ettin's ABAP E!itor Pretty Printer
>C? SAP AG BC400 ""
3.23
SAP AG 2001
2 $omments 000
2 $omments 000
2 $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
: :
6 6
6 6
0 0
eneral ABAP Synta' 44
Chained Chained
State%ent State%ent
2 2
2 2
2 2
5 5
Co%%ents Co%%ents
;se a) asteris( >J? t! i)tr!'ue comment lnes. 0*e ABAP ru)time system i5)!res t*e !mme)t
li)e.
0$ y!u %a)t t! e)ter a !mme)t i) t*e mi''le !$ a starte' li)e- e)ter '!uble Bu!tes.@!u a) !mbi)e
!)seuti+e stateme)ts #th an dentcal begnnng i)t! a si)5le chaned statementE
Cl!se t*e i'e)tial be5i))i)5 &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?.
0*e ABAP ru)time system !)si'ers t*e i)'i+i'ual &arts !$ a *ai)e' stateme)t t! be si)5le
stateme)ts.
>C? SAP AG BC400 "3
3.24
SAP AG 2001
-eturn ?alue A$ter ABAP State%ents
PARAMETERS pa/$a%% TYPE s$a%%1$a%%#40
DATA .a/s$a%% TYPE s$a%%0
START1OF1SELECTION0

SELECT SINGLE 2 FROM s$a%%
INTO CORRESPONDING FIELDS OF .a/s$a%%
3HERE $a%%#4 7 pa/$a%%0
IF s'1s),%$ E8 "0
NE31LINE0
3RITE: .a/s$a%%1$a%%#46
.a/s$a%%1$a%%name6
.a/s$a%%1)%l0
ELSE0
3RITE 9So%%'6 no 4ata +o)n4:90
ENDIF0
s' s'1 1s),%$ s),%$
.it* se+eral ABAP stateme)ts- t*e ABAP ru)time system %rites a retur) !'e i)t! t*e system $iel'
sy-subrc t! i)'iate *!% suess$ully t*e stateme)t %as e6eute'
0*e retur) !'e Cer! >0? mea)s t*at t*e stateme)t %as suess$ul..
Rea' t*e '!ume)tati!) $!r t*e res&eti+e stateme)ts t! $i)' !ut %*et*er a)' *!% t*is retur) !'e is
set i) i)'i+i'ual ases.
>C? SAP AG BC400 "4
3.25
SAP AG 2001
With T7P 4nclude
Create Progra%
Progra%
DBC400C00CS
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!5ram usi)5 !)e !$ t*e $!ll!%i)5 !&ti!)sE
/) t*e )a+i5ati!) area- *!!se Pro'ram as t*e !bGet ty&e a)' e)ter a &r!5ram )ame. Be sure t!
!m&ly %it* t*e ust!mer )ames&ae !)+e)ti!)s. /$ t*e &r!5ram '!es )!t e6ist- t*e system
'is&lays t*e 'ial!5 seBue)e t*at lets y!u reate a &r!5ram. >0*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!5ram. Start t*e 'ial!5 seBue)e
$!r reati)5 a &r!5ram usi)5 t*e 'e+el!&me)t lass !)te6t me)u !r t*e Pro'ram )!'e.
Selet Other obect))) !r E!it obect. Selet t*e Pro'ram obects tab a)' e)ter t*e )ame. Selet
"reate)
/) t*is !urse- 'eselet With Top Incl$!e >by rem!+i)5 t*e *e( mar( $r!m t*e *e(b!6?. >/$ y!u
'!)Ft '! t*is- y!ur s!ure te6t %!ul' be 'istribute' t! se+eral &r!5rams.?
C*a)5e t*e title t! a mea)i)5$ul s*!rt te6t.
C*!!se Test pro'ram as t*e &r!5ram status $!r all ABAP !urses.
>C? SAP AG BC400 "5
3.26
SAP AG 2001
Eey&ord 8ocu%entation in the ABAP 9ditor
START1OF1SELECTION0
SELECT SINGLE 2 FROM s$a%%
INTO .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 <""0
MO;E1CORRESPONDING s,$!""/$a%%#e%
TO .a/s$a%%0
3RITE: .a/s$a%%1$a%%#46
.a/s$a%%1$a%%name6
.a/s$a%%1$)%%$o4e0
ENDIF0
3RITE 3RITE
9ditor :elp
ABAP 7"er"ie&
ABAP Ter%
ABAP #e&s
ABAP 8ocu and 9'a%ples
Bel$
i
3RITE
F+
Eey&ord
8ocu%entation
@!u a) l!ate (ey%!r' '!ume)tati!) $!r a) ABAP stateme)t byE
P!i)ti)5 t! a stateme)t a)' seleti)5 F1 t! 5! 'iretly t! t*e '!ume)tati!) $!r t*e
stateme)t
Seleti)5 Information t! 5! t! a seleti!) %i)'!% $!r t*e +ari!us +ie%s !$ t*e (ey%!r'
'!ume)tati!).
C*!!se *elp &AP +ibrary B" Basis "omponents t! aess e6te)si+e !)li)e
'!ume)tati!) !) all t*e t!!ls a)' t!&is t*at relate t! t*e ABAP .!r(be)*.
>C? SAP AG BC400 "6
3.27
SAP AG 2001
4nacti"e and Acti"e 8e"elop%ent 7b6ects
Progra% +0
inacti"e "ersion
Sa"ed0
$or de"elop%ent
and testing
Acti"ely integrated0
$or syste%=&ide
usage
Progra% 30
inacti"e "ersion
Progra% 20
acti"e "ersion
Progra% 30
acti"e "ersion
Progra% +0
acti"e "ersion
Acti"ate
.*e)e+er y!u reate a 'e+el!&me)t !bGet- !r *a)5e 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 !bGet is a+ailable !) a system:%i'e basis- it must $irst be a+ailable as a) act$e
$erson. 0*is ati+e +ersi!) !$ y!ur &r!5ram %ill be use' %*e)e+er a user %a)ts t! e6eute y!ur
&r!5ram.
/$ y!ur &r!5ram 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!5ram- t*e system $irst 'is&lays a list !$ all i)ati+e !bGets t*at y!u *a+e
&r!esse'. 0*is is alle' t*e #orklst. /$ y!u !)ti)ue t! ati+ate t*e &r!5ram- t*e $!ll!%i)5
*a&&e)sE
0*e system sa+es t*e &r!5ram- t*at is- it st!res !r !+er%rites t*e i)ati+e +ersi!).
0*e system &er$!rms a sy)ta6 *e(.
0*e system st!res t*e ati+e +ersi!) !r !+er%rites it.
>C? SAP AG BC400 "A
3.28
SAP AG 2001
enerating -unti%e 7b6ects
sa"ed0
$or de"elop%ent>testing
acti"ely integrated0
$or syste%=&ide usage
Progra% 30
inacti"e "ersion
Progra% +0
acti"e "ersion
Progra% 20
acti"e "ersion
Progra% 30
acti"e "ersion
For syste%=&ide usage
Progra% Progra% 30 30
generated "ersion generated "ersion
enerate
,auto%atically.
Progra% Progra% 30 30
te%porary te%porary
generated "ersion generated "ersion
enerate
,auto%atically.
.*e) y!u 5e)erate a 'e+el!&me)t !bGet- t*e system reates >!m&iles? a se&arate ru)time !bGet
>3OAD? a)' st!res it i) t*e R/3 Re&!sit!ry.
0*is 5e)erate' +ersi!) is t*e) t*e +ersi!) t*at is e6eute' >i)ter&rete'?.
Ge)erati!) ta(es &lae aut!matially- but it a) be tri55ere' e6&liitly.
/$- $!r e6am&le- a user %a)ts t! e6eute y!ur &r!5ram a)' t*ere is still )! 5e)erate' +ersi!)- t*e
system %ill use t*e ati+e +ersi!) $!r 5e)erati!).
@!u a)- *!%e+er- 'etermi)e %*i* +ersi!) y!u %a)t t! e6euteE
0! e6eute t*e ati+e +ersi!)- start y!ur &r!5ram $r!m t*e )a+i5ati!) area.
0! e6eute t*e i)ati+e +ersi!)- test a) e6eutable &r!5ram $r!m t*e ABAP 1'it!r. 0*e system
tem&!rarily reates a 5e)erate' +ersi!).
/) t*is %ay- 'e+el!&me)t a) !)ti)ue #thout changng the current system status. All *a)5es t!
t*e 'e+el!&me)t !bGet be!me +isible system %i'e !)ly %*e) t*e &r!5ram is ati+ate' a5ai). .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
3.29
SAP AG 2001
Creating Transaction Codes
Syste% Syste% :elp :elp
DBC400C00CS
Create Report Transaction
Transaction code D00S
8e"elop%ent class DBC400C00
Transaction te't
Progra%
!!!
!!!
DBC400C00CS
Classi$ication
Pro$essional <ser Transaction
9asy Web transaction
!!!
!!!
/$ y!u %a)t t! i)lu'e a &r!5ram i) r!le me)us !r i) t*e ,avorites i) y!ur SAP 1asy Aess me)u-
y!u must assi5) a tra)sati!) !'e t! it.
/) t*e ObGet Na+i5at!r- 'is&lay t*e !bGet list $!r y!ur &r!5ram. Ri5*t:li( t*e &r!5ram )ame a)'
*!!se "reate Transaction. C!m&ly %it* t*e ust!mer )ames&ae !)+e)ti!)s.
C*!!se Pro'ram an! &election &creen -.eport Transaction) i$ t*e &r!5ram is a) e6eutable
&r!5ram)
O) t*e )e6t sree)- e)ter t*e )ame !$ t*e &r!5ram. C*!!se Professional %ser Transaction.
Sa+e t*e tra)sati!) !'e.
Si)e ea* tra)sati!) !'e is a Re&!sit!ry !bGet- y!u must assi5) it t! a 'e+el!&me)t lass a)' t! a
*a)5e reBuest !) t*e $!ll!%i)5 sree)s.
>C? SAP AG BC400 "8
3.30
SAP AG 2001
Syste% Syste% :elp :elp
Adding a Transaction Code to the
SAP 9asy Access (enu
Fa"orites
SAP (enu
SAP Easy Access
7b6ect #a"igator
Add transaction
9nter Transaction (anually
Transaction code
D00S
0! 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*!!se ,avorites Insert transaction.
1)ter a tra)sati!) !'e i) t*e 'ial!5 b!6 .
0*e tra)sati!) !'e s*!rt te6t a&&ears u)'er t*e ,avorites )!'e. @!u a) start t*e a&&r!&riate
&r!5ram $r!m t*e !)te6t me)u $!r t*is )e% )!'e.
>C? SAP AG BC400 30
3.31
SAP AG 2001
8escribe the structure o$ the ->3 -epository and
its search tools
<se the 7b6ect #a"igator $or your de"elop%ent
&ork
#a%e and use the utilities $or orderly so$t&are
de"elop%ent
Create de"elop%ent classes0 ABAP progra%s0 and
transaction codes
Aou are no& able to:
4ntroduction to the ABAP Workbench:
<nit Su%%ary
>C? SAP AG BC400 3#
3.32ABAP or!"enc# E$ercises
1nt: 2ntroducton to the ABAP Workbench
Topc: +rgan/ng 3e$elopments
At t*e !)lusi!) !$ t*ese e6erises- y!u %ill be able t!E
Create a 'e+el!&me)t lass
Assi5) *a)5es i) Re&!sit!ry !bGets t! a *a)5e reBuest
As a 'e+el!&er $!r a) airli)e 5r!u&- y!u are 5i+e) t*e tas( !$ 'e+el!&i)5
e+aluati!) &r!5rams $!r se+eral airli)e !m&a)ies.
0! 5r!u& t*e Re&!sit!ry !bGets t!5et*er l!5ially a)' tra)s&!rt t*em-
y!u must reate a 'e+el!&me)t lass.
;ser )ameE .ill be a))!u)e' by t*e i)strut!r.
De+el!&me)t lassE =C!""/>>
C*a)5e reBuestE .ill be a))!u)e' by t*e i)strut!r.
## sta)'s $!r t*e t%!:'i5it 5r!u& )umber.
#:# 3!5 !) t! t*e !&erati)5 system a)' t*e) t! t*e s&ei$ie' SAP R/3 trai)i)5 system
usi)5 t*e user )ame t*e i)strut!r *as 5i+e) y!u. 1)ter a )e% &ers!)al &ass%!r'.
#:" Create t*e 'e+el!&me)t lass =C!""/>>. Assi5) it t! t*e *a)5e reBuest t*e
i)strut!r *as 5i+e) y!u.
#:3 9r!m )!% !)- assi5) all y!ur Re&!sit!ry !bGets i) t*e $!ll!%i)5 e6erises t! t*is
'e+el!&me)t lass a)' t*is *a)5e reBuest.
>C? SAP AG BC400 3"
("ercses
1nt: 2ntroducton to the ABAP Workbench
Topc: 3e$elopng ABAP Programs
At t*e !)lusi!) !$ t*ese e6erises- y!u %ill be able t!E
Create- e'it- sa+e- a)' &r!ess ABAP &r!5rams
C*e( ABAP &r!5rams $!r !rret sy)ta6
0est a)' ati+ate ABAP &r!5rams
Create a) ABAP &r!5ram t*at lists a''iti!)al i)$!rmati!) !) all e6isti)5
$li5*t 'e&arture times.
Get t*e 'ata $r!m t*e 'atabase table SFLIGHT.
Pr!5ramE =C!""/>>/GS/LIST
M!'el s!luti!)E SAPBC400WBS_GS_LIST
## sta)'s $!r t*e t%!:'i5it 5r!u& )umber.
":# Create t*e e6eutable &r!5ram =C!""/>>/GS/LIST
%it*!ut 0OP /)lu'e.
":" De$i)e a %!r( area $!r t*e 'ata retrie+al a)' 'ata 'is&lay >)ame su55esti!)E
.a/+l#(&t?E
DATA .a/+l#(&t TYPE s+l#(&t0
":3 Pr!5ram a l!!& aess t! all t*e 'ata re!r's i) t*e 'atabase table 0*4256TE
SELECT 2 FROM s+l#(&t
INTO .a/+l#(&t0
000
ENDSELECT0
":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!5ram $!r sy)ta6 err!rs- test it- a)' ati+ate it
>C? SAP AG BC400 33
("eercses
1nt: 2ntroducton to the ABAP Workbench
Topc: Transacton Codes
At t*e !)lusi!) !$ t*ese e6erises- y!u %ill be able t!E
Assi5) tra)sati!) !'es t! ABAP &r!5rams
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!5ram a tra)sati!) !'e- i) a''iti!) t! its
te*)ial )ame- %*i* y!u use t! e6eute it.
0ra)sati!) !'eE =C!""/>>/GS
Pr!5ramE =C!""/>>/GS/LIST
M!'el s!luti!)E SAPBC400WBS_GS LIST
## sta)'s $!r t*e t%!:'i5it 5r!u& )umber.
3:# Create tra)sati!) !'e =C!""/>>/GS $!r t*e e6eutable &r!5ram
=C!""/>>/GS/LIST.
Initial obect/ pro'ram an! selection screen -report transaction)
16eute y!ur &r!5ram by e)teri)5 t*e )e% tra)sati!) !'e.
3:" /)lu'e t*e tra)sati!) !'e =C!""/>>/GS i) y!ur $a+!rites i) t*e SAP:1asy:
Aess:me)u.
16eute y!ur &r!5ram by '!uble:li(i)5 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
!bGets i) y!ur 'e+el!&me)t lass. 9r!m *ere- y!u a) e'it ea*
!bGet 'iretly by seleti)5 it $r!m t*is list.
>C? SAP AG BC400 34
3.33ABAP or!"enc# So%&tions
1nt: 2ntroducton to the ABAP Workbench
Topc: +rgan/ng 3e$elopments
# 9!ll!% t*e i)struti!)s as 5i+e) i) t*e )!tes a)' $i5ures !) &a5e 3:#8 a)' 3:#8-
Creati)5 De+el!&me)t Classes a)' Assi5)me)t t! a C*a)5e ReBuest.
1nt: 2ntroducton to the ABAP Workbench
Topc: 3e$elopng ABAP Programs
" )odel soluton:
REPORT sap,$!"".,s/(s/l#st0
DATA .a/+l#(&t TYPE s+l#(&t0
SELECT 2 FROM s+l#(&t
INTO .a/+l#(&t0
NE31LINE0
3RITE:
.a/+l#(&t1$a%%#46
.a/+l#(&t1$onn#46
.a/+l#(&t1+l4ate6
.a/+l#(&t1seatso$$6
.a/+l#(&t1seatsma?0
ENDSELECT0
1nt: 2ntroducton to the ABAP Workbench
Topc: Transacton Codes
3:# 9!ll!% t*e i)struti!)s as 5i+e) i) t*e )!tes a)' $i5ure !) &a5e 3:"8- Creati)5
0ra)sati!) C!'es.
3:" 9!ll!% t*e i)struti!)s as 5i+e) i) t*e )!tes t! t*e $i5ure- A''i)5 a 0ra)sati!)
C!'e t! t*e SAP 1asy Aess Me)u.
>C? SAP AG BC400 35
4
SAP AG 2001
SAP Flight 8ata (odel
Transparent Tables
Structures
<sing Transparent Tables and Structures in an ABAP
Progra%
Contents:
4ntroduction to the ABAP 8ictionary
>C? SAP AG BC400 #
4.2
SAP AG 2001
8escribe the SAP $light data %odel
8escribe the structure o$ a transparent table
8escribe the structure o$ a structure
2ist the possible uses o$ transparent tables and
structures in ABAP progra%s
At the conclusion o$ this unit0 you &ill be able to:
4ntroduction to the ABAP 8ictionary:
<nit 7b6ecti"es
>C? SAP AG BC400 "
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. 0*e e)tities a)' relati!)s*i&s are !)tai)e' i) t*e 'ata m!'el !r
e)tity relati!)s*i& m!'el >1RM?.
0*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.
0*e atual a&&liati!) 'ata is &*ysially st!re' i) t*e 'atabase itsel$.
>C? SAP AG BC400 3
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: price0
a"ailability
Flight 8ata (odel $or ABAP Training Courses
ABAP trai)i)5 !urses- !)li)e '!ume)tati!)- a)' ABAP (ey%!r' '!ume)tati!) all use t*e
same $li5*t 'ata m!'el. All Re&!sit!ry !bGets i) t*e $li5*t 'ata m!'el are l!ate' i) t*e
'e+el!&me)t lass BC_DATAMODEL.
0*is trai)i)5 !urse 'em!)strates !)e sim&le e6er&t $r!m t*is 'ata m!'el- %*i* t*e i)strut!r
a) 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
a5e)y t*e $!ll!%i)5 Buesti!)sE
.*at !))eti!) !$$ers me t*e best a)' m!st 'iret $li5*tK
At %*at times are $li5*ts !$$ere' !) t*e 'ate %*e) / %a)t t! tra+elK
<!% a) / !&timiCe t*e tra+el !)'iti!)s t! $i)' t*e best s!luti!)K .*at is t*e *ea&est
$li5*t- t*e $astest !))eti!)- t*e !))eti!) t*at 5ets me t*ere l!sest t! t*e time %*e) / %a)t
t! arri+eK
0*e &asse)5erFs +ie% 'i$$ers $r!m t*at !$ a tra+el a5e)y. /) t*e 'ata m!'el- %*i* is tail!re' t!
suit ma)a5eme)t !$ t*e )eessary 'ata- all 'ata is st!re'- !r5a)iCe' by te*)ial riteria- i)
tables !) a e)tral 'atabase. 0*e am!u)t !$ 'ata st!re' $ar e6ee's t*e 'ema)'s !$ t*e
&asse)5er.
As a &r!5rammer- y!u must be able t! !m&ile t*e 'ata i) &r!5rams t! suit t*e reBuireme)ts !$
t*e tra+el a5e)t.
>C? SAP AG BC400 4
4.5
SAP AG 2001
-elational 8ata (odel
B#AP/A?F/0 ,
Ti%etable
B#A#ARR04R ,
Airline
Flight
B#AB88>0?G ,
Flight booking
:
:
:
- - B#A#0,A0RP ,
City=airport
assign%ent
Airport
B#AG48#0,C ,
City
A A
B#A#3S,8' ,
Custo%er
B#A#83?,4R ,
Sales o$$ice
B#AA0RP8R, ,
B#A,RAD/AG ,
Tra"el agency
- C- C-
B#ASF/0GB, ,
0*e $li5*t 'ata m!'el !)tai)s e)tities $!r all busi)ess i)$!rmati!) t*at is l!5ially !))ete'- su*
asE
Cities
Air&!rts
Airli)es
9li5*ts
0*ese e)tities all relate t! ea* !t*er i) ertai) %aysE
1a* $li5*t s*e'ule !)tai)s e6atly !)e airli)e- !)e 'e&arture air&!rt- a)' !)e 'esti)ati!)
air&!rt.
B!!(able $li5*ts al%ays bel!)5 t! e6atly !)e e6isti)5 $li5*t s*e'ule ea*.
@!u a) assi5) ities t! )earby air&!rts.
@!u a) ma)a5e all )eessary 'ata %it*!ut re'u)'a)ies- usi)5 t*ese relati!)s*i&s. At t*e same time-
t*e tra+el a5e)y is able t! !btai) all 'ata reBueste' by t*e ust!mer.
>C? SAP AG BC400 5
4.6
SAP AG 2001
Con"erting <sing Transparent Tables
B#AP/A?F/0 ,
Ti%etable
B#A#ARR04R ,
Airline
B#ASF/0GB, ,
Flight
B#AB88>0?G ,
Flight booking
'A?D, #ARR0D #8??0D F/DA,4 B88>0D #3S,8'0D #83?,4R ...
SB77E SB77E
'A?D, #ARR0D #8??0D F/DA,4 S4A,S'AE S4A,S8## ...
SF24:T SF24:T
'A?D, #ARR0D #8??0D A0RPFR8' A0RP,8 D4P,0'4 ...
SPF24 SPF24
'A?D, #ARR0D #ARR?A'4 #3RR#8D4 3R/
SCA-- SCA--
:
:
:
A tra)s&are)t table !)tai)s 'i$$ere)t !lum)s- t! all!% y!u t! ma)a5e '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 !)te6t- t*e table key is es&eially
si5)i$ia)t.
0*e table (ey !$ a table combnes (ey $iel's- %*i* are als! alle' prmary key felds.
0*e +alues i) t*e (ey $iel's all!% t*e system t! i'e)ti$y all 'ata re!r's un.uely.
9iel's t*at li)( t! !t*er tables are alle' foregn key felds. .it* t*ese $!rei5) (ey relati!)s*i&s y!u
a) ma)a5e t*e 'ata *ierar*ially a)' !)siste)tly.
>C? SAP AG BC400 6
4.7
SAP AG 2001
uses
uses
Table including data
Technical Structure o$ a Transparent Table
Transparent table Transparent table
8ata ele%ent
8o%ain
Field
@!u )!rmally use a 'ata eleme)t t! assi5) 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. 0*e 'ata ty&e- am!)5 !t*er t*i)5s- is st!re'
i) t*e '!mai).
0*e ABAP Diti!)ary !)tai)s t*e &lat$!rm:i)'e&e)'e)t 'esri&ti!) !$ t*e rele+a)t 'atabase table.
0*e 'atabase table *as t*e same )ame as t*e tra)s&are)t table i) t*e ABAP Diti!)ary. 0*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 A
4.8
SAP AG 2001
Transparent Tables in the ABAP 8ictionary
Table 9dit oto <tilities 9n"iron%ent Syste% :elp
'ictionary( 'isp%ay Ta"%e
Transparent table SPFLI Active
Indexes
Attributes
9'tras
Short text Flight schedule
Currency/Quantity Fields Fields
Fields Key Field type Data type Length Dec places Short text
!A"DT S#!A"DT Client $or training
CA%%ID S#CA%%#ID Airline Carrier
CL"T & '

C(A% & '


C)""ID S#C)""#ID Flight connection "*!C & +
C)*"T%,F% LA"D#- Country .ey C(A% & '
CIT,F%)! S#F%)!#CIT City o$ departure C(A% & /&
AI%0F%)! S#F%)!AI%0 Airport o$ departure C(A% & '
C)*"T%,T) LA"D#- Country .ey C(A% & '
CIT,T) S#T)#CIT, Arrival city C(A% & /&

0*e felds ma(e u& t*e !lum)s !$ t*e tra)s&are)t table. A *e( mar( i) t*e 0ey !lum)
i)'iates t*at t*e !rres&!)'i)5 $iel' is a (ey $iel'.
@!u )!rmally assi5) a type t! a $iel' usi)5 a 'ata eleme)t >u)'er ,iel! type?. 0*e &hort te1t
st!re' %it* t*e 'ata eleme)t is liste' *ere. 0*e te*)ial attributes !$ t*e $iel' are liste' a5ai)
u)'er Data type- +en'th- a)' Dec) places. >A 'ata eleme)t )!rmally uses a '!mai).?
0*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
4.9
SAP AG 2001
Structures in the ABAP 8ictionary
Structure 9dit oto <tilities 9n"iron%ent Syste% :elp
'ictionary( 'isp%ay Str&ct&re
Structure SBC400FOCC Active
Attributes
9'tras
Short text Percentage Occupancy of Flights
1ntry help/chec. Co2ponents
Co2ponent Co2ponent type DTyp Length Dec places Short text
CA%%ID S#CA%%#ID Airline C(A% & '
C)""ID S#C)""#ID Flight connection "*!C & +
FLDAT1 S#DAT1 Flight date DATS & 3
S1ATS!A4 S#S1ATS!A4 !axi2u2 capacity I"T+ & -&
S1ATS)CC S#S1ATS!A4 )ccupied seats I"T+ & -&
01%C1"TA51 S#FL5(T)CC Flight )ccupancy D1C / 6
Currency/7uantity $ields
A $lat struture is 'e$i)e' i) alm!st t*e same %ay as a tra)s&are)t table- e6e&t t*at y!u a))!t
!)+ert $iel's t! (ey $iel's. 0*is %!ul' be &!i)tless $!r strutures. Strutures '! )!t re&rese)t a
'atabase table i) t*e ABAP Diti!)ary- but are a pure type defnton i)stea'.
.*e) 'e$i)i)5 a $lat struture- *!%e+er- %e re$er t! component a)' component type as !&&!se' t!
$iel' a)' $iel' ty&e- beause- i) !)trast t! tra)s&are)t tables- y!u a) 'e$i)e !m&le6 strutures.
0*is mea)s t*at- it is &!ssible t! st!re a struture !r substruture u)'er a !m&!)e)t )ame.
>C? SAP AG BC400 8
4.10
SAP AG 2001
<sing lobal Structures $or 8ata 7b6ects
DATA .a/+o$$ TYPE s,$!""+o$$0
TALES sp+l#0
PARAMETERS pa/$a%% TYPE sp+l#1$a%%#40
TYPE s,$!""+o$$ TYPE s,$!""+o$$
sp+l# sp+l#
TYPE sp+l#1$a%%#4 TYPE sp+l#1$a%%#4
;aA-occ
carr" sea!s*a2
2 : 4 ) 0
conn"
400
-la!e
200++23+
sea!socc
+ H 0
$ercen!a(e
4 0
s$-l"
carr" c"!&-ro*
A A #e& Aork
conn"
*4
coun!r&-r
<S
a"r$-ro*
IFE
*an!
4 0 0
...
!!!
coun!r&!o
<S
$aAcarr
2 :
A struture is use' t! e)trally &r!+i'e a 'ata type i) %*i* felds from dfferent tables are
compled.
/) t*e ABAP &r!5ram- y!u a) 'e$i)e 'ata ob,ects usi)5 t*e >Diti!)ary? struture.
A tra)s&are)t table merely re&rese)ts a te*)ial 'esri&ti!) i) t*e ABAP Diti!)ary. 0*ere$!re y!u
a) use it as a e)tral 'ata ty&e 'e$i)iti!)- as %it* a struture. 0*is mea)s t*at- similarly t! t*e 'ata
!bGet 'e$i)iti!)s liste' ab!+e- t*e $!ll!%i)5 +aria)ts are als! &!ssibleE
DATA .a/sp+l# TYPE sp+l# &r!+i'es a 'ata !bGet- ty&e' li(e t*e li)e i) t*e tra)s&are)t table
SPFLI.
TALES s,$!""+o$$ &r!+i'es a 'ata !bGet- ty&e' li(e t*e struture SBC400FOCC.
PARAMETERS pa/$a%% TYPE s,$!""+o$$1$a%%#4 &r!+i'es a) i)&ut $iel'- ty&e' li(e t*e
CARRID !m&!)e)t !$ t*e struture SBC400FOCC.
>C? SAP AG BC400 #0
4.11
SAP AG 2001
<sing lobal Structures $or 8ialogs
Short description o$ the
airline
,he -"el con!a"ns !he 0D o- !he a"rl"ne.
8ocu%entation
Per$or%ance Assistant
Airline
F+
Short description !!!
0D
AA
AB
A#
AF
4nput help
PARAMETERS pa/$a%%
TYPE sp+l#1$a%%#40
TALES sp+l#0
8ict>Progra% $ields
Screen Painter
A"rl"ne
A*er"can A"rl"nes
A"r Berl"n
A"r #anaa
A"r France
/$ y!u use a) eleme)tary struture t! 'e$i)e a) nput feld !) a seleti!) sree)- y!u a) use
sema)ti attributes !r te*)ial attributes. O) reBuest- t*e system aut!matially 5e)erates a
documentaton dalog a)' a) nput help dalog $!r t*e user. 0*e )eessary i)$!rmati!) $!r
t*is is ta(e) $r!m t*e ABAP Diti!)ary.
0*e same a&&lies t! $iel's !$ tra)s&are)t tables.
/$ y!u use a) eleme)tary struture !m&!)e)t t! assi5) a ty&e t! a) nput&output feld !) a
sree)- y!u a) use t*e same attributes as %it* seleti!) sree)s.
/$ y!u *a+e 'e$i)e' a $!rei5) (ey relati!)s*i&- t*e resulti)5 +alue !mbi)ati!)s a&&ear i) t*e
i)&ut *el& !) t*e sree). /$ a) err!r !urs- t*e system &r!esses a) aut!mati error dalog.
0*e same a&&lies t! $iel's !$ tra)s&are)t tables.
;se t*e TALES statement t! 'e$i)e t*e 'ata !bGet $!r t*e 'ata tra)s&!rt bet%ee) sree) a)'
&r!5ram.
>C? SAP AG BC400 ##
4.12
SAP AG 2001
8escribe the SAP $light data %odel
8escribe the structure o$ a transparent table
8escribe the structure o$ a structure
2ist the possible uses o$ transparent tables and
structures in ABAP progra%s
Aou are no& able to:
4ntroduction to the ABAP 8ictionary:
<nit Su%%ary
>C? SAP AG BC400 #"
4.13ABAP 'ictionary E$ercises
1nt: 2ntroducton to the ABAP 3ctonary
Topc: 1sng 5lobal 0tructures
for 3ata +b,ects and 3alogs
At t*e !)lusi!) !$ t*ese e6erises- y!u %ill be able t!E
1stablis* t*e te*)ial )ames !$ 'ata ty&es a)' 'ata !bGets t*at are
use' i) user 'ial!5s.
Ru) %*ere:use' lists %it*i) a) ABAP &r!5ram.
@!u *a+e t! e6ami)e a s&ei$ie' ABAP &r!5ram t! see %*et*er 5l!bal
'ata ty&es are use' i) it- a)' i$ s!- %*i* !)es.
Pr!5ramE SAPBC400WBT_GETTING_STARTED
#:# O&e) t*e !bGet list $!r 'e+el!&me)t lass BC400. 9i)' t*e &r!5ram
SAPC!""3T/GETTING/STARTED- a)' !&e) its !bGet list. 0*r!u5*!ut t*e
e6erise- ma(e sure t*at y!u remai) i) dsplay mode.
#:" Ru) t*e &r!5ram t! $i)' !ut *!% it %!r(s.
#:3 0*ere is a) i)&ut $iel' !) t*e seleti!) sree).
#:3:# .*at i)$!rmati!) must y!u &ass t! t*e &r!5ramK
>;se L9#M $!r $iel' *el&.?
#:3:" .*at +alues a) y!u e)terK
>;se L94M $!r i)&ut *el&.?
#:3:3 .*at i)$!rmati!) '!es t*e &r!5ram &r!+i'eK
#:3:4 .*at is t*e te*)ial )ame !$ t*e i)&ut $iel'K
>;se t*e Technical information i) L9#M $iel' *el&.?
>C? SAP AG BC400 #3
#:4 0%! '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#M$iel' *el&.?
#:4:3 .*at are t*e te*)ial )ames !$ t*e 'is&lay $iel'sK D! t*e $iel's bel!)5 t! a
struture %it* a 5l!bally 'e$i)e' ty&eK
>;se t*e Technical information i) L9#M $iel' *el&.?
#:5 ;se t*e !bGet list t! a)alyCe t*e s!ure !'e !$ t*e &r!5ram.
#:5:# .*at 'ata !bGets are t*ereK .*ere are t*ey 'e$i)e' i) t*e &r!5ramK
#:5:" .*ere i) t*e &r!5ram are t*ey use'K
>;se t*e %*ere:use' list i) t*e ABAP 1'it!r.?
#:5:3 .*at 'ata !bGet !rres&!)'s t! t*e i)&ut $iel' !) t*e seleti!) sree)K
>Sear* t*e !bGet list $!r a 'ata !bGet %it* t*e same )ame as t*e $iel' t*at
y!u $!u)' i) ste& #:3:4.?
>C? SAP AG BC400 #4
4.14ABAP 'ictionary So%&tions
1nt: 2ntroducton to the ABAP 3ctonary
Topc: 1sng 5lobal 0tructures
for 3ata +b,ects and 3alogs
#:3 A)alyCi)5 by e6euti)5 a &r!5ramE
#:3:# @!u )ee' t! e)ter a) airli)e !'e.
#:3:" 0*e +alues &ermitte' *ere 'e&e)' !) t*e !)te)ts !$ 'atabase table SCARR.
#:3:3 0*e &r!5ram 'is&lays 'etaile' i)$!rmati!) !) t*e airli)e selete'. 0*is
i)$!rmati!) is $irst 'is&laye' !) a sree) a)' t*e) as a list.
#:3:4 0*e te*)ial )ame !$ t*e i)&ut $iel' is pa/$a%.
#:4 A)alyCi)5 by e6euti)5 a &r!5ramE
#:4:# 0*e sree) )umber is <"".
#:4:" 0*e system a5ai) 'is&lays t*e airli)e !'e a)' t*e urre)y !'e.
#:4:3 0*e !ut&ut $iel's are s,$!""/$a%%#e%1$a%%#4 a)'
s,$!""/$a%%#e%1$)%%$o4e. D!uble:li( i) t*e &tr$ct$re $iel' t! 5!
t! t*e ABAP Diti!)ary a)' a)alyCe t*e 5l!bal ty&e m!re l!sely.
#:5 A)alyCi)5 usi)5 t*e &r!5ramIs !bGet listE
#:5:# 0*e &r!5ram *as t*e strutures s,$!""/$a%%#e% a)' .a/s$a%% a)'
t*e eleme)tary 'ata !bGet pa/$a%.
#:5:" 0*e eleme)tary 'ata !bGet pa/$a% bel!)5s t! t*e i)&ut $iel'- %it* t*e
same )ame- !) t*e seleti!) sree).
>C? SAP AG BC400 #5
)
SAP AG 2001
8ata Types and 8ata 7b6ects
Basic ABAP State%ents
<sing the ABAP 8ebugger
Working &ith Structures
Working &ith 4nternal Tables
Contents:
Basic ABAP 2anguage 9le%ents
>C? SAP AG BC400 #
5.2
SAP AG 2001
8e$ine ele%entary and structured data ob6ects
<se basic ABAP state%ents
9'ecute and analy;e progra%s in debugging
%ode
At the conclusion o$ this unit0 you &ill be able to:
Basic ABAP 2anguage 9le%ents: <nit 7b6ecti"es
>C? SAP AG BC400 "
5.3
SAP AG 2001
8ata Types and 8ata 7b6ects
8ata Types and 8ata 7b6ects
8ata Types and 8ata 7b6ects
Basic ABAP State%ents
Basic ABAP State%ents
<sing the ABAP 8ebugger
<sing the ABAP 8ebugger
Working &ith Structures
Working &ith Structures
Working &ith 4nternal Tables
Working &ith 4nternal Tables
>C? SAP AG BC400 3
5.4
SAP AG 2001
<sing 8ata Types
ABAP progra%
Subroutine
7b6ect
(ethod
4nter$ace
4nter$ace
8ata types describe the attributes o$:
J 4nput > output $ields
J 8ata ob6ects
!!! 4nter$ace para%eters !!! 4nter$ace para%eters J 4nter$ace para%eters
0*e ty&e !$ a 'ata !bGet 'e$i)es its te*)ial attributes.
0*e ty&e !$ a) i)ter$ae &arameter 'e$i)es t*e ty&e !$ t*e +alues >atual &arameters? t*at are
tra)s$erre' %*e) t*e m!'ulariCati!) u)it is alle'.
/) a''iti!) t! t*e te*)ial attributes- t*e ty&e !$ a) i)&ut !r !ut&ut $iel' a) &r!+i'e $urt*er
i)$!rmati!)H $!r e6am&le- y!u a) use it t! !)tr!l t*e +alue !r i)&ut *el&.
>C? SAP AG BC400 4
5.5
SAP AG 2001
2ocal and lobal 8ata Types
ABAP progra%
Subroutine
7b6ect
(ethod
4nter$ace
4nter$ace
ABAP
8ictionary
2ocal data types: Technical
attributes only
Central data types: Technical and
se%antic attributes
@!u a) 'e$i)e 'ata ty&es i) a) ABAP &r!5ram >l!al- (ey%!r' TYPES? !r i) t*e ABAP Diti!)ary
>5l!bal?. ;si)5 5l!bal 'ata ty&es *as se+eral a'+a)ta5esE
Gl!bal ty&es are managed centrally a)' y!u a) use t*em i) all re&!sit!ry !bGets. 0*is i)reases
t*e !)siste)y !$ t*e system a)' si5)i$ia)tly re'ues t*e am!u)t !$ mai)te)a)e.
/) t*e ABAP Diti!)ary- y!u a) &er$!rm a) e)+ir!)me)t a)alysis >where2$se! list?.
Gl!bal 'ata ty&es a) be li)(e' t! busi)ess +ariables by !)te)t- a)' t*ere$!re !)tai) sema)ti a)'
te*)ial i)$!rmati!).
@!u a) use 5l!bal 'atat ty&es t! 'esi5) sree)s.
.*e) sear*i)5 $!r 5l!bal 'ata ty&es- ma(e sure y!u ta(e b!t* t*e te*)ial a)' sema)ti attributes
i)t! a!u)t. O)ly t*e) %ill y!u be able t! ma(e $ull use !$ t*e mai)te)a)e a)' r!bust)ess
a'+a)ta5es !$ y!ur &r!5ram.
>C? SAP AG BC400 5
5.6
SAP AG 2001
8e$ining 8ata 7b6ects
Prede$ined
ABAP types
?
2ocal types
#
+
st%#n(
?st%#n(
t
4
lobal
types
$
n
p
TYPES t'pe/name TYPE 000
DATA 4o/name TYPE t'pe/name0 DATA DATA
DATA 4o/name/ne. LI@E 4o/name0 DATA DATA
@!u a) use a &re'e$i)e' ABAP ty&e- a l!al- !r a 5l!bal ty&e t! ty&e a 'ata !bGet.
0*e $!ll!%i)5 &re'e$i)e' ABAP ty&es are !m&leteE
4 3ate >$!rmatE 7777))33?
t Time >$!rmatE 66))00?
# 2)te5er
+ *l!ati)5 &!i)t )umber
st%#n( 0tri)5 >!$ +ariable le)5t*?
?st%#n( Byte seBue)e >*e8a'eimal stri)5- !$ +ariable le)5t*?
@!u must 'e$i)e t*e le)5t* $!r t*ese &re'e$i)e' ty&esE
$ C*arater
n -umeri *arater
? Byte >*e8a'eimal?
p Pa(e' )umber >N 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 LIKE t! re$er t! t*e ty&e !$ a &re'e$i)e' 'ata !bGet.
>C? SAP AG BC400 6
5.7
SAP AG 2001
8e$ining 9le%entary 8ata 7b6ects
S/CARR/ID
8ata
ele%ent
TYPES t/pe%$enta(eABC TYPE p DECIMALS D0
DATA: n)m,e% TYPE # ;ALUE <E6
pe%$enta(e TYPE t/pe%$enta(e6
$a%%#4 TYPE s/$a%%/#46
$onn#4 TYPE s,$!""+o$$1$onn#40
nu*ber
$ercen!a(e
carr"
F
conn"
SC!""FOCC
Structure
1<
0*e &re'e$i)e' ABAP ty&es >4- t- #- +- st%#n(- a)' ?st%#n(? are !m&lete. 0*is mea)s
t*ey a) 'e$i)e a) eleme)tary 'ata !bGet !$ t*ese ty&es as $!ll!%sE
DATA do_name TYPE 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)5t*. 0*is mea)s y!u
s*!ul' $irst 'e$i)e a) eleme)tary ty&eE
TYPES #$pe_nameA&en'#(C TYPE pede!"ned_ABAP_#$pe0
@!u use it t! 'e$i)e t*e 'ata !bGetE
DATA do_name TYPE #$pe_name0
9!r ty&e p- y!u a) als! 'e$i)e t*e )umber !$ 'eimal &laes usi)5 t*e DECIMALS a''iti!).
@!u a) use t*e ;ALUE a''iti!) t! &re:assi5) t*e +alue !$ a) eleme)tary 'ata !bGet.
9!r !m&atibility reas!)s- y!u a) still !)strut 'ata !bGets i) t*e DATA stateme)t %it*!ut
$irst *a+i)5 t! 'e$i)e t*e ty&e l!ally i) t*e &r!5ram %it* a TYPES stateme)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)5 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 !bGet %it* a le)5t* !$
!)e.9!r t*e sta)'ar' le)5t*s a)' $!r m!re i)$!rmati!)- re$er t! t*e (ey%!r' '!ume)tati!) $!r
TYPES a)' DATA.
0*e same sy)ta6 a&&lies t! 5l!bal ty&es as t! user:'e$i)e' ty&esE
DATA do_name TYPE '&o)a&_#$pe_name
>C? SAP AG BC400 A
5.8
SAP AG 2001
Fi'ed 8ata 7b6ects
2iteral: 2iteral:
Constant: Constant: Fi'ed data ob6ect &ith 48 code
Fi'ed data ob6ect &ithout 48 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 c Te't literal: Type c
CONSTANTS $onst/name TYPE t'pe/name ;ALUE F l#te%al G IS INITIAL H0 CONSTANTS CONSTANTS
@!u assi5) a +alue t! ea* $i6e' 'ata !bGet i) t*e s!ure !'e. 0*ere$!re- it a))!t be *a)5e'
at ru) time.
@!u a) use lterals t! tra)s$er $i6e' +alues t! ABAP stateme)ts. 0*ere are )umeri literals a)'
te6t literals. 0*e latter are al%ays e)l!se' i) i)+erte' !mmasE
@!u a) 'is&lay i)te5ers as numerc lterals >i) t*e ase !$ )e5ati+e )umbers- %it* a
&ree'i)5 si5)?. 0*e system t*e) ma&s t*em !)t! t*e 'ata ty&e - i$ t*ey are %it*i) t*e +alue
ra)5e !$ 4:byte i)te5ers. <i5*er )umeri literals are ma&&e' !)t! 'ata ty&e p.
@!u must 'is&lay all !t*er literals >su* as *arater sets- )umbers %it* 'eimal &laes-
$l!ati)5 &!i)t )umbers? as te"t lterals. 0*ey are ma&&e' !)t! 'ata ty&e $ a)' !)+erte' later-
i$ )eessary.
/$ y!u %a)t t! i)lu'e a) i)+erte' !mma i) a te6t literal- y!u must e)ter it t%ie.
@!u 'e$i)e !)sta)ts usi)5 t*e CONSTANTS stateme)t. 0*eir ty&e is 'e$i)e' similarly t! t*e
ty&e !$ a) eleme)tary 'ata !bGet %it* t*e DATA stateme)t. 0*e *AL+E a''iti!) is reBuire' $!r
!)sta)ts
%ecommendaton: A+!i' literals %*e) usi)5 stateme)ts. Create !)sta)ts i)stea'. 0*is si5)i$ia)tly
im&r!+es &r!5ram mai)te)a)e.
>C? SAP AG BC400 8
5.9
SAP AG 2001
Basic ABAP State%ents
8ata Types and 8ata 7b6ects
8ata Types and 8ata 7b6ects
Basic ABAP State%ents
Basic ABAP State%ents
<sing the ABAP 8ebugger
<sing the ABAP 8ebugger
Working &ith Structures
Working &ith Structures
Working &ith 4nternal Tables
Working &ith 4nternal Tables
>C? SAP AG BC400 8
5.10
SAP AG 2001
?alue Assign%ents


ABAP runti%e syste%
MO;E $/I+ TO $a%%#4<0
$a%%#4D 7 $a%%#4<0
ADD < TO $o)nte%0
CLEAR: $a%%#4<6
$a%%#4D6
$o)nte%0
Ti%e
CONSTANTS $/I+ TYPE s/$a%%/#4 ;ALUE 98F90
DATA: $a%%#4< TYPE s/$a%%/#46
$a%%#4D TYPE s/$a%%/#4 ;ALUE 9LH96
$o)nte% TYPE #0
Progra% start Progra% start
8ata declarations
MO;E MO;E
CLEAR CLEAR
cA.- 1F
carr"1 carr"2
/B
coun!er
0
ABAP progra%
1F /B 0
1F 1F 0
1F 1F 1
0
.*e) a &r!5ram is starte'- t*e &r!5ram !)te6t is l!a'e' i)t! a st!ra5e area !$ t*e a&&liati!)
ser+er a)' ma'e a+ailable $!r all t*e 'ata !bGets.
1+ery eleme)tary 'ata !bGet is &reassi5)e' t*e ty&e:relate' i)itial +alue- e6e&t i$ y!u
&reassi5)e' a 'i$$ere)t +alue usi)5 t*e *AL+E a''iti!).
@!u a) use t*e MO*E stateme)t t! !&y t*e !)te)ts !$ 'ata !bGets. 0%! stateme)ts are
a+ailable $!r t*is &ur&!seE
MO*E ,o-.e TO #a'e#0
#a'e# 7 ,o-.e0
/$ t*e t%! 'ata !bGets *a+e 'i$$ere)t ty&es- t*e ty&e is aut!matially !)+erte' i$ t*ere is a
!)+ersi!) rule.
9!r 'etaile' i)$!rmati!) ab!ut !&yi)5 a)' t*e !)+ersi!) rules- re$er t! t*e (ey%!r'
'!ume)tati!) $!r t*e MO*E stateme)t.
0*e CLEAR stateme)t resets t*e !)te)ts !$ a 'ata !bGet t! t*e ty&e:relate' i)itial +alue. 9!r
'etaile' i)$!rmati!) ab!ut t*e i)itial +alues $!r a &artiular ty&e- re$er t! t*e (ey%!r'
'!ume)tati!) $!r t*e CLEAR stateme)t.
>C? SAP AG BC400 #0
5.11
SAP AG 2001
Calculations
COMPUTE pe%$enta(e 7 o$$ 2 <"" * ma?0
DATA: ma? TYPE s,$!""+o$$1seatsma?6
o$$ TYPE s,$!""+o$$1seatso$$6
pe%$enta(e TYPE s,$!""+o$$1pe%$enta(e0
8ata declarations
COMPUTE COMPUTE
The key&ord is optional:
pe%$enta(e 7 o$$ 2 <"" * ma?0
ABAP progra%
2 2 * *
/) ABAP y!u a) &r!5ram arthmetc e"pressons nested t! a)y 'e&t*. N!te t*at &are)t*eses a)'
!&erat!rs are (ey%!r's a)' must be se&arate' by at least !)e bla)( *arater.
0*e $!ll!%i)5 are +ali' !&erat!rsE
J A''iti!)
1 Subtrati!)
2 Multi&liati!)
* Di+isi!)
22 P!%er
DI; /)te5er 'i+isi!) %it*!ut remai)'er
MOD /)te5er 'i+isi!) %it* remai)'er
0*ere are se+eral $u)ti!)s $!r 'i$$ere)t 'ata ty&es i) t*e ABAP ru)time e)+ir!)me)t.
9!r e6am&le- t*e $!ll!%i)5 stateme)t retur)s t*e urre)t le)5t* !$ t*e !)te)ts !$ a *arater setE
len(t& 7 STRLENA $#t'+%om C0
.it* $u)ti!)s t*e !&e)i)5 &are)t*esis is &art !$ t*e /D. 0*e rest must a5ai) be se&arate' by at least
!)e s&ae.
/) 5e)eral- t*e usual al5ebrai rules a&&ly $!r t*e processng se.uenceE e6&ressi!)s i) &are)t*eses
!me $irst- t*e) &!%ers- t*e) multi&liati!)/'i+isi!)- a)' $i)ally a''iti!)/subtrati!).
9!r 'etaile' i)$!rmati!) ab!ut t*e a+ailable !&erati!)s a)' $u)ti!)s- re$er t! t*e (ey%!r'
'!ume)tati!) $!r COMP+TE..
>C? SAP AG BC400 ##
5.12
SAP AG 2001
CASE 4ata/o,-e$t/<0
3HEN 4ata/o,-e$t/D0
3HEN 4ata/o,-e$t/B OR 4ata/o,-e$t/!0
3HEN OTHERS0
ENDCASE0
State%ents
State%ents
State%ents
IF Klo(#$al/e?p%ess#onL0
ELSEIF Klo(#$al/e?p%ess#onL0
ELSE0
ENDIF0
State%ents
State%ents
State%ents
Conditional Branching
CASE CASE
3HEN 3HEN
3HEN 3HEN
3HEN OTHERS 3HEN OTHERS
ENDCASE ENDCASE
IF IF
ELSEIF ELSEIF
ELSE ELSE
ENDIF ENDIF
OR OR
/) ABAP y!u *a+e t%! %ays t! e6eute 'i$$ere)t seBue)es !$ stateme)ts- 'e&e)'i)5 !) ertai)
!)'iti!)s.
.it* t*e CASE1ENDCASE !)struti!) t*e riteri!) $!r t*e e6euti!) !$ a stateme)t bl!( is
t*e similarity !$ t*e 'ata !bGets. /$ )! !m&aris!) is suess$ul- t*e) t*e system e6eutes t*e
OTHERS bra)*- i$ it is a+ailable.
16e&t $!r t*e $irst 3HEN bra)*- all $urt*er a''iti!)s are !&ti!)al.
.it* t*e IF1ENDIF !)struti!)- y!u a) use a)y l!5ial e6&ressi!)s. /$ t*e !)'iti!) is met-
t*e system e6eutes t*e rele+a)t stateme)t seBue)e. /$ )! !m&aris!) is suess$ul- t*e) t*e
system e6eutes t*e OTHERS bra)*- i$ it is a+ailable. 16e&t $!r t*e $irst Buery- all $urt*er
bra)*es are !&ti!)al.
9!r b!t* !)struti!)s- t*e system e6eutes !)ly !)e stateme)t seBue)e a)' al%ays $!r t*e
frst $ald ase.
%ecommendatonE
/$- i) e+ery !)'iti!)- y!u *e( t*at a +ariable is eBual t! a 5i+e) +alue- use t*e CASE/
ENDCASE !)struti!). /t is learer a)' less ru)time i)te)si+e.
Outsi'e !$ l!!&s y!u a) als! use C0ECK i)stea' !$ IF. 0*is Buery sets t*e e6euti!) !$ all
stateme)ts up to the end of the current processng block u)'er !)e !)'iti!). /$ t*is is
u)suess$ul- t*e system !)ti)ues %it* t*e $irst stateme)t i) t*e )e6t &r!essi)5 bl!(.
>C? SAP AG BC400 #"
5.13
SAP AG 2001
2oops
DO F n TIMES H F000H0
ENDDO0
3HILE Klo(#$al/e?p%ess#onL0
END3HILE0
LOOP AT 000
ENDLOOP0
SELECT 000
ENDSELECT0
DO0
IF Ka,o%t/$on4#t#onL0
EXIT0
ENDIF0
ENDDO0
2oop counter:
sy=inde'
2oop counter:
s'1#n4e?
State%ents
State%ents
State%ents
State%ents
State%ents
/) ABAP t*ere are $!ur l!!& !)struti!)s- %*ereby LOOP1ENDLOOP a)' SELECT1
ENDSELECT re&rese)t s&eial ases. /) t*e DO a)' 3HILE l!!&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
0*e stateme)ts bet%ee) DO a)' ENDDO are e6eute' u)til t*e l!!& is le$t !+er !t*er stateme)ts.
@!u als! *a+e t*e !&ti!) !$ s&ei$yi)5 t*e ma6imum )umber !$ l!!& &assesH !t*er%ise- y!u
may 5et a) e)'less l!!&.
6eader controlled loops
0*e stateme)ts bet%ee) 3HILE a)' END3HILE are e6eute' !)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 e6am&le- y!u a) !)strut a footer-controlled l!!&.
>C? SAP AG BC400 #3
5.14
SAP AG 2001
8ialog (essages
MESSAGE #nnnAme,,a'e_.&a,,C F 3ITH 45 F 46 H F 47 H F 44 H H0
Type
t
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 error MESSAGE/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
4n$or%ation
Warning
9rror
Ter%ination
Short du%p
@!u a) use t*e MESSAGE stateme)t t! se)' 'ial!5 messa5es. @!u must s&ei$y t*e t*ree:'i5it
messa5e )umber a)' t*e messa5e lass.
9urt*erm!re- y!u a) use t*e 3ITH a''iti!) t! i)lu'e u& t! $!ur +alues. 0*e system- 'e&e)'i)5 !)
t*e messa5e te6t- i)serts t*ese +alues i)t! t*e messa5e te6t.
@!u !)tr!l t*e 'ial!5 be*a+i!r usi)5 t*e ty&e abbre+iati!) OtP. 0*ere are si6 'i$$ere)t ty&es !$
messa5eE
a Ab!rt 0*e &r!5ram is e)'e' a$ter a 'ial!5 b!6.
? 1"it 0*e &r!5ram e)'s i) a s*!rt 'um&.
e (rr!r Ru)time be*a+i!r is !)te6t 'e&e)'e)t.
. War)i)5 Ru)time be*a+i!r is !)te6t 'e&e)'e)t.
# 2)$!rmati!) 0*e &r!5ram !)ti)ues a$ter a 'ial!5 b!6.
s 0uess0*e messa5e a&&ears i) t*e status bar !) t*e subseBue)t sree).
9!r $urt*er i)$!rmati!) ab!ut t*e sy)tati alter)ati+es !$ t*e MESSAGE stateme)t- re$er t! t*e
(ey%!r' '!ume)tati!).
>C? SAP AG BC400 #4
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
Bel$
i
ABAP 8ocu%entation and 9'a%ples
@
@
@
@
@
BC = ABAP Progra%%ing
ABAP 4ntroduction
ABAP Progra%%ing 2anguage
ABAP <ser 8ialogs
Screens
Selection Screens
2ists
(essages
Si%ple e'a%ple $or %essages
8e%onstration $or all %essage types
!!!
@
@
@
@
De&e)'i)5 !) t*e !)te6t i) %*i* t*ey a&&ear- s!me messa5e ty&es s*!% 'i$$ere)t 'ial!5
be*a+i!r.
@!u a) $i)' a &r!5ram $!r testi)5 t*e resulti)5 !&ti!)s i) t*e ABAP '!ume)tati!). 0! aess
t*ese e6am&le &r!5rams- *!!se %tilities *elp onABAP !oc) an! e1amples >i) t*e
$!ll!%i)5 'ial!5 b!6?
>C? SAP AG BC400 #5
5.16
SAP AG 2001
<sing the ABAP 8ebugger
8ata Types and 8ata 7b6ects
8ata Types and 8ata 7b6ects
Basic ABAP State%ents
Basic ABAP State%ents
<sing the ABAP 8ebugger
<sing the ABAP 8ebugger
Working &ith Structures
Working &ith Structures
Working &ith 4nternal Tables
Working &ith 4nternal Tables
>C? SAP AG BC400 #6
5.17
SAP AG 2001
9'ecuting a Progra% in 8ebugging (ode
Progra%
DBC400C00CS
DBC400C00CS
REPORT sap,$!"".,t/(ett#n(/sta%te40
TALES s,$!""/$a%%#e%0
DATA .a/s$a%% TYPE s$a%%0
PARAMETERS pa/$a% TYPE s$a%%1$a%%#40
START1OF1SELECTION0
SELECT SINGLE 2 FROM s$a%%
INTO CORRESPONDING
3HERE $a%%#4 7 pa/$a%0
IF s'1s),%$ 7 "0
MO;E1CORRESPONDING .a/s$a%% TO s,$!
CALL SCREEN <""0
MO;E1CORRESPONDING s,$!""/$a%%#e% T
3RITE:* .a/s$a%%1$a%%#46
.a/s$a%%1$a%%name6
9'ecute
8ebugging
<se the conte't %enu
7r:
Set a breakpoint and
e'ecute the progra%
@!u a) start a &r!5ram i) Debu55i)5 m!'e $r!m t*e ObGet Na+i5at!r- %it*!ut *a+i)5 t!
*a)5e t*e &r!5ram i) t%! %aysE
/) t*e )a+i5ati!) area- *!!se E1ec$te Deb$''in' $!r t*e selete' &r!5ram.
/) t*e e'iti)5 area- selet t*e 'esire' &r!5ram li)e a)' *!!se &et3!elete breakpoint.
0*e) start t*e &r!5ram by *!!si)5 E1ec$te Direct processin' >98?
>C? SAP AG BC400 #A
5.18
SAP AG 2001
S&itching to 8ebugging (ode at -unti%e
>h
Syste% :elp Syste% :elp
<tilities 8ebug screen
8ebug ABAP
9nter L>hM into the co%%and
$ield and then select N9nterO
7r:
Choose %enu Syste)
/$ y!u %a)t t! 'ebu5 !)ly ertai) &arts !$ a &r!5ram- start t*e &r!5ram $irst a)' t*e) s%it* t!
'ebu55i)5 m!'e be$!re a sree) *a)5e. @!u a) '! t*is i) t%! %aysE
C*!!se &ystem %tilities Deb$' ABAP !r Deb$' screen.
1)ter *& i) t*e !mma)' $iel' a)' selet Enter.
>C? SAP AG BC400 #8
5.19
SAP AG 2001
8ebugging (ode: Single Step and Field Contents
F"el ?a*e
@GGAF8R'S
1 4
9 F"el Dalue

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 <""0
MO;E1CORRESPONDING s,$!""/$a%%#e% TO .a/s$a%%0
F"2e $o"n! ar"!h*e!"c
1% 30 9







E
SAP
Wa!ch$o"n!
ABAP 'e"&**er


chws chws
r
SC9S3BR# SC9,AB0E SC9DB#?, 0 0 1
8ouble=click the
data ob6ect
paCcarr 2:
Current state%ent
Single step
/) 'ebu55i)5 m!'e- y!u a) *!!se &in'le step t! e6eute t*e &r!5ram stateme)t by stateme)t.
@!u a) 'is&lay t*e !)te)ts !$ u& t! ei5*t 'ata !bGets. 1)ter t*e )ames i) t*e le$t i)&ut $iel' !r
'!uble:li( t*e )ame i) t*e 'is&laye' s!ure !'e.
>C? SAP AG BC400 #8
5.20
SAP AG 2001
8ebugging (ode: Breakpoints
Dar"an! 1 4
9
Dar"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 <""0
MO;E1CORRESPONDING s,$!""/$a%%#e% TO .a/s$a%%0
F"2e $o"n! ar"!h*e!"c
1% 30 9







E
SAP
Wa!ch$o"n!
ABAP 'e"&**er


chws chws

SC9S3BR# SC9,AB0E SC9DB#?, 0 0 1


Continue
0! set a brea(&!i)t- '!uble:li( i) $r!)t !$ a li)e !$ s!ure !'e.
0! set a brea(&!i)t $!r a s&ei$i ABAP stateme)t- *!!seE Breakpoint Breakpoint at
&tatement)
/$ y!u *!!se "ontin$e- t*e &r!5ram is e6eute' u& t! t*e )e6t brea(&!i)t.
/$ y!u &ave t*e brea(&!i)ts- t*ey remai) i)tat %*ile y!u are l!55e' !) t! t*e system.
.it* brea(&!i)ts- t*e ABAP .!r(be)* s%it*es t! 'ebu55i)5 m!'e !)ly $!r t*e 'e+el!&er
%*! set t*e brea(&!i)ts. All !t*er users a) e6eute t*e &r!5ram 'iretly !r set t*eir !%)
brea(&!i)ts
>C? SAP AG BC400 "0
5.21
SAP AG 2001
8ebugging (ode: Tracing 8ata Changes
Watchpoint
Create>Change Watchpoint
2ocal &atchpoint ,only in speci$ied progra%.
Progra%
Field na%e
-elational operator
Co%p! $ield>"alue
Co%parison $ield ,Co%parison "alue i$ not selected.
pa/$a%%
7
LH
+
2
3
!!!
+0
7- A#8
paCcarr
2: P
#o! 2ocal Progra% Field na%e Field 7perator Co%p! $ield>"alue
2ogical operator bet&een &atchpoints
Watchpoints
.at*&!i)ts are brea(&!i)ts t*at 'e&e)' !) t*e $iel' !)te)t. @!u a) reate t*e $!ll!%i)5 ty&es !$
%at*&!i)tsE
*eld name:
0*e &r!5ram is e6eute' u)til t*e !)te)t !$ t*e $iel' *as *a)5e'.
*eld name9 relatonal operator9 comparson $alue:
0*e &r!5ram is e6eute' u)til t*e !)te)t !$ t*e $iel' *as *a)5e' s! t*at t*e 'e$i)e' l!5ial
!)'iti!)- relati+e t! a +alue- is met.
*eld name9 relatonal operator9 comparson $alue:
0*e &r!5ram is e6eute' u)til t*e !)te)t !$ t*e $iel' *as *a)5e' s! t*at t*e 'e$i)e' l!5ial
!)'iti!)- relati+e t! t*e !)te)t !$ a $iel'- is met.
@!u a) set u& t! #0 %at*&!i)ts a)' li)( t*em usi)5 t*e l!5ial !&erat!rs AND !r OR.
>C? SAP AG BC400 "#
5.22
SAP AG 2001
Working &ith Structures
8ata Types and 8ata 7b6ects
8ata Types and 8ata 7b6ects
Basic ABAP State%ents
Basic ABAP State%ents
<sing the ABAP 8ebugger
<sing the ABAP 8ebugger
Working &ith Structures
Working &ith Structures
Working &ith 4nternal Tables
Working &ith 4nternal Tables
>C? SAP AG BC400 ""
5.23
SAP AG 2001
8e$inition o$ Structures &ith lobal Types
DATA .a/+o$$ TYPE s,$!""+o$$0
TALES sp+l#0
DATA DATA
TALES TALES
;aA-occ
carr" sea!s*a2 conn" -la!e sea!socc $ercen!a(e
s$-l"
carr" c"!&-ro* conn" coun!r&-r a"r$-ro* *an! ... coun!r&!o
SC!""FOCC
Structure
SPFLI
Transparent
table
/) ABAP- y!u a) 'e$i)e struture' 'ata !bGets >sim&ly alle' strutures?. 0*is all!%s y!u t!
!mbi)e +alues t*at bel!)5 t!5et*er l!5ially i)t! !)e !bGet.
Strutures a) be )este'. 0*is mea)s t*at !m&!)e)ts a) !)sist !$ m!re strutures !r e+e) tables.
0*ere are t%! %ays t! 'e$i)e struturesE
9!r DATA ,#-._name TYPE ,#-._#$pe8 y!u a) use local or global #$pe,
,#-._#$pe.
TALES '&o)a&_,#-._#$pe 'e$i)es a struture t*at is te*)ially ma)a5e' i) a s&eial
mem!ry area. /t *as t*e same )ame as t*e 5l!bal struture- '&o)a&_,#-._#$pe.
9!r t*is +aria)t- t*e 5l!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- TABLES strutures ser+e !)ly as i)ter$aes $!r sree)
$iel's..
>C? SAP AG BC400 "3
5.24
SAP AG 2001
8e$inition o$ Structures &ith 2ocal 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(eABC TYPE p DECIMALS D6
END OF st/+l#(&t#n+o 0
DATA .a/+l#(&t#n+o TYPE st/+l#(&t#n+o0
EGIN OF EGIN OF
;aA-l"(h!"n-o
carr" sea!s*a2 conn" -la!e sea!socc $ercen!a(e
END OF END OF
@!u a) als! 'e$i)e struture ty&es l!ally usi)5 t*e TYPES stateme)t. 0*e !m&!)e)ts are
e)l!se' by t*e $!ll!%i)5 stateme)ts as s*!%) i) t*e 5ra&*iE
EGIN OF ,#-.#-e_#$pe_name0
000
END OF ,#-.#-e_#$pe_name0
1a* i)'i+i'ual !m&!)e)t a) i) tur) be assi5)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 !bGet itsel$ i) t*e usual %ay.
9!r !m&atibility reas!)s- y!u a) als! 'iretly 'e$i)e a struture' 'ata !bGetE
DATA: EGIN OF ,#-.#-e_name
000
END OF ,#-.#-e_#$pe_name
>C? SAP AG BC400 "4
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
1 1
;aAscarr
*an! currcoe carr" carrna*e url
1 1
1 1
1 1
1 1
C!m&!)e)ts !$ a struture are al%ays a''resse' usi)5 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
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$$0 MO;E1CORRESPONDING MO;E1CORRESPONDING
;aA-occ
carr" sea!s*a2 conn" -la!e sea!socc $ercen!a(e
;aAs-l"(h!
carr" ... conn" -la!e sea!s*a2 *an! ... sea!socc
TO TO
0*e stateme)t MO;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. 0*e +alue assi5)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)5e'.
>C? SAP AG BC400 "6
5.27
SAP AG 2001
Structures in 8ebugging (ode
Dar"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 <""0
MO;E1CORRESPONDING s,$!""/$a%%#e% TO .a/s$a%%0
F"2e $o"n! ar"!h*e!"c
9







E
SAP
Wa!ch$o"n!
ABAP 'e"&**er


chws chws
F"els
SC9S3BR# 0
&aCsbc400
#o! Co%ponent na%e Type 2ength Contents
+
2
3
4
)
*
1
H
(A#8T
CA--48
CA--#A(9
C<--C789
(A-E
<#A(9
<D94T
8AT9
C
C
C
C
C
C
T
8
3
3
20
)
+
+2
*
H
+00
AA
A%erican Airlines
<S8
000000
00000000
Structured $ield
2ength ,in bytes.
&aCsbc400
)H
8ouble=click the
data ob6ect
@!u a) trae t*e $iel' !)te)ts !$ a struture by e)teri)5 t*e )ame !$ t*e struture i) t*e le$t
!lum). D!uble:li( t*is e)try t! see t*e !m&!)e)t 'is&lay.
>C? SAP AG BC400 "A
5.28
SAP AG 2001
Working &ith 4nternal Tables
8ata Types and 8ata 7b6ects
8ata Types and 8ata 7b6ects
Basic ABAP State%ents
Basic ABAP State%ents
<sing the ABAP 8ebugger
<sing the ABAP 8ebugger
Working &ith Structures
Working &ith Structures
Working &ith 4nternal Tables
Working &ith 4nternal Tables
>C? SAP AG BC400 "8
5.29
SAP AG 2001
4nternal Tables


Table can be
e'tended dyna%ically
/)ter)al tables are 'ata !bGets t*at all!% y!u t! retai) se+eral 'ata re!r's %it* t*e same
struture 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.
0*e ABAP ru)time system 'y)amially ma)a5es t*e le)5t* !$ i)ter)al tables. 0*is elimi)ates
a)y %!r( !)er)i)5 %!r(i)5 mem!ry ma)a5eme)t.
0*e i)'i+i'ual 'ata re!r's i) a) i)ter)al table are ()!%) as table lnes !r table e)tries. 9!r
t*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.
0*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)5 lar5e 'ata re!r's i) a struture' $!rm %it*i) a
&r!5ram. 0y&ial uses i)lu'eE
Q 0em&!rarily st!ri)5 'ata $r!m 'atabase tables $!r $uture &r!essi)5
Q Struturi)5 a)' $!rmatti)5 'ata $!r !ut&ut
Q 9!rmatti)5 'ata $!r use by !t*er ser+ies
>C? SAP AG BC400 "8
5.30
SAP AG 2001
Attributes o$ 4nternal Tables
AA 00+1 20)12
2: 0400 *0+*2
FF 000) +00000
4nde' access 4nde' access
2: 0400 10213
)
Eey access Eey access
<A 0001
2ine type 2ine type 2ine type
Eey de$inition Eey de$inition Eey de$inition
8ata access type 8ata access type 8ata access type
CA--48 C7##48 84STA#C9 CA--48 C7##48 84STA#C9
SF 0H** +0*2)
<A 0001 20)12
H H Co%ponents Co%ponents
H H Se5uence Se5uence
H H <ni5ue > non=uni5ue key <ni5ue > non=uni5ue key
2ine inde' 2ine inde'
)
4
3
2
+
*
0*e 'ata ty&e !$ a) i)ter)al table is !m&letely s&ei$ie' by t*e $!ll!%i)5 attributesE
4ne type
0*is is t*e s!ure !$ t*e attributes !$ t*e i)'i+i'ual !lum)s. @!u )!rmally s&ei$y a struture
ty&e but a)y 'ata ty&es are &!ssible.
:ey defnton
0*e (ey !lum)s a)' t*eir !r'er 'e$i)e t*e riteria by %*i* t*e tables are i'e)ti$ie'.
De&e)'i)5 !) t*e aess ty&e- t*e (ey a) be 'e$i)e' as un.ue !r non-un.ue. .it* u)iBue
(eys t*ere are )! multi&le e)tries %it* i'e)tial +alues i) t*e (ey.
3ata access type
.it* a key access R as %it* 'atabase tables R y!u aess usi)5 t*e $iel' !)te)ts.
("ampleE A rea' aess usi)5 t*e sear* term 9UA """E9 t! a) i)ter)al table %it* t*e u)iBue
(ey CARRID CONNID a)' t*e 'ata &iture' ab!+e retur)s e6atly !)e 'ata re!r'.
2nde" accessE ;)li(e 'atabase tables- %it* i)ter)al tables t*e system may )umber t*e li)es a)'
5i+e t*e li)e a) i)'e6. @!u a) use t*is i'e6 t! aess a s&ei$i table li)e.
("ampleE A rea' aess t! a 'ata re!r' %it* i)'e6 5 retur)s t*e $i$t* 'ata re!r' !$ t*e i)ter)al
table
>C? SAP AG BC400 30
5.31
SAP AG 2001
4nde' access
Eey access
<ni5ue > #7#= <#4F<9 <#4F<9 Q #7#=<#4F<9 <#4F<9
#on=<ni5ue Eey
Access <sing (ainly inde' (ainly keys Eeys only
BASB4D ,AB/4 BASB4D ,AB/4
S,A?DARD ,AB/4 S,A?DARD ,AB/4 S8R,4D ,AB/4 S8R,4D ,AB/4
Connection Bet&een Table Eind and Access Type
4nde' tables :ashed table
Table type
n
n
A)!t*er i)ter)al table attribute is t*e table type. /)ter)al tables a) be 'i+i'e' i)t! t*ree table ty&es
a!r'i)5 t! t*e res&eti+e aess ty&esE
Q .it* standard tables t*e li)e )umberi)5 is mai)tai)e' i)ter)ally. B!t* i)'e6 a)' (ey aesses
are &!ssible.
Q .it* sorted tables t*e 'ata re!r's are al%ays s!rte' a!r'i)5 t! (ey a)' sa+e'. <ere t!!- t*e
i)'e6 is mai)tai)e' i)ter)ally. B!t* i)'e6 a)' (ey aesses are &!ssible.
Q .it* hashed tables t*e 'ata re!r's are ma)a5e' !&timiCe' at ru) time. A u)iBue (ey is a
reBuireme)t. .it* *as*e' tables !)ly (ey aesses are &!ssible.
.*i* table ty&e y!u use i) ea* ase- 'e&e)'s !) *!% t*at tableIs e)tries are 5e)erally 5!i)5 t! be
aesse'E
Q 9!r i)'e6 aesses y!u s*!ul' )!rmally use sta)'ar' tables.
Q S!rte' tables are best $!r u)iBue (eys a)' $i6e' s!rti)5.
Q .it* *as*e' tables t*e ru)time !&timiCati!) is )!tieable !)ly i$ t*e aesses are !$ t*e rea'
ty&e %it* a u)iBue (ey.
0*is !urse 'eals %it* sta)'ar' tables !)ly. A&art $r!m a $e% s&eial ases- t*e sy)ta6 is dentcal
for all three table types.
>C? SAP AG BC400 3#
5.32
SAP AG 2001
8e$inition o$ 4nternal Tables &ith lobal Types
2ine type and access
Eey
Eey de$inition
Eey category
Eey co%ponents
2ine type
8ata access type
SBC400F7CC
Standard table
Eey co%ponents
#on=uni5ue
CA--48
C7##48
F28AT9
SC!""/T/SC!""FOCC SC!""/T/SC!""FOCC
Table type Table type
DATA #ta,/+l#(&t#n+o TYPE s,$!""/t/s,$!""+o$$0 DATA DATA
"!abA-l"(h!"n-o
carr" sea!s*a2 conn" -la!e sea!socc $ercen!a(e
0able ty&es a) be 'e$i)e' l!ally i) a &r!5ram !r 5l!bally i) t*e ABAP Diti!)ary.
9!r DATA "#a)_name TYPE "#a)_#$pe y!u a) use local or global ty&es "#a)_#$pe.
9!r 'etaile' i)$!rmati!) !) t*e 'e$i)iti!) !$ 5l!bal table ty&es i) t*e ABAP Diti!)ary- re$er t! t*e
SAP 3ibrary u)'er Basis ABAP Workbench B"2ABAP Dictionary Types Table types.
>C? SAP AG BC400 3"
5.33
SAP AG 2001
8e$inition o$ 4nternal Tables &ith 2ocal Types
TYPES: tt/+l#(&t#n+o
TYPE 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 OF STANDARD TALE OF
"!abA-l"(h!"n-o
carr" sea!s*a2 conn" -la!e sea!socc $ercen!a(e
3ITH NON1UNI8UE @EY 3ITH NON1UNI8UE @EY
@!u a) als! 'e$i)e i)ter)al table ty&es l!ally usi)5 t*e TYPE stateme)t.
0*e table ty&e is s&ei$ie' bet%ee) TYPE a)' TABLE OF.
0*e li)e ty&e !mes a$ter TABLE OF.
0*e (ey $iel's are liste' a$ter t*e WIT0 a''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)5 l!al table ty&es- re$er t! t*e (ey%!r' '!ume)tati!)
!) TYPES.
@!u 'e$i)e t*e 'ata !bGet 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!%sE
DATA "#a)_name TYPE #a)&e_9"nd TALE OF ,#-._#$pe 3ITH 9e$_de!0
>C? SAP AG BC400 33
5.34
SAP AG 2001
7"er"ie&: Typing Structured 8ata 7b6ects
DATA .a TYPE sp+l#0
SELECT 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
SPFLI SPFLI
Transparent table Transparent table
,8escription.
SC!""FOCC SC!""FOCC
Structure Structure
SC!""FOCC SC!""FOCC
Structure Structure
SC!""/T/SC!""FOCC SC!""/T/SC!""FOCC
Table type Table type
AA +1 !!!
AA *4 !!!
!!! !!! !!!
2: 400 !!!
2: 402 !!!
AA +1 !!!
AA *4 !!!
!!! !!! !!!
2: 400 !!!
2: 402 !!!
SPF24
>C? SAP AG BC400 34
5.35
SAP AG 2001
7"er"ie&: Accessing Single -ecords
Append
4nsert
-ead
Change
8elete
APPEND .a TO #ta,0
INSERT .a INTO TALE #ta, K$on4#t#onL0
READ TALE #ta, INTO .a K$on4#t#onL0
MODIFY TALE #ta, FROM .a F K$on4#t#onL H0
DELETE #ta, K$on4#t#onL0
APPEND APPEND
INSERT INSERT
READ TALE READ TALE
MODIFY MODIFY
DELETE DELETE
0*e $!ll!%i)5 si)5le re!r' !&erati!)s are a+ailable $!r i)ter)al tablesE /) ea* ase .a
re&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. 0*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 is
a&&e)'e'- i) a s!rte' table it is i)serte' i) t*e ri5*t &lae- a)' i) a *as*e' table it is i)serte'
a!r'i)5 t! t*e *as* al5!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. 0*is stateme)t
may be use' !)ly $!r tables %*!se )!):(ey $iel's are all )umeri. 0*e )umeri
+alues are summariCe' $!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
5.36
SAP AG 2001
7"er"ie&: Processing Sets o$ -ecords
2oop: For all single
record operations
277P AT itab 4#T7 &a NconditionO!
9#8277P!!
DELETE #ta, K$on4#t#onL0
INSERT LINES OF #ta,D
K$on4#t#onDL
INTO #ta,< K$on4#t#on<L0
8elete
4nserting se"eral
lines $ro% another
internal table
LOOP LOOP
ENDLOOP ENDLOOP
DELETE DELETE
INSERT INSERT
Appending se"eral
lines $ro% another
internal table
INSERT LINES OF #ta,D
K$on4#t#on<L TO #ta,<0
APPEND APPEND
0*e $!ll!%i)5 set !&erati!)s are a+ailable $!r i)ter)al tablesE /) ea* ase .a re&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,.
LOOP 000 ENDLOOP
0*e LOOP &laes t*e li)es !$ a) i)ter)al table !)e by !)e i)t! t*e struture s&ei$ie' i) t*e
INTO lause. All si)5le re!r' !&erati!)s a) be e6eute' %it*i) t*e l!!&. /) t*is ase- $!r t*e
si)5le re!r' !&erati!)s- t*e system i'e)ti$ies t*e li)e t! be &r!esse'.
DELETE
Deletes t*e li)es !$ t*e i)ter)al table t*at satis$y t*e !)'iti!) K$on4#t#onL.
INSERT
C!&ies t*e !)te)ts !$ se+eral li)es !$ a) i)ter)al table t! a)!t*er i)ter)al table.
APPEND
A&&e)'s t*e !)te)ts !$ se+eral li)es !$ a) i)ter)al table t! a)!t*er sta)'ar' table.
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 36
5.37
SAP AG 2001
Synta' 9'a%ple: Filling 2ine by 2ine
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%Ma%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
"!abA-l"(h!"n-o
;aA-l"(h!"n-o
@!u a) i)sert li)es i)t! a) i)ter)al table by $irst $illi)5 a struture %it* t*e reBuire' +alues a)' t*e)
i)serti)5 it i)t! t*e i)ter)al table usi)5 t*e INSERT stateme)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)5 t! t*e (ey.
>C? SAP AG BC400 3A
5.38
SAP AG 2001
Synta' 9'a%ple: -eading Contents <sing a 2oop
LOOP AT #ta,/+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
.a/+l#(&t#n+o1+l4ate6
.a/+l#(&t#n+o1seatsma?6
.a/+l#(&t#n+o1seatso$$6
.a/+l#(&t#n+o1pe%$enta(e6
9N90
ENDLOOP0
2 4e+#ne #nte%nal ta,le an4 .o%Ma%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
"!abA-l"(h!"n-o
;aA-l"(h!"n-o
@!u a) rea' a)' &r!ess t*e !)te)ts !$ a) i)ter)al table usi)5 a LOOP by aessi)5 t*e struture
!m&!)e)t %it*i) t*e l!!&.
/) t*is e6am&le- t*e WRITE stateme)t is use' t! reate a list $r!m t*e $iel' !)te)ts.
/$ y!u %a)t t! *a)5e t*e !)te)ts !$ t*e i)ter)al table- $irst *a)5e t*e +alue !$ t*e !m&!)e)ts
%it*i) t*e l!!& a)' t*e) !+er%rite t*e li)e !$ t*e i)ter)al table usi)5 t*e MODIFY stateme)t.
>C? SAP AG BC400 38
5.39
SAP AG 2001
Synta' 9'a%ple: -eading <sing the 4nde'
LOOP AT #ta,/+l#(&t#n+o INTO .a/+l#(&t#n+o
FROM < TO O0
3RITE: * .a/+l#(&t#n+o1$a%%#46
.a/+l#(&t#n+o1$onn#46
.a/+l#(&t#n+o1+l4ate6
.a/+l#(&t#n+o1seatsma?6
.a/+l#(&t#n+o1seatso$$6
.a/+l#(&t#n+o1pe%$enta(e6
9N90
ENDLOOP0
FROM < TO O FROM < TO O
READ TALE #ta,/+l#(&t#n+o INTO .a/+l#(&t#n+o
INDEX B0
3RITE: * .a/+l#(&t#n+o1$a%%#46
.a/+l#(&t#n+o1$onn#46
.a/+l#(&t#n+o1+l4ate6
.a/+l#(&t#n+o1seatsma?6
.a/+l#(&t#n+o1seatso$$6
.a/+l#(&t#n+o1pe%$enta(e6
9N90
INDEX B INDEX B
@!u a) restrit aess t! ertai) li)e )umbers usi)5 t*e INDE: a''iti!). @!u may &er$!rm
i)'e6 !&erati!)s !) i)'e6 tables !)lyH t*ere$!re- t*ese !&erati!)s are su&&!rte' $!r sta)'ar'
a)' s!rte' tables !)ly.
/) t*e $irst e6am&le- t*e system ru)s t*r!u5* !)ly t*e $irst $i+e li)es i) t*e i)ter)al table.
/) t*e se!)' e6am&le- t*e system rea's t*e t*ir' li)e !$ t*e i)ter)al table
>C? SAP AG BC400 38
5.40
SAP AG 2001
Synta' 9'a%ple: -eading <sing the Eey
LOOP AT #ta,/+l#(&t#n+o INTO .a/+l#(&t#n+o
3HERE $a%%#4 7 9LH90
3RITE: * .a/+l#(&t#n+o1$a%%#46
.a/+l#(&t#n+o1$onn#46
.a/+l#(&t#n+o1+l4ate6
.a/+l#(&t#n+o1seatsma?6
.a/+l#(&t#n+o1seatso$$6
.a/+l#(&t#n+o1pe%$enta(e6
9N90
ENDLOOP0
3HERE $a%%#4 7 9LH9 3HERE $a%%#4 7 9LH9
READ TALE #ta,/+l#(&t#n+o INTO .a/+l#(&t#n+o
3ITH TALE @EY $a%%#4 7 9LH9
$onn#4 7 9"!""9
+l4ate 7 s'14at)m0
IF s'1s),%$ 7 "0
3RITE: * .a/+l#(&t#n+o1seatsma?6
.a/+l#(&t#n+o1seatso$$6
.a/+l#(&t#n+o1pe%$enta(e6
9N90
ENDIF0
3ITH TALE @EY $a%%#4 7 9LH9 3ITH TALE @EY $a%%#4 7 9LH9
$onn#4 7 9"!""9 $onn#4 7 9"!""9
+l4ate 7 s'14at)m +l4ate 7 s'14at)m
.it* t*e 3HERE a''iti!) y!u a) restrit aess t! li)es %it* ertai) +alues. Sey !&erati!)s are
su&&!rte' $!r all table knds.
.it* a !m&letely s&ei$ie' (ey- (ey aesses t! s!rte' a)' *as*e' tables are 5e)erally less
ru)time i)te)si+e t*a) (ey aesses t! sta)'ar' tables.
/) t*e $irst e6am&le- t*e system ru)s t*r!u5* !)ly t*!se li)es i) %*i* t*e .a"d $iel' *as
t*e +alue I3<I.
>Per$!rma)e as&etE 0*e s!rte' table is m!st suite' t! t*is ty&e !$ &r!essi)5.?
0*e se!)' e6am&le s*!%s t*e sy)ta6 $!r rea'i)5 a li)e i) t*e i)ter)al table %it* a $ully
s&ei$ie' (ey. 0*e retur) !'e ,$/,-). is set t! Cer! i$ a !rres&!)'i)5 li)e is i) t*e i)ter)al
table.
>Per$!rma)e as&etE 0*e *as*e' table is m!st suite' t! t*is ty&e !$ si)5le re!r' aess i$ t*e
)umber !$ !)tai)e' 'ata re!r's is +ery *i5*.?
.it* si)5le re!r' aesses usi)5 a (ey- y!u must $ill all (ey $iel's usi)5 t*e WIT0 TALE
KEY a''iti!). /$ y!u %a)t t! 'e$i)e y!ur seleti!) riteria usi)5 a)y $iel' +alues >)!t t*e e)tire
table (ey?- y!u must use t*e 3ITH @EY a''iti!).
>C? SAP AG BC400 40
5.41
SAP AG 2001
7perations on the Whole 4nternal Table
Sort
8elete the entire
content o$ the
internal table
SORT #ta, K$on4#t#onsL0
REFRESH #ta,0 REFRESH REFRESH
SORT SORT
0*e $!ll!%i)5 !&erati!)s a$$et t*e #hole i)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)5 !r
'ese)'i)5 !r'er. @!u may %a)t t! ta(e ulture:s&ei$i s!rt rules i)t! a!u)t.
REFRESH
0*is 'eletes t*e e)tire !)te)ts !$ a) i)ter)al table. A &art !$ t*e &re+i!usly use' %!r(i)5
mem!ry remai)s a+ailable $!r $uture i)serti!)s.
FREE
0*is 'eletes t*e e)tire !)te)ts !$ t*e i)ter)al table a)' releases t*e &re+i!usly use' %!r(i)5
mem!ry.
CLEAR
;)li(e all !t*er 'ata !bGets- t*is stateme)t *as t*e same e$$et as t*e REFRES0 stateme)t !)
i)ter)al tables %it* )! *ea'er li)e.
>C? SAP AG BC400 4#
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%Ma%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
"!abA-l"(h!"n-o
;aA-l"(h!"n-o
Y Y DESCENDING DESCENDING
#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)5 t*e !lum) )ame a$ter t*e Y
a''iti!) t! t*e SORT stateme)t.
SORT "#a) F ASCENDING G DESCENDING H
F Y !5 F ASCENDING G DESCENDING H
0%%
!n F ASCENDING G DESCENDING H H
F AS TEXT H
F STALE H0
S!rti)5 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)5 !r'er.
/$ y!u use t*e AS TEXT a''iti!)- t*e system %ill- %*ile s!rti)5 by *arater:ty&e $iel's- ta(e
t*e ulture:s&ei$i s!rt rule i)t! a!u)t.
+nly i$ y!u use t*e STALE a''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)5 s!rti)5.
/) t*is e6am&le- t*e 'ata re!r's !$ t*e i)ter)al table are s!rte' i) 'ese)'i)5 !r'er by t*e
&ere)ta5e !u&a)y !$ $li5*ts.
9!r m!re 'etails- re$er t! t*e (ey%!r' '!ume)tati!) $!r SORT.
>C? SAP AG BC400 4"
5.43
SAP AG 2001
4nternal Tables in 8ebugging (ode
Dar"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"2e $o"n! ar"!h*e!"c
1% 30 9







E
SAP
Wa!ch$o"n!
ABAP 'e"&**er


chws chws
,able
SC9S3BR# 0
itC$lightin$o
8ouble=click the
data ob6ect
+
2
3
4
)
*
1
H
AA
AA
AA
AA
2:
2:
2:
2:
4nternal table
itC$lightin$o Type STA#8A-8
CA--48
00+1
00+1
00+1
00+1
0400
0400
0400
0400
C7##48
20000)+2
20000124
20000H2H
2000+224
20000*2*
200001+)
2000+++3
2000+2+2
F28AT9
!!!
!!!
!!!
!!!
!!!
!!!
!!!
!!!
!!!
**
+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)5 t*e )ame i) t*e le$t !lum). 0! see t*e
table 'is&lay- '!uble:li( t*is e)try.
>C? SAP AG BC400 43
5.44
SAP AG 2001
Co%parison: 4nternal Tables &ith>&ithout :eader 2ines
4nternal table
Work area
INSERT .a INTO #ta, INDEX n0
DELETE TALE #ta, FROM .a0
READ TALE #ta, INTO .a INDEX n0
3RITE .a1$a%%#40
INSERT #ta, INDEX n0
DELETE TALE #ta,0
READ TALE #ta, INDEX n0
3RITE #ta,1$a%%#40
4%plicit synta': 9'plicit synta':
itab itab
&a &a
4nternal table
:eader
itab itab
itab itab
INTO INTO
FROM FROM
INTO INTO
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 LINE0 3ITH HEADER LINE 3ITH HEADER LINE
@!u a) 'e$i)e i)ter)al tables %it* !r %it*!ut a *ea'er li)e >3ITH HEADER LINE a''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* !bGets are a''resse' #th the same name. <!% t*is )ame is i)ter&rete' 'e&e)'s
!) t*e !)te6t. 9!r e6am&le- %it* MO*E t*e )ame re$ers t! t*e *ea'er li)e- %*ile %it* SEARC0
it is i)ter&rete' as t*e table b!'y.
0! a+!i' !)$usi!)- use nternal tables #thout header lnes. 0*is is es&eially a&&are)t i) t*e
ase !$ )este' tables.@!u a) !$te) use a s*!rte)e' sy)ta6 >APPEND8 INSERT8 MODIFY8
COLLECT8 DELETE8 READ8 LOOP AT? $!r ertai) !&erati!)s !) i)ter)al tables %it*
*ea'er li)e. .it*i) ABAP !bGets- y!u a) )!% !)ly use i)ter)al tables %it*!ut a *ea'er.
@!u a) al%ays u)iBuely a''ress t*e b!'y !$ a) i)ter)al table "#a) by usi)5 t*e sy)ta6
"#a)FH. 0*is is true re5ar'less !$ %*et*er t*e i)ter)al table *as a *ea'er !r )!t.
("ample:
DATA #ta,< TYPE TALE OF # 3ITH HEADER LINE0
DATA #ta,D LI@E #ta,<0
#ta,< 7 #ta,D0 ; !)ly t*e *ea'ers are !&ie'
#ta,<FH 7 #ta,DFH0 ; t*e atual table !)te)t is !&ie'
>C? SAP AG BC400 44
5.45
SAP AG 2001
8e$ine ele%entary and structured data ob6ects
<se basic ABAP state%ents
9'ecute and analy;e progra%s in debugging
%ode
Aou are no& able to:
Basic ABAP 2anguage 9le%ents: <nit Su%%ary
>C? SAP AG BC400 45
5.46ABAP +an*&a*e E%e)ents E$ercises
1nt: Basc ABAP 4anguage (lements
Topc: Basc ABAP 0tatements
At t*e !)lusi!) !$ t*ese e6erises- y!u %ill be able t!E
De$i)e eleme)tary 'ata !bGets
Assi5) +alues
/m&leme)t !)'iti!)al bra)*i)5
Per$!rm alulati!)s
Create a) ABAP &r!5ram $!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!5ramE =C!""/>>/COMPUTE
M!'el s!luti!)E SAPBC400TSS_COMP+TE
## sta)'s $!r t*e t%!:'i5it 5r!u& )umber.
#:# Create t*e e6eutable &r!5ram =C!""/>>/COMPUTE
#thout D0OP /)lu'eD.
#:" De$i)e t*e i)&ut &arameters $!r t%! i)te5ers >)ame su55esti!)E pa/#nt<-
pa/#ntD? a)' a) arit*meti !&erat!r >)ame su55esti!)E pa/op?. A''iti!)ally-
'e$i)e a) eleme)tary 'ata !bGet $!r t*e result ty&eE &a(e' )umber %it* t%!
'eimal &laes >)ame su55esti!)E %es)lt?.
#:3 16eute t*e alulati!) i) !))eti!) %it* t*e s&ei$ie' arit*meti !&erat!r.
;se t*e CASE stateme)t t! '! t*is.
#:4 Dis&lay t*e result i) a list.
#:5 /$ t*e user *as s&ei$ie' a) i)+ali' arit*meti !&erat!r !) t*e seleti!) sree)- %rite
a) a&&r!&riate stateme)t !) t*e list sree)..
;se t*e IF stateme)t t! '! t*is.
>C? SAP AG BC400 46
#:6 /$ t*e user tries t! 'i+i'e by Cer!- '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)5 %it* a m!re ele5a)t user 'ial!5.
>C? SAP AG BC400 4A
("ercses
1nt: Basc ABAP 4anguage (lements
Topc: Workng #th 0tructures
At t*e !)lusi!) !$ t*ese e6erises- y!u %ill be able t!E
;se t*e Debu55er t! trae t*e 'ata $l!% a)' u)'ersta)' t*e
!))eti!)s bet%ee) &r!essi)5 bl!(s.
;se t*e MO;E1CORRESPONDING stateme)t t! assi5) +alues bet%ee)
strutures.
@!u *a+e t! e6ami)e a s&ei$ie' ABAP &r!5ram t! asertai) %*e) a)'
*!% ertai) 'ata is tra)s&!rte' bet%ee) ertai) struture' 'ata !bGets.
Pr!5ramE SAPBC400WBS_GETTING_STARTED
":# Start t*e &r!5ram 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) e6eute t*e
&r!5ram. @!u are )!% i) 'ebu55i)5 m!'e.
":" Ma(e sure t*at all !$ t*e 'ata !bGets are i)itial. 0ra)s$er all !$ t*e 'ata !bGets
'e$i)e' i) t*e &r!5ram 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!u5* t*e &r!5ram- !)e stateme)t at a time- by *!!si)5 &in'le step >95?.
.*i* $iel's !$ t*e struture ;a_,.a '!es t*e SELECT stateme)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_,.a t! t*e struture
,).400_.a"e. .*i* $iel' +alues are !&ie'K
":5 0*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!5ram. N!% !bser+e *!% $iel's are !&ie' $r!m t*e struture
,).400_.a"e t! t*e struture ;a_,.a.
":6 9i)ally- !bser+e *!% t*e WRITE stateme)t !)struts t*e list.
>C? SAP AG BC400 48
A$ter t*e $irst WRITE stateme)t- a) e6tra 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.
":A Restart t*e &r!5ram i) Debu55i)5 m!'e. Set a brea(&!i)t at t*e MO*E/
CORRESPONDING stateme)t. Be$!re t*e sree) is &r!esse'- assi5) a )ame t! t*e
struture !m&!)e)t ,).400_.a"e/-name i) t*e Debu55er.
0*e butt!) use' t! *a)5e t*e $iel' +alues at ru)time is )e6t t! t*e
i)&ut/!ut&ut $iel'.
":8 Re&eat ste& ":#. N!% set a brea(&!i)t at t*e CALL SCREEN stateme)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)5es. C*!!se "ontin$e >98? t! !)ti)ue t*e
&r!5ram a)' *e( %*y t*e 'ebu55i)5 !$ t*e &r!5ram is st!&&e' i) ea* ase.
>C? SAP AG BC400 48
("ercses
1nt: Basc ABAP 4anguage (lements
Topc: Workng #th 2nternal Tables
At t*e !)lusi!) !$ t*ese e6erises- 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 5l!bal table (i)'
9ill i)ter)al tables usi)5 array $et*
Pr!ess t*e !)te)t !$ i)ter)al tables usi)5 a l!!&.
Create a) ABAP &r!5ram t*at lists a''iti!)al i)$!rmati!) !) all e6isti)5
$li5*t 'e&arture times.
Get t*e 'ata $r!m t*e 'atabase table SPFLI.
Pr!5ramE =C!""/>>/ITA/LOOP
M!'el s!luti!)E SAPBC400TSS_ITAB_LOOP
## sta)'s $!r t*e t%!:'i5it 5r!u& )umber.
3:# Create t*e e6eutable &r!5ram =C!""/>>/ITA/LOOP
#thout D0OP:/)lu'eD.
3:" Bu$$er t*e 'ata $r!m t*e 'atabase table SPFLI i) 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! list i) t*e ABAP 1'it!r.?
3:3 De$i)e a) i)ter)al table >)ame su55esti!)E #t/sp+l#? base' !) !)e !$ t*e 5l!bal
table 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 su55esti!)E
.a/sp+l#?.
3:5 Pr!5ram a) array $et* aess t! all t*e 'ata re!r's i) t*e 'atabase table SPFLIE
SELECT 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
;se t*e LOOP stateme)t t! '! t*is.
>C? SAP AG BC400 5#
5.47ABAP +an*&a*e E%e)ents So%&tions
1nt: Basc ABAP 4anguage (lements
Topc: Basc ABAP 0tatements
# )odel soluton:
REPORT sap,$!""tss/$omp)te0
PARAMETERS:
pa/#nt< TYPE #6
pa/opA<C TYPE $6
pa/#ntD TYPE #0
DATA %es)lt TYPE p DECIMALS D0
IF NOT A pa/op 7 9J9 OR
pa/op 7 919 OR
pa/op 7 929 OR
pa/op 7 9*9 C0
3RITE: 9Inval#4 ope%ato%:9A#opC0
ELSEIF pa/op 7 9*9 AND pa/#ntD 7 "0
3RITE: 9D#v#s#on ,' Pe%o:9A4,PC0
ELSE0
CASE pa/op0
3HEN 9J90
%es)lt 7 pa/#nt< J pa/#ntD0
3HEN 9190
%es)lt 7 pa/#nt< 1 pa/#ntD0
3HEN 9290
%es)lt 7 pa/#nt< 2 pa/#ntD0
3HEN 9*90
%es)lt 7 pa/#nt< * pa/#ntD0
ENDCASE0
3RITE: 9Res)lt:9A%esC6 %es)lt0
ENDIF0
>C? SAP AG BC400 5"
0olutons
1nt: Basc ABAP 4anguage (lements
Topc: Workng #th 0tructures
":3 .*i* !m&!)e)ts are $ille' by t*e SELECT stateme)t CK
man4t- $a%%#4- $a%%name- $)%%$o4e- )%l.
.*at is t*e +alue !$ t*e system $iel' ,$/,-). a$ter t*e SELECT stateme)tK
Beause t*ere is a 'ata re!r' $!r t*e airli)e 46 >3u$t*a)sa? i) t*e 'atabase table
SCARR- s'1s),%$ is set t! Cer!.
":4 .*i* $iel' +alues are !&ie'K
man4t- $a%%#4- $a%%name- $)%%$o4e.
>C? SAP AG BC400 53
0olutons
1nt: Basc ABAP 4anguage (lements
Topc: Workng #th 2nternal Tables
3 )odel soluton:
REPORT sap,$!""tss/#ta,/loop0
DATA: #t/sp+l# TYPE s,$!""/t/sp+l#0
DATA: .a/sp+l# TYPE sp+l#0
SELECT 2 FROM sp+l# INTO TALE #t/sp+l#0
< a# &ea,# one da#a,e# ,e&e.#ed
IF s'1s),%$ 7 "0
< mo4e ea.( ,"n'&e da#a,e# !om "n#ena& #a)&e #o
< ,#-.#-e WA_SPFLI "n ode #o ;"#e da#a 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
ENDLOOP0
ENDIF0
>C? SAP AG BC400 54
*
SAP AG 2001
8ata -etrie"al $or 8atabase Tables
Fuerying the 8atabase
-eading 8atabase Tables
Authori;ation Checks
Pre"ie&
Contents:
8ata -etrie"al
>C? SAP AG BC400 #
6.2
SAP AG 2001
2ist "arious &ays o$ $inding database tables
Progra% read access to speci$ic colu%ns and
lines &ithin a particular database table
4%ple%ent authori;ation checks
2ist the read access options $or %ultiple database
tables
At the conclusion o$ this unit0 you &ill be able to:
8ata -etrie"al: <nit 7b6ecti"es
>C? SAP AG BC400 "
6.3
SAP AG 2001


ABAP
Processing
block
ABAP runti%e syste%
ABAP progra%
Fuerying the 8atabase
8ata ob6ects
&aCscarr
8atabase
inter$ace
S929CT !!!
scarr
8atabase 8atabase SF2 SF2
8atabase 8atabase= =
speci$ic speci$ic
con"ersion con"ersion
paCcar
SCA--
SELECT SELECT
FROM FROM
7pen 7pen SF2 SF2
8atabase
table
+pen 0<4 stateme)ts are a subset !$ 0tandard 0<4 t*at is $ully i)te5rate' i) t*e ABAP
la)5ua5e. >S43 sta)'s $!r sta)'ar' Buery la)5ua5e.?
O&e) S43 stateme)ts all!% y!u t! aess t*e 'atabase i) a u)i$!rm %ay $r!m y!ur &r!5rams-
re5ar'less !$ t*e 'atabase system i)stalle'. 0*e 'atabase i)ter$ae !)+erts O&e) S43
stateme)ts t! 'atabase:s&ei$i S43 stateme)ts.
>C? SAP AG BC400 3
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 S929CT state%ent
Change to debugging %ode during progra% e'ecution and
set breakpoint in the S929CT state%ent
4$ the progra% trans%its a screen0 display the structure $ield
using F+ and technical in$or%ation or na"igate directly to the
data ele%ent ,double=click.0 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!) <ierar*y !r t*e Re&!sit!ry /)$!rmati!)
System)
/$ y!u *a+e t*e )ame !$ a &r!5ram t*at aesses t*e 'atabase table y!u are sear*i)5 $!rE
3ebugger:
Start t*is &r!5ram i) 'ebu55i)5 m!'e a)' set a breakpont at t*e SELECT statement.
ABAP (dtor:
Sear* $!r t*e SELECT stateme)t i) t*e s!ure te6t.
/$ y!u ()!% a &r!5ram t*at !)tai)s a sree) %it* i)&ut $iel's !))ete' t! t*e table y!u are
l!!(i)5 $!r- *!!se ,4 Technical info. D!uble:li( t*e te*)ial )ame !$ t*e sree) $iel' t!
5! t! t*e ABAP Diti!)ary. 0*is is !$te) a struture $iel'. D!uble:li( t*e data element a)'
t*e) use t*e %*ere:use' list t! sear* $!r tra)s&are)t tables %it* t*e $iel' ty&e
>C? SAP AG BC400 4
6.5
SAP AG 2001
-eading 8atabase Tables
-eading 8atabase Tables
-eading 8atabase Tables
Authori;ation Checks
Authori;ation Checks
Pre"ie&
Pre"ie&
>C? SAP AG BC400 5
6.6
SAP AG 2001
Which colu%ns@
Which table,s.@
Whereto Whereto@ @
Which lines@
S929CT NresultO F-7( NtableO
4#T7 NtargetO
W:9-9 NconditionO
Particular
colu%n
I
(ultiple lines
R
Single line
Progra%%ing 8atabase -ead Access
0! &r!5ram 'atabase rea' aess- use t*e O&e) S43 stateme)t SELECT.
0*e SELECT stateme)t !)tai)s a series !$ lauses- ea* !$ %*i* *as a 'i$$ere)t tas(E
0*e SELECT lause 'esribes- am!)5 !t*er t*i)5s- %*et*er t*e result !$ t*e seleti!)
%ill be se+eral li)es !r a si)5le 'ata re!r' a)' %*i* $iel's !$ t*e table are t! be rea'.
0*e FROM lause )ames t*e s!ure >'atabase table !r +ie%? $r!m %*i* t*e 'ata is t!
be selete'.
0*e INTO lause 'etermi)es t*e i)ter)al 'ata !bGets i)t! %*i* t*e selete' 'ata is t!
be &lae'.
0*e 3HERE lause s&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
6.7
SAP AG 2001
-eading by Single -ecord Access


paCcar
SELECT SINGLE 2
FROM s$a%%
INTO .a/s$a%%
3HERE $a%%#4 7 pa/$a%0
IF s'1s),%$ 7 "0
000
SINGLE SINGLE
8atabase
inter$ace
&aCscarr
INTO INTO
3HERE 3HERE
SCA--
8atabase
table
0*e SELECT SINGLE= stateme)t all!%s y!u t! rea' a sngle record $r!m t*e 'atabase table.
0! e)sure t*at y!u rea' a u)iBue e)try- all !$ t*e (ey $iel's must be $ille' by t*e 3HERE lause.
0*e asteris( J a$ter S/NG31 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 reBuire' $iel's
i)stea'.
/) t*e INTO lause- e)ter t*e 'esti)ati!) %*ere t*e 'atabase i)ter$ae is t! !&y t*e 'ata. 0*e
tar5et area s*!ul' be struture' le$t Gusti$ie' Gust li(e t*e reBuire' !lum)s !$ t*e 'atabase table.
/$ y!u use t*e CORRESPONDING FIELDS OF a''iti!) i) t*e INTO lause- y!u a) $ill t*e
tar5et area !m&!)e)t by !m&!)e)t. 0*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*e
system $ills t*e tar5et area le$t Gusti$ie'- irres&eti+e !$ its struture.
/$ t*e system $i)'s a table e)try mat*i)5 y!ur !)'iti!)s- SY/S+BRC *as t*e +alue Cer! >0?.
0*e SINGLE a''iti!) tells t*e 'atabase t*at !)ly !)e li)e )ee's t! be rea'. 0*e 'atabase a)
t*e) termi)ate t*e sear* as s!!) as it *as $!u)' t*at li)e. 0*ere$!re- SELECT SINGLE
&r!'ues better &er$!rma)e $!r si)5le:re!r' aess t*a) a SELECT l!!& i$ y!u su&&ly +alues
$!r all (ey $iel's
>C? SAP AG BC400 A
6.8
SAP AG 2001
-eading Se"eral 2ines <sing a 2oop


paCcar
&aCsbc400$occ
8atabase
inter$ace
SELECT $a%%#4 $onn#4 +l4ate
seatso$$ seatsma?
FROM s+l#(&t
INTO .a/s,$!""+o$$
3HERE $a%%#4 7 pa/$a%0
ENDSELECT0
IF s'1s),%$ 7 "0
000
ENDSELECT ENDSELECT
SELECT SELECT
State%ents $or e"ery record read
SF24:T
8atabase
table
/$ y!u '! )!t use t*e a''iti!) SINGLE %it* t*e SELECT stateme)t- t*e system rea's multi&le
re!r's $r!m t*e 'atabase. 0*e $iel' list 'etermi)es t*e columns %*!se 'ata is t! be rea' $r!m
t*e 'atabase.
0*e )umber !$ reBueste' lnes t! be rea' a) be restrite' usi)5 t*e 3HERE lause.
/) t*e W0ERE lause y!u may e)ter only t*e feld names !$ t*e 'atabase table. 0*e )ame !$ t*e
'atabase table y!u %a)t t! aess is $!u)' i) t*e FROM lause.
Multi&le l!5ial !)'iti!)s a) be a''e' t! t*e W0ERE lause usi)5 AND9 NOT !r OR
stateme)ts.
0*e 'atabase 'eli+ers 'ata t! t*e 'atabase i)ter$ae i) &a(a5es. 0*e ABAP ru)time system
!&ies t*e 'ata re!r's t! t*e tar5et area li)e by li)e usi)5 a l!!&. /t als! e)ables seBue)tial
&r!essi)5 !$ all t*e stateme)ts bet%ee) SELECT a)' ENDSELECT.
A$ter t*e ENDSELECT stateme)t- y!u a) *e( t*e retur) !'e $!r t*e SELECT l!!&. sy-
subrc %ill *a+e t*e +alue Cer! >0? i$ t*e 'atabase i)ter$ae *as $!u)' at least !)e re!r'.
A$ter t*e ENDSELECT stateme)t- s'14,$nt !)tai)s t*e t!tal )umber !$ li)es rea'.
>C? SAP AG BC400 8
6.9
SAP AG 2001
-eading Se"eral 2ines <sing an Array Fetch
paCcar
itabC$occ
8atabase
inter$ace
SELECT $a%%#4 $onn#4 +l4ate
seatsma? seatso$$
FROM s+l#(&t
INTO TALE #ta,/+o$$
3HERE $a%%#4 7 pa/$a%0
IF s'1s),%$ 7 "0
000
TALE TALE


SF24:T
8atabase
table
0*e a''iti!) INTO TALE #ta, auses t*e ABAP ru)time system t! !&y t*e !)te)ts !$ t*e
'atabase i)ter$ae 'iretly t! t*e i)ter)al table #ta,. 0*is is alle' a) array fetch%
Si)e t*e array $et* is )!t e6eute' as a l!!&- '! )!t &r!5ram a)y ENDSELECT stateme)t.
/$ y!u %a)t t! a'' li)es t! t*e e)' !$ a) i)ter)al table t*at is alrea'y $ille'- i)stea' !$ !+er%riti)5 it-
use t*e APPENDING TALE #ta, a''iti!).
s'1s),%$ *as t*e +alue 0 i$ t*e system %as able t! rea' at least !)e re!r'.
>C? SAP AG BC400 8
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
4#T7 Clause: Target Structure Suitable $or
Field 2ist
Sa%e type as
colu%n read
INTO INTO .a .a/s,$!""+o$$ /s,$!""+o$$
$a%%#4 $onn#4 +l4ate seatsma? seatso$$ $a%%#4 $onn#4 +l4ate seatsma? seatso$$
&aCsbc400$occ
0*e &r!5ram must !)tai) a 'ata !bGet %it* a suitable ty&e $!r ea* !lum) t*at is reBuire'
$r!m a 'atabase table. 9!r &r!5ram mai)te)a)e reas!)s- y!u must use t*e !rres&!)'i)5
Diti!)ary !bGets t! assi5) ty&es t! t*e 'ata !bGets. 0*e INTO lause s&ei$ies t*e 'ata !bGet
i)t! %*i* y!u %a)t t! &lae t*e 'ata $r!m t*e 'atabase table. @!u a) use t*e INTO lause i)
t%! 'i$$ere)t %aysE
1sng a flat structure R @!u 'e$i)e a struture i) y!ur &r!5ram t*at *as t*e same $iel's i) t*e
same seBue)e as t*e $iel' list i) t*e SELECT lause. @!u a) e)ter t*e )ame !$ t*e struture i)
t*e INTO lause. 0*e !)te)ts are !&ie' le$t Gusti$ie'. 0*e $iel' )ames !$ t*e struture are
'isre5ar'e' *ere.
1sng nd$dual data ob,ects R@!u a) e)ter a set !$ 'ata !bGets i) t*e INTO lause. 9!r
e6am&leE
DATA= 'd_.a"d TYPE ,!&"'(#/.a"d8
'd_.onn"d TYPE ,!&"'(#/.onn"d8
'd_!&da#e TYPE ,!&"'(#/!&da#e8
'd_,ea#,ma1 TYPE ,!&"'(#/,ea#,ma18
'd_,ea#,o.. TYPE ,!&"'(#/,ea#,o..%
START/OF/SELECTION%
SELECT .a"d .onn"d !&da#e ,ea#,ma1 ,ea#,o..
FROM ,!&"'(#
INTO A(4/$a%%#46 (4/$onn#46 (4/+l4ate6 (4/seatsma?6
(4/seatso$$C
W0ERE %%%
>C? SAP AG BC400 #0
6.11
SAP AG 2001
4#T7 Clause: Sa%e=#a%e Fields o$ Field 2ist in the
Target Structure
ABAP progra%
DATA .a/s4'n/$onn TYPE s4'n/$onn0
SELECT SINGLE $a%%#4 $onn#4 4ept#me
FROM sp+l#
INTO CORRESPONDING FIELDS OF .a/s4'n/$onn
3HERE $a%%#4 7 pa/$a%
AND $onn#4 7 pa/$on0
(A#8T CA--48 C7##48 !!! 89PT4(9
%andt carrid connid !!! depti%e
INTO CORRESPONDING FIELDS OF INTO CORRESPONDING FIELDS OF .a .a/ /s4'n s4'n/ /$onn $onn
$a%%#4 $onn#4 4ept#me $a%%#4 $onn#4 4ept#me
Sa%e type as
colu%n read
/$ y!u use t*e INTO CORRESPONDING FIELDS lause- t*e 'ata is &lae' i) t*e $iel's %it* t*e
same )ame i) t*e tar5et struture.
A'+a)ta5es !$ t*is !)struti!)E
0*e tar5et struture '!es )!t *a+e t! be struture' le$t Gusti$ie' i) t*e i'e)tial %ay as t*e $iel' list.
0*is !)struti!) is easy t! mai)tai)- beause e6te)'i)5 t*e $iel' list '!es )!t reBuire !t*er
*a)5es t! t*e &r!5ram- as l!)5 as t*ere is a $iel' i) t*e tar5et struture t*at *as t*e same )ame
a)' ty&e.
0! &lae 'ata i) i)ter)al table !lum)s !$ t*e same )ame usi)5 a) array $et*- use t*e INTO
CORRESPONDING FIELDS OF TALE #ta, stateme)t.
>C? SAP AG BC400 ##
6.12
SAP AG 2001
Selecting 8ata Fro% Client=Speci$ic Tables
#ARR0D #0,CFR8'
AA
AA
...
...
AA
AA
...
...
AA
AA

?4W C8R>
FRA?>F3R,
...
...
?4W C8R>
FRA?>F3R,
...
...
?4W C8R>
FRA?>F3R,
Transparent table SPF24
#8??0D
001<
0064
...
...
001<
0064
...
...
001<
0064

'A?D,
400
400
...
...
401
401
...
...
402
402

SELECT 2 FROM sp+l#
INTO 000
3HERE $a%%#4 7 9AA90
000
ENDSELECT0
SELECT 2 FROM sp+l#
CLIENT SPECIFIED
INTO 000
3HERE man4t IN A!"<6 !"DC
AND $a%%#4 E8 9AA90
000
ENDSELECT0
2ogged on in client 400:
CLIENT SPECIFIED CLIENT SPECIFIED
man4t man4t
.it* lie)t:s&ei$i 'atabase tables- t*e $irst (ey%!r' must al%ays be MAND0 !r lie)t >'ata ty&e
C3N0?.
/$ y!u selet 'ata $r!m lie)t:s&ei$i tables- t*e system al#ays rea's t*e 'ata re!r's !$ t*e logon
clent- u)less !t*er%ise s&ei$ie'. >0*e ABAP ru)time system aut!matially !)+erts t*e SELECT
stateme)t.?
/$ y!u %is* t! e6&liitly i)lu'e t*e lie)t $iel' i) t*e W0ERE lause- y!u must set t*e CLIENT
SPECIFIED a''iti!) a$ter t*e FROM lause.
Si)e t*is s&eial ase is )!t rele+a)t $!r t*is !urse- t*e lie)t $iel' is 5e)erally !mitte' $r!m t*e
5ra&*is.
>C? SAP AG BC400 #"
6.13
SAP AG 2001
#ARR0D #0,CFR8' #0,C,8
AA
AA
...
...
/B
/B
...
...
3A
3A
...
?4W C8R>
FRA?>F3R,
...
...
FRA?>F3R,
FRA?>F3R,
...
...
FRA?>F3R,
SA? FRA?#0S#8
...
Transparent table SPF24
Per$or%ance: Secondary 4nde'
#8??0D
001<
0064
...
...
0400
0402
...
...
0941
3%04
...
SA? FRA?#0S#8
?4W C8R>
...
...
?4W C8R>
?4W C8R>
...
...
SA? FRA?#0S#8
FRA?>F3R,
...
000
SELECT 2 FROM sp+l#
INTO 000
3HERE $#t'+%om 7 9FRAN@FURT90
000
#0,CFR8'
Secondary inde'
B4R/0?
B4R/0?
...
FRA?>F3R,
FRA?>F3R,
FRA?>F3R,
FRA?>F3R,
...
?4W C8R>
?4W C8R>
...
.*e) y!u 5! t! t*e 'e$i)iti!) !$ a 'atabase table i) t*e ABAP Diti!)ary- y!u %ill see
i)$!rmati!) !) all t*e te*)ial attributes !$ t*e 'atabase table.
0*e $!ll!%i)5 i)$!rmati!) is use$ul $!r im&r!+i)5 t*e &er$!rma)e !$ 'atabase aessesE
:ey felds R /$ t*e li)es reBueste' $r!m t*e 'atabase are retrie+e' a!r'i)5 t! (ey $iel's- t*e
Database O&timiCer a) &er$!rm aess usi)5 a &rimary i)'e6.
0econdary nde" R /$ t*e li)es reBueste' $r!m t*e 'atabase are retrie+e' a!r'i)5 t! $iel's- t*e
Database O&timiCer a) &er$!rm aess usi)5 a se!)'ary i)'e6. Se!)'ary i)'e6es are
'is&laye' i) a 'ial!5 b!6 %*e)e+er y!u selet In!e1es. @!u *!!se a) i)'e6 $r!m t*e 'ial!5
b!6 by '!uble:li(i)5 it. 0*e system t*e) 'is&lays a sree) %it* a''iti!)al i)$!rmati!) ab!ut
t*at i)'e6.
>C? SAP AG BC400 #3
6.14
SAP AG 2001
Authori;ation Checks
-eading 8atabase Tables
-eading 8atabase Tables
Authori;ation Checks
Authori;ation Checks
Pre"ie&
Pre"ie&
>C? SAP AG BC400 #4
6.15
SAP AG 2001
Authori;ation Checks in ABAP Progra%s


AUTHORITY
CHEC@
,es
-o
SELECT
<ser %aster
records
BC400=00
Pro$ile +
Pro$ile 2
Pro$ile SCCA--48
Pro$ile 4
Authori;ation $or
authori;ation
ob6ect SCCA--48
Authori;ation $or
authori;ation
ob6ect SCCA--48
Authori;ation $or
authori;ation
ob6ect SCTC789
SY1SURC
7 "
Q
Selection
screen
#ote
@!u s*!ul' &r!5ram a) aut*!riCati!) *e( be$!re aessi)5 t*e 'atabase. 0*e AUTHORITY1
CHEC@ stateme)t $irst *e(s %*et*er t*e user *as t*e aut*!riCati!) !)tai)i)5 all t*e reBuire'
+alues. A$ter t*e aut*!riCati!) *e( is !m&lete'- *e( t*e retur) !'e. /$ it is 0- t*e user *as
t*e reBuire' aut*!riCati!) a)' t*e &r!5ram a) be !)ti)ue'. /$ t*e +alue is )!t 0- t*e user '!es
)!t *a+e t*e reBuire' aut*!riCati!) a)' y!u s*!ul' issue a) a&&r!&riate messa5e.
3ater i) t*is !urse- y!u %ill lear) *!% t! ma(e $iel's !) t*e seleti!) sree) rea'y $!r i)&ut
a5ai) i$ y!u &er$!rm t*e aut*!riCati!) *e( ri5*t a$ter t*e seleti!) sree) a)' *!% t! se)' a
messa5e i$ t*e user '!es )!t *a+e t*e reBuire' aut*!riCati!)
>C? SAP AG BC400 #5
6.16
SAP AG 2001
Authori;ation 7b6ects and Authori;ations
S8isplayS authori;ation
$or ob6ect SCCA--48
2
"B
SChangeS authori;ation
$or ob6ect SCCA--48
LH
"D
7b6ect SCCA--48
CA--48 ,Airline.
ACT?T ,Acti"ity.
Acti"ities:
Create
Change
8isplay
P 0+
P 02
P 03
All 'ata i) t*e SAP system must be &r!tete' $r!m u)aut*!riCe' aess by users %*! '! )!t
e6&liitly *a+e &ermissi!) t! aess it.
0*e system a'mi)istrat!r assi5)s user aut*!riCati!)s %*e) mai)tai)i)5 user master 'ata. Duri)5 t*is
&r!ess- y!u s*!ul' 'etermi)e e6atly #hch data users are all!%e' t! aess a)' #hat knd of
access s*!ul' be all!%e'. 9!r e6am&le- y!u mi5*t %a)t t! all!% users t! 'is&lay 'ata $!r all airli)es-
but all!% t*em t! *a)5e 'ata $!r !)ly ertai) !)es. /) t*is ase- t*e system must l!!( $!r a
!mbi)ati!) !$ t*e ati+ity >AC070? a)' airli)e arrier >CARR/D? $iel's ea* time it &er$!rms a)
aut*!riCati!) *e(. B!t* $iel's must be $ille' %it* +alues 'uri)5 aut*!riCati!) reati!) as %ell >i)
t*is e6am&le- ati+ity "han'e a)' airli)e arrier +* !r ati+ity Display a)' airli)e arrier J?. @!u
a) e)sure t*is by reati)5 a) author/aton ob,ect !m&!se' !$ t*e AC070 a)' CARR/D $iel's
t*at must be aesse' b!t* 'uri)5 t*e aut*!riCati!) assi5)me)t &r!ess a)' %*e)e+er y!ur &r!5ram
&er$!rms a) aut*!riCati!) *e(.
Aut*!riCati!) !bGets sim&ly 'e$i)e t*e !mbi)ati!) !$ $iel's t*at )ee' t! be a''resse'
simulta)e!usly a)' ser+e as tem&lates $!r b!t* aut*!riCati!)s a)' aut*!riCati!) *e(s. 0*ey are
!r5a)iCe' i)t! !bGet lasses t! ma(e it easier t! $i)' a)' ma)a5e t*em. O)e !r m!re !bGet lasses
may be assi5)e' t! ea* a&&liati!).
>C? SAP AG BC400 #6
6.17
SAP AG 2001
Synta': Authori;ation Check
-eport
results
0+
02
03
AA AD 82 2: <A
' ' ' ' '
ACT?T
CA--48
Authori;ations
$or ob6ect SCCA--48
AUTHORITY/CHEC@ AUTHORITY/CHEC@
ORECT 9S/CARRID9 ORECT 9S/CARRID9
ID 9CARRID9 FIELD 9LH9 ID 9CARRID9 FIELD 9LH9
ID 9ACT;T9 FIELD 9"D90 ID 9ACT;T9 FIELD 9"D90
Check
'
4F 4F sy sy= =subrc subrc #9 0! #9 0!
ENDIF0 ENDIF0
Conte't=dependent reaction to %issing authori;ation
.*e) y!u *e( aut*!riCati!)s i) &r!5rams- y!u s&ei$y t*e !bGet a)' +alues t*e user )ee's i)
a &artiular aut*!riCati!) t! be able t! aess t*e !bGet i) Buesti!).
/) t*e ab!+e e6am&le- t*ere is a *e( t! 'etermi)e %*et*er t*e user *as aut*!riCati!) $!r t*e
!bGet 0>CA%%239 %*i* *as t*e +alue !46! i) t*e CARR/D $iel' a)' t*e +alue !0?! >*a)5e?
i) t*e AC070 $iel'. 0*e abbre+iati!)s $!r t*e &!ssible ati+ities are '!ume)te' i) t*e table
0AC0 a)' als! i) t*e a&&r!&riate aut*!riCati!) !bGets.
0*e AUTHORITY1CHEC@ stateme)t e6eutes t*e aut*!riCati!) *e( $!r t*e user master
re!r' a)' als! issues t*e retur) !'e. .*e) e+aluati)5 t*e retur) !'e- y!u a) s&ei$y t*e
!)seBue)es !$ la(i)5 aut*!riCati!) >$!r e6am&le- &r!5ram termi)ates !r s(i&s s!me i)&ut
li)es?.
>C? SAP AG BC400 #A
6.18
SAP AG 2001
AUTHORITY1CHEC@ ORECT 9S/CARRID9
ID 9CARRID9 FIELD 9//////////9
ID 9ACT;T9 FIELD 9//////////90

IF SY1SURC NE "0
ENDIF0
4%ple%enting Authori;ation Checks
!!!
!!!
A<T:7-4TACC:9CE
!!!
!!!
0nser! $a!!ern
SCCA--48
IF IF s' s'1 1s),%$ s),%$ NE "0 NE "0
Pattern
4nsert
"alues
9"aluate
return code
@!u must s&ei$y all $iel's !$ t*e !bGet i) a) A+T0ORITY/C0ECK stateme)tH !t*er%ise y!u
reei+e a retur) !'e )!t eBual t! Cer!. /$ y!u '! )!t %a)t t! arry !ut a *e( $!r a &artiular $iel'-
e)ter 31))7 a$ter t*e aut*!riCati!) $iel'.
16am&leE .*e) a *a)5e tra)sati!) is alle'- it is a 5!!' i'ea t! *e( %*et*er t*e user may
*a)5e t*e e)tries $!r a &artiular airli)eE
AUTHORITY1CHEC@ ORECT 9S/CARRID9
ID 9CARRID9 DUMMY
ID 9ACT;T9 FIELD 9"D90
0*e m!st im&!rta)t retur) !'es $!r AUTHORITY1CHEC@ areE
0: ,he user has au!hor"Ja!"on con!a"n"n( !he re.u"re )alues.
4E 0*e user '!es )!t *a+e t*e reBuire' aut*!riCati!).
8E 0*e *e( %as )!t suess$ul beause )!t all $iel's !$ t*e aut*!riCati!) !bGet %ere
s&ei$ie'.
0*e (ey%!r' '!ume)tati!) $!r AUTHORITY1CHEC@ !)tai)s a !m&lete list !$ 0*e *e( %as
)!t suess$ul beause )!t all $iel's !$ t*e aut*!riCati!) !bGet %ere s&ei$ie'retur) !'es.
>C? SAP AG BC400 #8
6.19
SAP AG 2001
Pre"ie&
-eading 8atabase Tables
-eading 8atabase Tables
Authori;ation Checks
Authori;ation Checks
Pre"ie&
Pre"ie&
>C? SAP AG BC400 #8
6.20
SAP AG 2001
-eading 2inkable 8atabase Tables
'A?D, #ARR0D #8??0D #0,CFR8'
...
SPF24
...
'A?D, #ARR0D#ARR?A'4
...
SCA--
... ... ...
... ... ...
... ... ...
Whick link condition should apply to a
co%%on line@
sp+l#1man4t 7 s$a%%1man4t
sp+l#1$a%%#4 7 s$a%%1$a%%#4
Which link condition Which link condition
Which colu%ns are to be read0 and $ro% &hich database table@ Which colu%ns Which colu%ns
Which database tables should be taken into account@ Which database tables Which database tables
SPF24 and SCA--
sp+l#1man4t
sp+l#1$a%%#4
sp+l#1$onn#4
sp+l#1$#t'+%om
s$a%%1$a%%name
@!u a) aess se$eral 'atabase tables usi)5 one 'atabase Buery- i$ t*e 'atabse tables are l!5ially
relate'. 0! '! s!- y!u must s&ei$y t*e $!ll!%i)5 i)$!rmati!)E
.*i* 'atabase tables s*!ul' be aesse'K
.*at s*!ul' t*e li)( !)'iti!) l!!( li(eK /) t*e 5ra&*i- !lum)s $r!m b!t* 'atabase tables are
li)(e'. /$ all t*e $iel' +alues !$ t*e li)(e' !lum)s mat*- a re!r' is &lae' i) a !mm!) li)e i)
t*e results table.
.*i* !lum)s are t! be rea'K /$ a !lum) a&&ears i) m!re t*a) !)e 'atabase table- y!u must
s&ei$y t*e table $r!m %*i* t*is !lum) is t! be rea'.
>C? SAP AG BC400 "0
6.21
SAP AG 2001
ABAP progra%
8ictionary ?ie& and ABAP Ioin
2ink in the ABAP progra% using ABAP Ioin
2ink in 2ink in the 8ictionary the 8ictionary
ABAP 8ictionary ?ie&
2ink in 2ink in the Progra% the Progra%
SELECT 000
FROM sp+l# INNER ROIN s$a%%
ON sp+l#S$a%%#4 7 s$a%%S$a%%#4

3HERE 000
FROM INNER ROIN
ON
SELECT
@!u a) 'e$i)e t*e li)( !)'iti!)s eit*er statially !r 'y)amially.
@!u 'e$i)e a statc lnk !r +ie% i) t*e ABAP Diti!)ary. 0*ere are se+eral (i)'s !$ +ie%s. @!u
a) $i)' i)$!rmati!) ab!ut +ie%s i) t*e SAP 3ibrary u)'er Basis "omponents ABAP
Workbench B" ABAP Dictionary 5iews)
@!u im&leme)t a dynamc lnk !r a) ABAP G!i) usi)5 ABAP stateme)ts. 0*e system 5e)erates a)
a&&r!&riate 'atabase Buery i) t*e 'atabase i)ter$ae at ru) time. 9!r m!re i)$!rmati!)- see t*e
(ey%!r' '!ume)tati!) $!r t*e SELECT stateme)t.
>C? SAP AG BC400 "#
6.22
SAP AG 2001
Pre"ie&: -eusable Co%ponents $or 8ata -etrie"al
Business
7b6ect
2ogical
8atabase
7b6ect
Function
group
lobal
class
%ethods
BAP4s
/$ reusable !m&!)e)ts t*at e)a&sulate !m&le6 'ata retrie+al stateme)ts are a+ailable- y!u s*!ul'
use t*em. 0*ere are $!ur te*)iBues $!r reusi)5 'ata retrie+al !m&!)e)tsE.
Calli)5 met*!'s !$ 5l!bal lasses
Calli)5 met*!'s !$ busi)ess !bGets
Calli)5 $u)ti!) m!'ules
/)lu'i)5 l!5ial 'atabases R 3!5ial 'atabases are 'ata retrie+al &r!5rams t*at retur) l!5ially:
!))ete' 'ata i) a *ierar*ial seBue)e.
@!u a) $i)' i)$!rmati!) !) t*ese te*)iBues i) t*e a&&r!&riate u)its)
9!r 'etaile' i)$!rmati!) !) *!% t! i)lu'e l!5ial 'atabases- re$er t! t*e SAP 3ibrary u)'erE
Basis "omponents ABAP Pro'rammin' an! .$ntime Environment ABAP Database Accesses
+o'ical Databases)
>C? SAP AG BC400 ""
6.23
SAP AG 2001
Pre"ie&: 8atabase Accesses 4nitiating Changes
S929CT S929CT
INSERT INSERT
UPDATE UPDATE
DELETE DELETE
MODIFY MODIFY
/) a''iti!) t! t*e S131C0 stateme)t- O&e) S43 !)tai)s t*e UPDATE8 INSERT8 DELETE-
a)' MODIFY stateme)ts.
D! )!t use t*ese 'ata base aesses- %*i* i)itiate *a)5es i) t*e 'atabase- u)less y!u
u)'ersta)' t*e SAP tra)sati!) !)e&t.
All O&e) S43 stateme)ts su&&!rt t*e retur) !'e sy-subrc. /$ a 'atabase aess %as suess$ul-
t*e retur) !'e i) t*e system $iel' sy-subrc is 0H i$ it %as )!t suess$ul- t*e retur) !'e is )!t
0.
9!r m!re i)$!rmati!) ab!ut O&e) S43 stateme)ts- re$er t! t*e res&eti+e (ey%!r'
'!ume)tati!).
>C? SAP AG BC400 "3
6.24
SAP AG 2001
2ist "arious &ays o$ $inding database tables
Progra% read access to speci$ic colu%ns and
lines &ithin a particular database table
4%ple%ent authori;ation checks
2ist the read access options $or %ultiple database
tables
#o& you are able to:
8ata -etrie"al: Su%%ary
>C? SAP AG BC400 "4
6.25 'ata Retrie.a% E$ercises
1nt: 3ata %etre$al
Topc: %eadng 0e$eral %ecords 1sng a 4oop
At t*e !)lusi!) !$ t*ese e6erises- y!u %ill be able t!E
Pr!5ram l!!& 'atabase aesses
3imit t*e Bua)tity !$ selete' 'ata i) a!r'a)e %it* a) i)&ut
&arameter
1)*a)e y!ur ABAP &r!5ram t! issue $li5*t s*e'ules s! t*at !)ly t*e
s*e'ules !$ t*e airli)e arriers selete' by t*e user are 'is&laye'.
0*e list s*!ul' als! i)lu'e t*e &ere)ta5e !u&a)y !$ ea* $li5*t
s*e'ule'.
0em&lateE =C!""/>>/GS/LIST !r
SAPBC400WBS_GS_LIST
Pr!5ramE =C!""/>>/SELECT/SFLIGHT
M!'el s!luti!)E SAPBC400DDS_SELECT_SFLIG0T
## sta)'s $!r t*e t%!:'i5it 5r!u& )umber.
#:# C!&y y!ur e6eutable &r!5ram =C!""/>>/GS/LIST
>s!luti!) $!r e6erise " i) u)it 3- /)tr!'uti!) t! t*e ABAP .!r(be)*? !r t*e
tem&late SAPBC400WBS_GS_LIST t! t*e )e% )ame
=C!""/>>/SELECT/SFLIGHT.
#:" C*a)5e t*e %!r( area ty&e )ame >)ame su55esti!)E .a/+l#(&t?. N!% use t*e
5l!bal struture 0BC400*+CC.
9i)' !ut i)$!rmati!) !) t*e !m&!)e)ts >$iel's? !$ t*is struture.
#:3 De$i)e a) i)&ut &arameter $!r t*e airli)e abbre+iati!).
#:4 N!% selet !)ly t*e $li5*ts $r!m t*e 'atabase table 0*4256T t*at bel!)5 t! t*e
selete' airli)e.
Selet !)ly t*!se $iel's t*at *a+e a tar5et $iel' i) t*e %!r( area.
#:5 .it*i) t*e l!!& stateme)t- alulate t*e &ere)ta5e !u&a)y $!r ea* $li5*t.
Assi5) t*e result t! t*e PERCENTAGE $iel' i) y!ur %!r( area.
#:6 16te)' y!ur list !ut&ut t! i)lu'e t*e &ere)ta5e !u&a)y.
>C? SAP AG BC400 "5
#:A .*at is t*e $irst (ey $iel' i) t*e tra)s&are)t table 0*4256TK
.*at is t*e $irst (ey $iel' i) y!ur W6(%( lauseK
D!es t*e 'atabase i)ter$ae still use t*e &rimary i)'e6K
>C? SAP AG BC400 "6
("ercses
1nt: 3ata %etre$al
Topc: *llng and 0ortng an 2nternal Table
At t*e !)lusi!) !$ t*ese e6erises- y!u %ill be able t!E
9ill a) i)ter)al table %it* 'ata by a&&e)'i)5 'ata re!r's
S!rt t*e !)te)t !$ a) i)ter)al table
1)*a)e y!ur ABAP &r!5ram $!r t*e !ut&ut !$ $li5*t 'e&arture times s!
t*at t*e $li5*ts a&&ear i) t*e list s!rte' by &ere)ta5e !u&a)y.
9!r t*is &ur&!se- a&&e)' t*e rea' 'ata re!r's $!r t*e selete' airli)e
arrier t! a) i)ter)al table.
0em&lateE =C!""/>>/SELECT/SFLIGHT !r
SAPBC400DDS_SELECT_SFLIG0T
Pr!5ramE =C!""/>>/SELECT/SFLIGHT/ITA
M!'el s!luti!)E SAPBC400DDS_SELECT_SFLIG0T_TAB
## sta)'s $!r t*e t%!:'i5it 5r!u& )umber.
":# C!&y y!ur e6eutable &r!5ram =C!""/>>/SELECT/SFLIGHT
>s!luti!) $!r e6erise # i) t*is u)it? !r t*e tem&late
SAPBC400DDS_SELECT_SFLIG0T t! t*e )e% )ame
=C!""/>>/SELECT/SFLIGHT/ITA.
":" De$i)e a) i)ter)al table >)ame &r!&!salE #t/+l#(&t? usi)5 a 5l!bal table ty&e as
a basis t*at *as t*e 5l!bal struture 0BC400*+CC as li)e ty&e.
;se t*e Where2$se! list i) t*e ABAP Diti!)ary t! $i)' a suitable
table ty&e.
":3 9ill t*is i)ter)al table li)e by li)e by usi)5 a) INSERT stateme)t i) t*e SELECT
l!!&. >Rem!+e t*e stateme)ts $!r list !ut&ut. @!u a) use t*e s!ure te6t a5ai)
later.?
":4 S!rt t*e i)ter)al table by &ere)ta5e !u&a)y a)' 'is&lay t*e !)te)ts !$ t*e
i)ter)al table i) a l!!& !) a list.
>C? SAP AG BC400 "A
("ercses
1nt: 3ata %etre$al
Topc: Author/aton Check
At t*e !)lusi!) !$ t*ese e6erises- y!u %ill be able t!E
/m&leme)t aut*!riCati!) *e(s
Set u& t*e &r!5ram $l!% i) a +ariable ma))er 'e&e)'i)5 !) t*e
!ut!me !$ t*e aut*!riCati!) *e(
1)*a)e y!ur ABAP &r!5ram s! t*at t*e $li5*ts a) be rea' a)'
'is&laye' !)ly i$ t*e user *as 'is&lay aut*!riCati!) $!r t*e selete'
airli)e.
0em&latesE =C!""/>>/SELECT/SFLIGHT a)'
=C!""/>>/SELECT/SFLIGHT/ITA
SAPBC400DDS_SELECT_SFLIG0T a)'
SAPBC400DDS_SELECT_SFLIG0T_TAB
ProgramsE =C!""/>>/AUTHORITY/CHEC@ a)'
=C!""/>>/AUTHORITY/CHEC@/D
M!'el s!luti!)sE SAPBC400DDS_A+T0ORITY_C0ECK a)'
SAPBC400DDS_A+T0ORITY_C0ECK_6
>> stands for the t#o-dgt group number.
3:# C!&y y!ur e6eutable &r!5rams
=C!""/>>/SELECT/SFLIGHT >s!luti!) $!r e6erise # i) t*is u)it? a)'
=C!""/>>/SELECT/SFLIGHT/ITA >s!luti!) $!r e6erise " i) t*is u)it? !r
t*e tem&lates SAPBC400DDS_SELECT_SFLIG0T a)'
SAPBC400DDS_SELECT_SFLIG0T_TAB t! t*e )e% )ames
=C!""/>>/AUTHORITY/CHEC@ a)' =C!""/>>/AUTHORITY/CHEC@/D.
3:" Pr!5ram a) aut*!riCati!) *e( $!r t*e aut*!riCati!) !bGet 0>CA%%23. C*e( t*e
!mbi)ati!) !$ selete' airli)e a)' ati+ity Display.
;se t*e res&eti+e Pattern stateme)t i) t*e ABAP 1'it!r.
Sear* $!r t*e !rret abbre+iati!) !$ t*e ati+ity t! be *e(e'.
3:3 De$i)e a !)sta)t $!r t*e abbre+iati!) !$ t*e ati+ity ODisplayP >)ame &r!&!sal
a$tvt/4#spla'?. ;se ACT2@>A1T6 $!r ty&i)5 t*e 'ata eleme)t a)' use t*is
!)sta)t 'uri)5 t*e aut*!riCati!) *e(.
>C? SAP AG BC400 "8
3:4 16eute t*e 'atabase aess !)ly i$ t*e user *as 'is&lay aut*!riCati!) $!r t*e
selete' airli)e. /$ t*is is )!t t*e ase- 'is&lay a) a&&r!&riate err!r messa5e !) t*e
list.
3:5 16eute y!ur &r!5ramsH selet t*e airli)e abbre+iati!)s .DAAD a)' D1AD.
>C? SAP AG BC400 "8
6.26'ata Retri.a% So%&tions
1nt: 3ata %etre$al
Topc: %eadng 0e$eral %ecords 1sng a 4oop
#:" 0*e 5l!bal struture SC!""FOCC *as t*e $!ll!%i)5 !m&!)e)tsE
CARRID %it* ty&e S/CARR/ID
CONNID %it* ty&e S/CONN/ID
FLDATE %it* ty&e S/DATE
SEATSMAX %it* ty&e S/SEATSMAX
SEATSOCC %it* ty&e S/SEATSOCC
PERCENTAGE %it* ty&e S/FLGHTOCC.
#:A 0*e MANDT $iel' i) 0*4256T is mar(e' as a (ey $iel'. 0*e 3HERE !)'iti!)
'!es )!t )ee' t*is $iel'. Des&ite t*is $at- t*e 'atabase i)ter$ae a) use t*e &rimary
i)'e6 i) t*is ase $!r seleti)5 t*e 'ata re!r's.
%eason:
.*e) t*e ABAP ru)time system aesses a lie)t:s&ei$i table- it assumes t*at
'ata s*!ul' be ta(e) i)t! a!u)t !)ly i$ it bel!)5s t! t*e lie)t u)'er %*i* t*e
user is l!55e' !). 0*us- by 'e$ault- t*e 'atabase i)ter$ae e)*a)es t*e 3HERE
!)'iti!) %it* a 3HERE man4t 7 s'1man4t !)'iti!).
>C? SAP AG BC400 30
# M!'el s!luti!)E
REPORT sap,$!""44s/sele$t/s+l#(&t 0
DATA: .a/+l#(&t TYPE s,$!""+o$$6
PARAMETERS: pa/$a% TYPE s/$a%%/#40
< Se&e.# a&& da#a,e#, !om da#a)a,e #a)&e SFLIG0T
< .oe,pond"n' #o .a"e PA_CAR=
SELECT $a%%#4 $onn#4 +l4ate seatsma? seatso$$
FROM s+l#(&t
INTO CORRESPONDING FIELDS OF .a/+l#(&t
3HERE $a%%#4 7 pa/$a%0
< Ca&.-&a#e o..-pa#"on o! ea.( !&"'(#:
.a/+l#(&t1pe%$enta(e 7
<"" 2 .a/+l#(&t1seatso$$ * .a/+l#(&t1seatsma?0
< Cea#e L",#=
3RITE: * .a/+l#(&t1$a%%#46
.a/+l#(&t1$onn#46
.a/+l#(&t1+l4ate6
.a/+l#(&t1seatsma?6
.a/+l#(&t1seatso$$6
.a/+l#(&t1pe%$enta(e6
9N90
ENDSELECT0
>C? SAP AG BC400 3#
0olutons
1nt: 3ata %etre$al
Topc: *llng and sortng an nternal table
" M!'el s!luti!)E
REPORT sap,$!""44s/sele$t/s+l#(&t/ta,0
DATA: ;a_!&"'(# TYPE ,).400!o..8
#t/+l#(&t TYPE s,$!""/t/s,$!""+o$$0
PARAMETERS= pa_.a TYPE ,_.a_"d%
< ,e&e.# a&& da#a,e#, !om da#a)a,e #a)&e SFLIG0T
< .oe,pond"n' #o .a"e
SELECT .a"d .onn"d !&da#e ,ea#,ma1 ,ea#,o..
FROM ,!&"'(#
INTO CORRESPONDING FIELDS OF ;a_!&"'(#
W0ERE .a"d > pa_.a%
< .a&.-&a#e o..-pa#"on o! ea.( !&"'(#
;a_!&"'(#/pe.en#a'e >
500 < ;a_!&"'(#/,ea#,o.. ? ;a_!&"'(#/,ea#,ma1%
< append ,"n'&e &"ne "n#o "n#ena& #a)&e
INSERT .a/+l#(&t INTO TALE #t/+l#(&t0
< a&#ena#"4e&$8 $o- .o-&d -,e #(e APPEND ,#a#emen#8
< "! $o- ae -,"n' ,#andad #a)&e,=
<
< APPEND ;a_!&"'(# TO "#_!&"'(#%
ENDSELECT%
< ,o# "n#ena& #a)&e
SORT #t/+l#(&t Y pe%$enta(e0
< .ea#e &",# !om ,o#ed "n#ena& #a)&e
LOOP AT #t/+l#(&t INTO .a/+l#(&t0
3RITE: * .a/+l#(&t1$a%%#46
.a/+l#(&t1$onn#46
.a/+l#(&t1+l4ate6
.a/+l#(&t1seatso$$6
.a/+l#(&t1seatsma?6
.a/+l#(&t1pe%$enta(e69N90
ENDLOOP0
>C? SAP AG BC400 3"
0olutons
1nt: 3ata %etre$al
Topc: Author/aton Checks
3 M!'el s!luti!)E
REPORT sap,$!""44s/a)t&o%#t'/$&e$M0
CONSTANTS a$tvt/4#spla' TYPE a$t#v/a)t& ;ALUE 9"B90
DATA ;a_!&"'(# TYPE ,).400!o..%
PARAMETERS pa_.a TYPE ,_.a_"d%
< a-#(o"#$/.(e.9=
< I, -,e a-#(o"@ed #o d",p&a$ da#a !o .a"e PA_CARA
AUTHORITY1CHEC@ ORECT 9S/CARRID9
ID 9CARRID9 FIELD pa/$a%
ID 9ACT;T9 FIELD a$tvt/4#spla'0
CASE s'1s),%$0
< -,e ", a-#(o"@ed
3HEN "0
SELECT .a"d .onn"d !&da#e ,ea#,ma1 ,ea#,o..
FROM ,!&"'(#
INTO CORRESPONDING FIELDS OF ;a_!&"'(#
W0ERE .a"d > pa_.a%
;a_!&"'(#/pe.en#a'e >
500 < ;a_!&"'(#/,ea#,o.. ? ;a_!&"'(#/,ea#,ma1%
WRITE= ? ;a_!&"'(#/.a"d COLOR COL_KEY8
;a_!&"'(#/.onn"d COLOR COL_KEY8
;a_!&"'(#/!&da#e COLOR COL_KEY8
;a_!&"'(#/,ea#,o..8
;a_!&"'(#/,ea#,ma18
;a_!&"'(#/pe.en#a'e8BCB%
ENDSELECT%
< -,e ", no# a-#(o"@ed o
< o#(e eo o! a-#(o"#$/.(e.9
3HEN OTHERS0
3RITE: * 9A)t&o%#t'1C&e$M E%%o%9A""<C0
ENDCASE0
>REPORT ,ap).400dd,_a-#(o"#$_.(e.9_6 a)al!5?.
>C? SAP AG BC400 33
1
SAP AG 2001
8e$ining Subroutines
4nter$ace Para%eters
?isibility
Calling Subroutines
Subroutines in 8ebugging (ode
Contents:
4nternal Progra% (odulari;ation &ith Subroutines
>C? SAP AG BC400 #
7.2
SAP AG 2001
8e$ine subroutines
Call subroutines
Analy;e the e'ecution o$ subroutines in
debugging %ode
At the conclusion o$ this unit0 you &ill be able to:
4nternal Progra% (odulari;ation &ith Subroutines:
<nit 7b6ecti"es
>C? SAP AG BC400 "
7.3
SAP AG 2001
ABAP progra%
Calls and 4nter$aces
30!00
Percen!a(e
occu$"e
))!)0
Sales ra!"o
4nter$ace 4nter$ace
Subroutine
200
,o!al sea!s
+000
0n.u"r"es
*0
8ccu$"e sea!s
)))
Book"n(s
PERFORM 000
PERFORM 000
FORM 000
2 00000000000000000000 $al$)late pe%$enta(e 000
ENDFORM0
Actual para%eters
For%al para%eters
A subroutne is a) i)ter)al m!'ule %it*i) a &r!5ram. /) a subr!uti)e- y!u li$t &arts !$ a
&r!5ram !ut !$ t*e mai) &r!5rammi)5 bl!( a)' &ut t*em s!me%*ere else. 0*is ma(es y!ur
&r!5ram easier t! rea' a)' all!%s y!u t! use t*ese !'e se5me)ts m!re t*a) !)e.
@!u a) &ass 'ata t! t*e subr!uti)e a)' ba( t*r!u5* its i)ter$ae. 0*is all!%s y!u t! all t*e
same $u)ti!) $!r 'i$$ere)t 'ata !bGets. 0*e e6am&le i) t*e 5ra&*i s*!%s a subr!uti)e t*at
alulates a &ere)ta5e. 0*is subr!uti)e is alle' se+eral times- e+e) t*!u5* 'i$$ere)t 'ata
!bGets are &asse' t! t*e i)ter$ae i) ea* ase.
;si)5 subr!uti)es ma(es y!ur &r!5ram m!re functon orentedE it s&lits t*e &r!5ramIs tas( i)t!
sub$u)ti!)s s! t*at ea* subr!uti)e is res&!)sible $!r !)e sub$u)ti!).
0*is 5e)erally ma(es &r!5rams easier t! mai)tai). /) t*e Debu55er- y!u a) e6eute t*e
subr!uti)es i) ba(5r!u)' s! t*at y!u see !)ly t*e result. 0*is usually ma(es it easier t! $i)'
t*e s!ure !$ t*e err!r.
0*e structure of a subroutne i)lu'es t*e $!ll!%i)5E
1a* subr!uti)e starts %it* FORM a)' e)'s %it* ENDFORM.
0*e )ame !$ t*e subr!uti)e is $!ll!%e' by t*e i)ter$ae 'e$i)iti!).
0*e stateme)ts t*at t*e subr!uti)e e6eutes !me bet%ee) 9ORM a)' 1ND9ORM.
>C? SAP AG BC400 3
7.4
SAP AG 2001
Ways o$ Passing 4nter$ace Para%eters
Passes an address Passes a "alue Passes and returns a "alue
Call=by="alue Call=by=re$erence Call=by="alue=and=result
@!u s&ei$y *!% t*e 'ata is &asse' $r!m t*e mai) &r!5ram >actual parameters? t! t*e
subr!uti)e >formal parameters? i) t*e i)ter$ae !$ t*e subr!uti)e. @!u a) '! t*is i) t*ree
%ays:
Call-by-$alue R A local copy !$ t*e atual &arameter is &asse' t! t*e subr!uti)e. 0*is mea)s
t*at +alue assi5)me)ts t! t*e $!rmal &arameter *a+e absolutely no effect !) t*e atual
&arameter.
Call-by-reference R A dereferenced address !$ t*e atual &arameter is &asse' t! t*e
subr!uti)e. 0*is mea)s t*at +alue assi5)me)ts t! t*e $!rmal &arameter drectly affect t*e atual
&arameter. 0*e +alue !$ t*e atual &arameter is &*ysially *a)5e' by t*e subr!uti)e t*r!u5*
t*e a''ress.
Call-by-$alue-and-result R A local copy !$ t*e atual &arameter is &asse' t! t*e subr!uti)e
a)' a $alue s passed back t! t*e mai) &r!5ram !)ly i$ t*e 1ND9ORM stateme)t is e6eute'.
0*is mea)s t*at +alue assi5)me)ts t! t*e $!rmal &arameter a$$et t*e atual &arameter !)ly
after they ha$e left the subroutne. C*!!se t*is !&ti!) i$ y!u %a)t t! ma(e sure t*at t*e atual
&arameter is not *a)5e' i$ t*e subr!uti)e is termi)ate' &rematurely.
>C? SAP AG BC400 4
7.5
SAP AG 2001
Passing 4nter$ace Para%eters: Synta'
FORM s),%o)t#ne/name USING val)eA+<C 000
CHANGING +D 000
val)eA+BC 000 0
000
ENDFORM0
-1 -2 -3
PERFORM s),%o)t#ne/name USING a<
CHANGING aD
aB0
a1 a2 a3
USING USING val)e val)eA A C C
val)e val)eA A C C
CHANGING CHANGING
USING USING
CHANGING CHANGING
/) t*e i)ter$ae 'e$i)iti!)- y!u list t*e formal parameters !$ t*e 'i$$ere)t s!rts a)' assi5) a
ty&e t! ea* !)e. 0*e se.uence of parameters is $i6e'E $irst y!u )ame all t*e USING
&arameters- t*e) y!u )ame all t*e CHANGING &arameters. .it*i) t*e subr!uti)e- y!u a''ress
t*e 'ata t*at *as bee) &asse' usi)5 t*e $!rmal &arameters.
0*e atual &arameters are 5r!u&e' by +SING a)' C0ANGING %*e) t*e subr!uti)e is alle'.
@!u s&ei$y t*e %ay i) %*i* t*e &arameters are t! be &asse' i) t*e i)ter$ae 'e$i)iti!)E
Call-by-$alue >+<? R @!u list t*ese &arameters a$ter t*e +SING (ey%!r' a)' !m&lete
t*em %it* t*e val)eA!5C a''iti!).
Call-by-reference >+D? R @!u list t*ese &arameters a$ter t*e C0ANGING (ey%!r'.
>9!r '!ume)tati!) &ur&!ses- y!u a) als! list a &ass:by:re$ere)e &arameter a$ter +SING.
0e*)ially- +SING a)' C0ANGING *a+e e6atly t*e same e$$et. ><!%e+er- i$ y!u *a)5e a
&arameter liste' a$ter +SING i) t*e subr!uti)e- y!u reei+e a %ar)i)5 i) t*e 16te)'e' Pr!5ram
C*e(.?
Call-by-$alue-and-result >+B? R @!u list t*ese &arameters a$ter t*e C0ANGING
(ey%!r' a)' !m&lete t*em %it* t*e val)eA!7C a''iti!)
>C? SAP AG BC400 5
7.6
SAP AG 2001
4nter$ace Para%eters: Speci$ied and 4nherited Types
TYPES t/pe%$ TYPE p DECIMALS D0
DATA: a< TYPE 0006
aD TYPE 0006
aB TYPE 000 0
000
PERFORM $al$/pe%$ USING a<
aD
CHANGING aB0
FORM $al$/pe%$
USING
val)eA+/pa%tC TYPE #
val)eA+/allC TYPE #
CHANGING
val)eA+/p$C TYPE t/pe%$0
CHEC@ +/all KL "0
+/p$ 7 +/pa%t 2 <"" * +/all0
ENDFORM0
DATA: a< TYPE 0006
aD TYPE 0006
aB TYPE 000 0
000
PERFORM $al$/pe%$ USING a<
aD
CHANGING aB0
FORM $al$/pe%$
USING
val)eA+/pa%tC TYPE ANY
val)eA+/allC TYPE ANY
CHANGING
val)eA+/p$C TYPE ANY0
CHEC@ +/all KL "0
+/p$ 7 +/pa%t 2 <"" * +/all0
ENDFORM0
TYPE # TYPE #
TYPE # TYPE #
TYPE t/ TYPE t/pe%$ pe%$
Speci$ied type 4nherited type
-isk o$ type con$licts
0*e 'ata !bGets &asse' t! a subr!uti)e >t*at is- t*e atual &arameters? a) be of any type. /$
y!u use elementary types- y!u a) 'ei'e %*et*er !r )!t y!u %a)t t! s&ei$y t*e ty&e !$ t*e
$!rmal &arameters.
By s&ei$yi)5 t*e ty&e !$ t*e $!rmal &arameters- y!u e)sure t*at !)ly atual &arameters !$ t*at
ty&e a) be &asse' t! t*e subr!uti)e. 0*is ma(es y!ur &r!5ram m!re stable beause t*e sy)ta6
*e( %ill $i)' a)y ty&e !)$lits.
/$ y!u use t*e TYPE ANY a''iti!)- y!u lea+e t*e ty&e u)s&ei$ie'. >9!r !m&atibility reas!)s-
y!u a) als! !mit t*is a''iti!).? /) t*is ase- t*e $!rmal &arameter i)*erits t*e ty&e $r!m t*e
atual &arameter at ru) time. /$ t*e stateme)ts i) t*e subr!uti)e are )!t suite' t! t*e i)*erite'
ty&e- a runtme error may !ur.
/$ y!u assi5) t*e ty&es p- n- $ !r ?- t*e mssng ty&e attributes are similarly Di)*erite'D at ru)
time. /$ y!u %a)t t! s&ei$y a ty&e !m&letely- y!u must use a user:'e$i)e' ty&e. /$ y!u use
st%#n( !r ?st%#n(- t*e ty&e is )!t $ully s&ei$ie' u)til ru) time.
C!)+ersely- t*e ty&es #- +- 4- a)' t are $ully ty&e'.
>C? SAP AG BC400 6
7.7
SAP AG 2001
4nter$ace Para%eters: Speci$ying Types $or
Structures and 4nternal Tables
DATA .a/+l#(&t#n+o
TYPE s,$!""+o$$0
000
PERFORM +#ll/.a
CHANGING .a/+l#(&t#n+o0
FORM +#ll/.a
CHANGING
+/.a TYPE s,$!""+o$$0
+/.a1$a%%#4 7 000 0
+/.a1$onn#4 7 000 0
ENDFORM0
DATA #t/+l#(&t#n+o
TYPE s,$!""/t/s,$!""+o$$0
000
PERFORM +#ll/#ta,
CHANGING #t/+l#(&t#n+o0
FORM +#ll/#ta,
CHANGING
+/#ta, TYPE s,$!""/t/s,$!""+o$$0
LOOP AT +/#ta, 000 0
000
ENDLOOP0
ENDFORM0
TYPE s,$!""+o$$ TYPE s,$!""+o$$ TYPE s,$!""/t/s,$!""+o$$ TYPE s,$!""/t/s,$!""+o$$
Table type Structure type
Address the para%eter as
an internal table
Address the structure
co%ponents
/$ y!u use structures !r nternal tables as $!rmal &arameters- y!u must ty&e t*em $ully. 0*is all!%s
y!u t! aess t*ese $!rmal &arameters %it*i) t*e subr!uti)e.
0*e !m&!)e)ts !$ strutures are ()!%) i) t*e subr!uti)e- as a result !$ t*e assi5)e' ty&e- s! t*at
y!u a) a''ress t*ese !m&!)e)ts %it* t*e usual sy)ta6.
/$ y!u use i)ter)al tables- t*e assi5)e' ty&e all!%s y!u t! a''ress t*e $!rmal &arameter as an
nternal table %it* t*e usual sy)ta6.
-ote on performanceE
/$ y!u use nternal tables as &arameters- y!u s*!ul' 5e)erally &ass t*em usi)5 pass-by-reference.
Ot*er%ise- t*e system a) use !)si'erable res!ures sim&ly !&yi)5 t*em t! t*e subr!uti)e.
>C? SAP AG BC400 A
7.8
SAP AG 2001
?isibility o$ lobal and 2ocal 8ata 7b6ects
000
PERFORM +#ll/#ta, CHANGING #t/+l#(&t#n+o0
FORM +#ll/#ta,
CHANGING
+/#ta, TYPE s,$!""/t/s,$!""+o$$0
DATA l/.a LI@E LINE OF +/#ta,0
LOOP AT +/#ta, INTO l/.a0
000
ENDLOOP0
ENDFORM0
?isible globally
?isible locally
DATA: #t/+l#(&t#n+o TYPE s,$!""/t/s,$!""+o$$6
.a/+l#(&t#n+o TYPE s,$!""+o$$6
000 0
DATA DATA
@!u a) 'e$i)e local data %it*i) a subr!uti)e.
B!t* t*e $!rmal &arameters a)' t*e l!al 'ata !bGets are ati+e !)ly at t*e ru) time !$ t*e
subr!uti)e. 0*is mea)s t*at mem!ry is all!ate' !)ly %*e) t*e subr!uti)e is alle' a)' is
release' as s!!) as t*e subr!uti)e *as bee) e6eute'. 0*us t*ese &arameters a)' 'ata !bGets
a) be a''resse' !)ly $r!m %it*i) t*e subr!uti)e.
0*e 5l!bal 'ata !bGets $r!m t*e mai) &r!5ram a) als! be a''resse' $r!m t*e subr!uti)e.
<!%e+er- y!u s*!ul' a+!i' '!i)5 t*is %*ere+er &!ssible. Ot*er%ise- y!u by&ass t*e i)ter$ae-
%*i* ma(es t*e &r!5ram m!re &r!)e t! err!rs.
/$ a l!al 'ata !bGet !r $!rmal &arameter *as t*e same )ame as a 5l!bal 'ata !bGet- t*e ABAP
runtme system a''resses t*e l!al 'ata !bGet i) t*e subr!uti)e a)' t*e 5l!bal !)e !utsi'e it.
0*ese !bGets are t*e) ()!%) as locally obscured !bGets.
Summary !$ *i)ts ab!ut 5!bal a)' l!al 'ata !bGetsE
A''ress t*e 5l!bal 'ata !bGets i) t*e mai) &r!5ram a)' &ass t*em t! t*e subr!uti)e
usi)5 t*e i)ter$ae.
A''ress !)ly $!rmal &arameters a)' l!al 'ata !bGets i) t*e subr!uti)e.
9!r larity- a+!i' usi)5 i'e)tially )ame' 5l!bal a)' l!al +ariables. /)stea'- use a
sim&le &re$i6- su* as +/ $!r $!rmal &arameters a)' l/ $!r l!al 'ata !bGets.
>C? SAP AG BC400 8
7.9
SAP AG 2001
Synta' 9'a%ple: Passing an 4nternal Table
DATA: #t/+l#(&t#n+o TYPE s,$!""/t/s,$!""+o$$6
.a/+l#(&t#n+o TYPE s,$!""+o$$6
l#nes TYPE #0
000
PERFORM $o)nt/l#nes USING #t/+l#(&t#n+o
9LH9
CHANGING l#nes0
FORM $o)nt/l#nes USING +/#ta, TYPE s,$!""/t/s,$!""+o$$
+/$a%% TYPE s,$!""+o$$1$a%%#4
CHANGING val)eA+/l#nesC TYPE #0
DATA l/.a LI@E LINE OF +/#ta,0
CLEAR +/l#nes0
LOOP AT +/#ta, INTO l/.a
3HERE $a%%#4 7 +/$a%%0
ADD < TO +/l#nes0
ENDLOOP0
ENDFORM0
0*e e6am&le i) t*e 5ra&*i s*!%s a mai) &r!5ram alli)5 a subr!uti)e- %*i* s&ei$ies t*e
)umber !$ li)es !$ a) i)ter)al table )ee'e' t! $ul$ill a s&ei$i riteri!).
0*e i)ter)al table- +/#ta,- a)' t*e !m&aris!) +alue- +/$a%%- are &asse' by re$ere)e t!
im&r!+e &er$!rma)e. 0*e )umber !$ li)es- +/l#nes- is &asse' by +alue:a)':result.
0! l!!& t*r!u5* t*e i)ter)al table- y!u )ee' a %!r( area %it* a !m&atible li)e ty&e- %*i* y!u
'e$i)e l!ally i) t*e subr!uti)e- by ma(i)5 a re$ere)e t! t*e $!rmal &arameter.
>C? SAP AG BC400 8
7.10
SAP AG 2001
Calling Subroutines
Syste% :elp Syste% :elp
D00CF7-(
ABAP E/itor( C#an*in* t#e Report 000123R4
Subroutines
C7<#TC24#9S FORM $o)nt/l#nes
USING +/#ta, TYPE 000
+/$a%% TYPE 000
CHANGING val)eA+/l#nesC TYPE 000 0
000
ENDFORM0
PERFORM $o)nt/l#nes
USING
+/#ta,
+/$a%%
CHANGING
+/l#nes0
2 :
Adapt the actual
para%eters
B
+ :
Sdrag=and=dropS
A subr!uti)e is alle' usi)5 t*e PERFORM stateme)t.
.*e) t*e subr!uti)e is alle'- &arameters are &asse' t! it n strct se.uence.
9!r t*is reas!)- y!u s*!ul' 'e$i)e t*e subr!uti)e $irst a)' t*e) all it. 0*e ObGet Na+i5at!r
su&&!rts y!u i) t*is res&etE @!u a) 5e)erate t*e PERFORM stateme)t by 'ra55i)5 t*e
subr!uti)e $r!m t*e )a+i5ati!) area t! t*e e'it!r area.
Alter)ati+ely- y!u a) 5e)erate t*e all usi)5 t*e Pattern $u)ti!) i) t*e ABAP 1'it!r.
0*is &re+e)ts y!u $r!m mi6i)5 u& !r $!r5etti)5 a)y &arameters. <!%e+er- y!u must remember
t! re&lae t*e $!rmal &arameters %it* atual &arameters.
>C? SAP AG BC400 #0
7.11
SAP AG 2001
Subroutines in 8ebugging (ode
Dar"an!
@GGA>3RSA000
@GGAF8R'S
1 4
9
Dar"an!

FORM $o)nt/l#nes USING +/#ta, TYPE 000


+/$a%% TYPE 000
CHANGING val)eA+/l#nesC TYPE 000 0
DATA l/.a LI@E LINE OF +/#ta,0
F"2e $o"n! ar"!h*e!"c
1% 30 9







E
SAP
Wa!ch$o"n!
ABAP 'e"&**er


chws chws
SC9S3BR# SC9,AB0E SC9DB#?, 0 0 1
$Ccarr 2:
9'ecute
-eturn
/) 'ebu55i)5 m!'e- y!u a) ma(e a subr!uti)e ru) %it*!ut st!&&i)5. 0*e e6euti!) !$ t*e mai)
&r!5ram '!es )!t st!& u)til a$ter t*e subr!uti)e *as bee) e6eute'.
Alter)ati+ely- y!u a) e6eute t*e subr!uti)e stateme)t by stateme)t usi)5 &in'le &tep)
/$ t*e urre)t stateme)t is l!ate' i) a subr!uti)e- y!u a) ru) t*e rest !$ t*e subr!uti)e %it*!ut
it st!&&i)5 by seleti)5 .et$rn -,6). 16euti!) !$ t*e mai) &r!5ram '!es )!t st!& u)til a$ter t*e
subr!uti)e is e6eute'.
>C? SAP AG BC400 ##
7.12
SAP AG 2001
8e$ine subroutines
Call subroutines
Analy;e the e'ecution o$ subroutines in
debugging %ode
Aou are no& able to:
4nternal Progra% (odulari;ation &ith Subroutines:
<nit Su%%ary
>C? SAP AG BC400 #"
7.134o/&%ari5ation E$ercises
1nt: 2nternal Program )odular/aton
Topc: 0ubroutnes
At t*e !)lusi!) !$ t*ese e6erises- y!u %ill be able t!E
Create subr!uti)es
;se t*e subr!uti)e i)ter$ae t! &ass 'ata
C*a)5e y!ur &r!5ram =C!""/>>/SELECT/SFLIGHT/ITA >!r t*e
!rres&!)'i)5 m!'el s!luti!)? s! t*at t*e 'is&lay !$ t*e 'ata i) a list is
e)a&sulate' i) a subr!uti)e.
Template: =C!""/>>/AUTHORITY/CHEC@/D o
SAPC!""DDS/AUTHORITY/CHEC@/D
Program: =C!""/>>/SUROUTINE
)odel soluton: SAPC!""PS/SUROUTINE
#:# C!&y y!ur &r!5ram =C!""/>>/AUTHORITY/CHEC@/D !r t*e !rres&!)'i)5
m!'el s!luti!) SAPC!""DDS/AUTHORITY/CHEC@/D t! t*e )e% &r!5ram
=C!""/>>/SUROUTINE.
#:" 1)a&sulate t*e 'is&lay !$ 'ata i) a list i) a subr!uti)e. Call t*e subr!uti)e
>su55este' )ameE 3RITE/LIST? a$ter t*e SELECT l!!&. Pass t*e i)ter)al table
!)tai)i)5 t*e 'ata t*at *as bee) rea' usi)5 t*e i)ter$ae.
#:3 De$i)e t*e subr!uti)e a)' s&ei$y ty&es $!r t*e i)ter$ae &arameters.
#:4 Dis&lay t*e 'ata $r!m t*e subr!uti)e usi)5 a LOOPT ENDLOOP struture. 0! '!
t*is- reate t*e reBuire' table %!r( area as a l!al 'ata !bGet i) t*e subr!uti)e. 0!
s&ei$y t*e ty&e !$ t*e l!al struture- use t*e ABAP stateme)t DATA 2;a3 LI@E
LINE OF 2"#a)3.
>C? SAP AG BC400 #3
7.144o/&%ari5ation So%&tions
1nt: 2nternal Program )odular/aton
Topc: 0ubroutnes
)odel soluton 0APBC400PB0>01B%+1T2-(
<D//////////////////////////////////////////////////////////////<
<D Repo# SAPBC400PBS_S+BRO+TINE <
<D <
<D//////////////////////////////////////////////////////////////<
REPORT ,ap).400p),_,-)o-#"ne%
CONSTANTS a.#4#_d",p&a$ TYPE a.#"4_a-#( *AL+E B07B%
DATA= ;a_!&"'(# TYPE ,).400!o..8
"#_!&"'(# TYPE ,).400_#_,).400!o..%
PARAMETERS= pa_.a TYPE ,!&"'(#/.a"d%
START/OF/SELECTION%
2 A)t&o%#t'1C&e$M:
A+T0ORITY/C0ECK OBEECT BS_CARRIDB
ID BCARRIDB FIELD pa_.a
ID BACT*TB FIELD a.#4#_d",p&a$%
CASE ,$/,-).%
< +,e ", a-#(o"@ed
W0EN 0%
SELECT .a"d .onn"d !&da#e ,ea#,ma1 ,ea#,o.. FROM ,!&"'(#
INTO CORRESPONDING FIELDS OF ;a_!&"'(#
W0ERE .a"d > pa_.a%
;a_!&"'(#/pe.en#a'e >
500 < ;a_!&"'(#/,ea#,o.. ? ;a_!&"'(#/,ea#,ma1%
APPEND ;a_!&"'(# TO "#_!&"'(#%
ENDSELECT%
PERFORM .%#te/l#st USING #t/+l#(&t0
< +,e ", no# a-#(o"@ed o o#(e eo o! a-#(o"#$/.(e.9
W0EN OT0ERS%
WRITE= ? BA-#(o"#$/C(e.9 EoBF005G%
ENDCASE%
2U111111111111111111111111111111111111111111111111111111111111112
2U Fo%m 3RITE/LIST
2U111111111111111111111111111111111111111111111111111111111111112
2 te?t
21111111111111111111111111111111111111111111111111111111111111112
2 11LP/IT/FLIGHT te?t
21111111111111111111111111111111111111111111111111111111111111112
FORM .%#te/l#st USING p/#t/+l#(&t TYPE s,$!""/t/s,$!""+o$$0
DATA: .a LI@E LINE OF p/#t/+l#(&t0
LOOP AT p/#t/+l#(&t INTO .a0
>C? SAP AG BC400 #4
3RITE: * .a1$a%%#4 COLOR COL/@EY6
.a1$onn#4 COLOR COL/@EY6
.a1+l4ate COLOR COL/@EY6
.a1seatso$$6
.a1seatsma?6
.a1pe%$enta(e69N90
ENDLOOP0
ENDFORM0 5 3RITE/LIST
>C? SAP AG BC400 #5
H
SAP AG 2001
9'ecution o$ 9"ent Blocks by the ABAP -unti%e
Syste%
9"ent Block 27A8=7F=P-7-A( ,4#4T4A24DAT47#.
9"ent Block STA-T=7F=S929CT47#
Contents:
The ABAP -unti%e Syste%
>C? SAP AG BC400 #
8.2
SAP AG 2001
8escribe the e"ent=controlled processes $or
e'ecuting an ABAP progra%
<se the e"ent block 27A8=7F=P-7-A(
,4#4T4A24DAT47#.
<se the e"ent block STA-T=7F=S929CT47#
At the conclusion o$ this unit0 you &ill be able to:
The ABAP -unti%e Syste%: <nit 7b6ecti"es
>C? SAP AG BC400 "
8.3
SAP AG 2001
Possible 9le%ents in an ABAP Progra%
9"ent
block
Subroutine
progra%
4nter$ace
9"ent
block
Screen
Process
Be$ore
7utput
Process
A$ter
4nput
2ocal type and $ield
de$initions
Selection screen
(odule
(odule
9"ent
block
9"ent
block
A) ABAP &r!5ram is a !lleti!) !$ &r!essi)5 bl!(s. A &r!essi)5 bl!( !)sists !$ &assi+e
s!ure !'e seti!)s t*at are &r!esse' seBue)tially %*e) alle'.
Pr!essi)5 bl!(s are t*e smallest u)its i) ABAP. 0*ey a))!t be s&lit- %*i* als! mea)s t*at
t*ey a))!t be )este'.
0*ere are +ari!us (i)'s !$ ABAP &r!essi)5 bl!(sE
($ent blocks are &r!essi)5 bl!(s t*at are alle' by t*e ABAP ru)time system
%*e)e+er t*e res&eti+e e+e)t is i)itiate'. Su* e+e)ts a) be i)itiate' by t*e ABAP ru)time
system itsel$ !r by t*e user.
0ubroutnes are &r!essi)5 bl!(s t*at are alle' by ABAP stateme)ts. 0*e 'e+el!&er
!)tr!ls subr!uti)es.
)odules are s&eial ABAP &r!essi)5 bl!(s t*at are alle' by sree) stateme)ts.
0*ese are reBuire' $!r sree) &r!essi)5.
.*e)e+er a &r!5ram is starte'- all t*e 5l!bal 'ata !bGets !$ t*e &r!5ram are reate' i) t*e %!r(i)5
mem!ry $irst. Delarati+e ABAP stateme)ts are not !m&!)e)ts !$ ABAP &r!essi)5 bl!(sH
i)stea'- t*ey are !llete' by t*e ABAP ru)time system %*e) t*e !+erall s!ure !'e is 5e)erate'.
9!r t*e sa(e !$ larity- *!%e+er- y!u s*!ul' &lae all 'elarati+e stateme)ts t!5et*er at t*e be5i))i)5
!$ t*e s!ure !'e. 16e&ti!)s t! t*is are l!al 'elarati!)s %it*i) subr!uti)es.
>C? SAP AG BC400 3
8.4
SAP AG 2001
9'a%ple: ABAP Progra% &ith Se"eral 9"ent
Blocks and a Selection Screen
2ocal Type and Field 8e$initions
Selection screen
,generated by the
runti%e syste%.
LOAD1OF1PROGRAM0
pa/4ate 7 s'14at)m 1 E0
START1OF1SELECTION0
3RITE pa/4ate0
PARAMETERS pa/4ate LI@E s'14at)m
F DEFAULT s'14at)m H0
9"ent block
9"ent block
8e$ault settings $or
selection screen
Start o$ list creation
/) all !$ t*e &r!5rams %e *a+e see) s! $ar i) t*is !urse- !)ly !)e &r!essi)5 bl!( *as bee)
&r!5ramme' i) a''iti!) t! 'elarati+e stateme)ts. /) t*is ase- t*ere is )! )ee' t! 'elare t*e
&r!essi)5 bl!( e6&liitly. /) m!re !m&le6 &r!5rams- *!%e+er- se+eral 'i$$ere)t &r!essi)5
bl!(s are reBuire'.
0*e e6am&le i) t*e 5ra&*i !)tai)s a seleti!) sree) %it* a) i)&ut $iel' $!r a 'ate. 0*e 'ate !$
t*e same %ee('ay i) t*e &re+i!us %ee( s*!ul' a&&ear as a 'e$ault +alue.
0*e PARAMETERS stateme)t is a 'elarati+e la)5ua5e eleme)t. 0*e system reBuires a
alulati!) t! &reset t*e 'ate 'y)amially. 0*e 3(*A14T a''iti!) t! t*e PARAMETERS
stateme)t e)sures t*at t*e 'ata !bGet is $ille' %it* a 'e$ault +alue. 0*e ABAP ru)time system
$ills t*e ,$/da#-m $iel' %it* t*e urre)t 'ate at t*e start !$ t*e &r!5ram.
0! *a)5e +ariables at run tme- t*ere$!re- y!u must &r!5ram a &r!essi)5 bl!(. Beause t*is
s*!ul' be &r!esse' before t*e sta)'ar' seleti!) sree) is tra)smitte'- use t*e res&eti+e e+e)t
bl!( alle' LOAD1OF1PROGRAM.
;se t*e sta)'ar' e+e)t bl!(- START1OF1SELECTION6 t! reate t*e list
>C? SAP AG BC400 4
8.5
SAP AG 2001
Sa%ple Progra% -unti%e Beha"ior


ABAP runti%e syste%
ABAP progra%
LOAD1OF1PROGRAM0
pa/4ate 7 s'14at)m 1 E0
START1OF1SELECTION0
3RITE pa/4ate0
Progra%
start
Ti%e
2ist
bu$$er
$or
basic list
paCdate
+///+22)
@@@
/) t*e $l!% 'ia5ram i) t*e 5ra&*i- y!u a) easily $!ll!% t*e seBue)e !$ &r!essi)5 ste&s by t*e
ABAP ru)time system. 1+e)t bl!(s are alle' i) a f"ed se.uence 'esi5)e' $!r list &r!essi)5E
0*e $irst e+e)t bl!( t! be alle' is LOAD1OF1PROGRAM. /) t*e e6am&le- t*e 'ate DA %ee(
a5!D is alulate' a)' &lae' i)t! t*e pa_da#e i)&ut $iel'. Ne6t t*e system se)'s t*e seleti!)
sree) %it* t*is )e% +alue t! t*e &rese)tati!) ser+er. 0*e user a) *a)5e t*e +alue.
Ne6t t*e seleti!) sree) is se)t t! t*e &rese)tati!) ser+er.
A$ter t*e user lea+es t*e seleti!) sree)- START1OF1SELECTION is alle'.
/$ t*e START/OF/SELECTION e+e)t bl!( !)tai)s t*e ABAP stateme)ts 3RITE8 S@IP !r
ULINE9 a list bu$$er is $ille'.
As s!!) as START/OF/SELECTION is &r!esse' !m&letely- t*e list bu$$er is se)t t! t*e
&rese)tati!) ser+er as a list.
B!t* e+e)ts &rese)te' *ere are i)itiate' by t*e ABAP ru)time system e"actly once ea* time a
&r!5ram is e6eute'.
>C? SAP AG BC400 5
8.6
SAP AG 2001
9"ent Block Characteristics
PARAMETERS pa/4ate LI@E s'14at)m
F DEFAULT s'14at)m H0
LOAD1OF1PROGRAM0
pa/4ate 7 s'14at)m 1 E0
START1OF1SELECTION0
3RITE pa/4ate0
LOAD1OF1PROGRAM0 LOAD1OF1PROGRAM0
START1OF1SELECTION0 START1OF1SELECTION0
ABAP progra%
4ntroduced by an
e"ent key&ord
9nded by the ne't
processing block
9"ent block $or
di$$erent tasks
Processing se5uence
$or e"ent blocks is
deter%ined by the
runti%e syste% =
9"ent block se5uence
in source code
uni%portant
Standard e"ent block
in e'ecutable progra%:
A) e+e)t bl!( is i)tr!'ue' %it* a) e$ent key#ord. /t e)'s im&liitly %*e) t*e )e6t &r!essi)5
bl!( starts.
1+e)t bl!(s are alle' by t*e ABAP ru)time system. 0*ere$!re- t*e seBue)e i) %*i* t*e e+e)t
bl!(s are %ritte) i) t*e &r!5ram is u)im&!rta)t.
LOAD1OF1PROGRAM is t*e $irst e+e)t bl!( alle' i) all ABAP &r!5ram ty&es. 0*is e+e)t bl!(
all!%s y!u t! set 'e$ault +alues t*at a) !)ly be 'etermi)e' at ru)time.
9!r !m&atibility reas!)s- t*e e+e)t bl!( INITIALI=ATION is a+ailable as a) alter)ati+e.
<!%e+er- it is a+ailable $!r e6eutable &r!5rams !)ly.
START1OF1SELECTION is t*e $irst e+e)t bl!( $!r reati)5 a list. /t is alle' by t*e ABAP ru)time
system as s!!) as y!u lea+e t*e sta)'ar' seleti!) sree). /t is a+ailable $!r e6eutable &r!5rams
!)ly.
/) e6eutable &r!5rams- a''iti!)al e+e)t bl!(s are a+ailable $!r 'i$$ere)t tas(s a)' are 'esi5)e' $!r
reati)5 lists. @!u a) !btai) a !m&lete list !$ e+e)t bl!(s $r!m t*e ABAP '!ume)tati!)E *!!se
ABAP Overview ABAP 2 Overview Dia'rams "lassification of 0eywor!s by Type Event
keywor!s.
>C? SAP AG BC400 6
8.7
SAP AG 2001
8escribe the e"ent=controlled processes $or
e'ecuting an ABAP progra%
<se the e"ent block 27A8=7F=P-7-A(
,4#4T4A24DAT47#.
<se the e"ent block STA-T=7F=S929CT47#
Aou are no& able to:
The ABAP -unti%e Syste%: <nit Su%%ary
>C? SAP AG BC400 A
/
SAP AG 2001
2ist attributes and strengths
Basic list
2ist e"ents
4nteracti"e lists
9'a%ple &ith synta': 8etail list
Contents:
<ser 8ialog 2ist
>C? SAP AG BC400 #
9.2
SAP AG 2001
8escribe list attributes and strengths
Write a progra% that displays the detail o$ a
speci$ic line $ro% your basic list to an interacti"e
list &hene"er the user double=clicks that
particular line
9'plain the runti%e beha"ior o$ your progra%
during the AT 24#9=S929CT47# e"ent
At the conclusion o$ this unit0 you &ill be able to:
<ser 8ialog 2ist: <nit 7b6ecti"es
>C? SAP AG BC400 "
9.3
SAP AG 2001
For%atted For%atted
output: output:
Print Print
For%atted output: For%atted output:
CA 48 P-4C9
AA 2*02 2400
AA 2*02 2)00

Total 1H00
Screen Screen 8isplay language= 8isplay language=
speci$ic te'ts in logon speci$ic te'ts in logon
language language
2ist Attributes
According to $i'ed According to $i'ed
user settings user settings
D""<"VD<
"V*D<*D""<
A%ounts according A%ounts according
to their currency to their currency
2engths according 2engths according
to their unit to their unit
8ate 8ate
0*e mai) &ur&!se !$ a list is t! 'is&lay 'ata %*ile i)+!l+i)5 a mi)imum am!u)t !$ &r!5rammi)5.
S&eial busi)ess 'ata reBuireme)ts are ta(e) i)t! a!u)tE
3ists are la)5ua5e:i)'e&e)'e)t. 0e6ts a)' *ea'ers a&&ear i) t*e l!5!) la)5ua5e %*e)e+er a
tra)slati!) is a+ailable.
3ists a) 'is&lay m!)etary +alues i) )umer!us urre)ies.
0*e $!ll!%i)5 !&ti!)s are a+ailable t! t*e user $!r listsE
Dis&layi)5 !) sree)sE y!u a) a'' !l!rs a)' i!)s
Pri)ti)5
Publis*i)5 !) /)ter)et !r i)tra)etE 0*e system aut!matially !)+erts lists t! <0M3.
Sa+i)5E @!u a) sa+e lists %it*i) t*e R/3 System as %ell as !utsi'e $!r $urt*er &r!essi)5- $!r
e6am&le- usi)5 s&rea's*eet &r!5rams
>C? SAP AG BC400 3
9.4
SAP AG 2001
Back > 9'it > Cancel
Scroll
Print
Find ,in list.
Sa"e
:
2ist
:
Syste% !!!
Standard 2ist Functions:
0*e sta)'ar' list i)ter$ae !$$ers t*e user se+eral )a+i5ati!) $eaturesE
Ba(
16it
Ca)el
Pri)t
9i)' >i) list?
Sa+e as a $ile- i) t*e me)u- !r t! a bu$$er
Se)' t*e list i) e:mail $!rm
@!u a) use t*e 7en$ Painter t! a'Gust t*e sta)'ar' list i)ter$ae t! $it y!ur i)'i+i'ual )ee's.
>C? SAP AG BC400 4
9.5
SAP AG 2001
2ist header
Colu%n header
Sa"e
:
2ist
:
Syste% !!! Te't ele%ents
Titles>headers
Fro% &ithin the list: Fro% the ABAP 9ditor:
2ist :eaders in the 8e$ault Page :eader
1a* list a) *a+e a lst header a)' u& t! $!ur li)es !$ column headers. @!u a) use t*ese t!!ls i)
t%! %aysE
9r!m t*e ABAP 1'it!rE ;se t*e te6t eleme)t mai)te)a)e $u)ti!)s. A ruler is a+ailable.
9r!m t*e listE /$ y!u sa+e y!ur program- act$ate it- a)' t*e) e"ecute it t! reate t*e list- y!u a)
aess t*e mai)te)a)e sree) by *!!si)5 &ystem +ist +ist hea!er. 0*e mai) a'+a)ta5e !$
usi)5 t*is met*!' is t*at t*e list is still 'is&laye' !) t*e sree). 0*is ma(es it easier t! &!siti!)
!lum) *ea'ers.
0*e )e6t time y!u start t*e &r!5ram- t*e )e% *ea'ers %ill a&&ear i) t*e list aut!matially.
/$ )! *ea'er te6t is e)tere'- t*e &r!5ram title is i)serte' i) t*e *ea'er.
>C? SAP AG BC400 5
9.6
SAP AG 2001
3RITE: *<O te?t1""<6
BO s'14at)m6
*<O te?t1""D6
BO s'1)name0
Te't ele%ents
Titles>headers Titles>headers
ABAP progra%
Te't sy%bols Te't sy%bols
89 creation date
9# creation date
F- !!!
89 Anlegen 8atu%
9# Creation date
F- !!!
:
9# Created by
00+
002
2ist header
Creation date: 0+>0+>200+
Created by: WA2T9-S
(ultilingual Capability o$ 2ists
te?t1""< te?t1""<
te?t1""D te?t1""D
Ttles and headers are &art !$ t*e &r!5ramIs te6t eleme)ts. @!u a) tra)slate all te6t eleme)ts i)t!
!t*er la)5ua5es. 0*e l!5!) la)5ua5e setti)5 !) t*e l!5!) sree) 'etermi)es i) %*i* la)5ua5e te6t
eleme)ts %ill be 'is&laye'.
Te"t symbols are a)!t*er (i)' !$ te6t eleme)t. 0e6t symb!ls are te6t literals t*at a) be tra)slate'
a)' are assi5)e' t! t*e &r!5ram. 0*ey are $reBue)tly use' t! reate lists i)'e&e)'e)t !$ la)5ua5e.
@!u a) %rite te6t symb!ls i)t! y!ur &r!5ram i) eit*er !$ t*e $!ll!%i)5 %aysE
TEXT1... > is a t*ree:byte *arater stri)5?
B%%%BA...C >... is a)y te6t- is a t*ree:'i5it *arater stri)5?
9r!m t*e 1'it!r- y!u a) aess t*e mai)te)a)e sree) $!r t*e te6t symb!ls by *!!si)5 8oto
Te1t elements Te1t symbols !r by '!uble:li(i)5 t*e )umber !$ a te6t symb!l.
>C? SAP AG BC400 6
9.7
SAP AG 2001
2ists in 9'ecutable Progra%s
Progra%
start


8atabase
tables
8ata ob6ects
ABAP runti%e syste%
ABAP progra%
2ist
bu$$er
STA-T=7F=S929CT47#!
S929CT !!!
W-4T9 !!!
Ti%e
/) e6eutable &r!5rams- lists are aut!matially 'is&laye' a$ter t*eir !rres&!)'i)5 e+e)t bl!(s
*a+e bee) &r!esse'. 0*ese &r!essi)5 bl!(s must- *!%e+er- !)tai) a stateme)t t*at %rites t!
t*e list bu$$er. 0*ese are 3RITE- S@IP- a)' ULINE.
1+e)t bl!(s are alle' i) a seBue)e 'esi5)e' $!r list &r!essi)5E
Be$!re t*e seleti!) sree)E LOAD1OF1PROGRAM.
A$ter t*e user lea+es t*e seleti!) sree)E START1OF1SELECTION.
All !ut&ut $r!m t*e e+e)t bl!(s t*at reate t*e lists >*ere !)ly START/OF/SELECTION? a)'
$r!m t*e m!'ulariCati!) u)its alle' t*ere- %*i* is &r!esse' be$!re a list is se)t- is
tem&!rarily st!re' i) t*e list bu$$er.
O)e all list reati!) e+e)t bl!(s >*ere !)ly START/OF/SELECTION? *a+e bee) &r!esse'-
all 'ata $r!m t*e list bu$$er is 'is&laye' i) t*e $!rm !$ a list.
>C? SAP AG BC400 A
9.8
SAP AG 2001
Creating 8etail 2ists
Ti%e


8atabase
tables
STA-T=7F=S929CT47#!
Basic
list
bu$$er

AT 24#9=S929CT47#!
8etail
list
bu$$er
/) e6eutable &r!5rams- y!u a) use t*e e+e)t bl!( AT LINE1SELECTION t! reate 'etail
lists.
0*e ABAP ru)time system e)sures t*atE
0*e basi list is se)t a$ter t*e e+e)t bl!(s res&!)sible $!r reati)5 t*e basi list *a+e
bee) &r!esse' >$!r e6am&le- a$ter START/OF/SELECTION?. /) t*is ase- t*e system $iel'
,$/&,"nd !)tai)s t*e +alue 0.
0*e e+e)t bl!( AT LINE/SELECTION is &r!esse' usi)5 t*e $u)ti!) !'e P/CS
ea* time y!u '!uble:li( a) e)try !r *!!se a) ati!) $!r t*e system t! &er$!rm. /$ y!u are
)!t usi)5 a user:'e$i)e' status- t*is *a&&e)s aut!matially e+ery time y!u *!!se Detail list
>i!) l!!(s li(e a ma5)i$yi)5 5lass?- t*e me)u $u)ti!) "hoose- !r t*e $u)ti!) (ey 9".
0*e 'etail list is se)t a$ter t*e AT LINE/SELECTION e+e)t bl!( is &r!esse' a)'
t*e +alue !)tai)e' i) ,$/&,"nd is i)rease' by !)e.
A$ter e+ery user ati!) %it* t*e $u)ti!) !'e BACS- t*e system 'is&lays t*e list at t*e
&re+i!us 'etail le+el >t*at is- it 5!es $r!m le+el n t! n24?.
>C? SAP AG BC400 8
9.9
SAP AG 2001
Basic list
sy=lsind

sy=lsind


sy=lsind

1
2
8etail 2ists: #a"igation
0
8etail list
8etail list
Basic list
First detail list
Second detail list
0*e lists i) t*e e6am&le &r!5ram s*!ul' $u)ti!) as $!ll!%sE
0*e basi list s*!ul' 'is&lay t*e te6t Basic list a)' t*e system $iel' ,$/&,"nd.
0*e user a) )a+i5ate t! a 'etail list by usi)5 a)y !$ t*e $!ll!%i)5E
D!uble:li(i)5 !) t*e basi list
C*!!si)5 Detail list >i!) l!!(s li(e a ma5)i$yi)5 5lass? i) t*e a&&liati!) t!!lbar
C*!!si)5 a me)u $u)ti!)
;si)5 $u)ti!) (ey 9". 0*e Detail list a&&ears a)' t*e system $iel' ,$/&,"nd *as t*e +alue #.
Re&eati)5 t*is ati!) alls t*e se!)' 'etail list- %*ere system $iel' ,$/&,"nd !)tai)s t*e +alue
" i)stea' >re&rese)ti)5 t*e urre)t 'etail list le+el?.
Re&eati)5 t*is ati!) i)reases t*e ,$/&,"nd +alue by !)e e+ery time. 0*is is &!ssible u& t! t*e
t%e)tiet* 'etail list.
C*!!si)5 Back ta(es t*e user ba( !)e si)5le 'etail list le+el at a time u)til t*e basi list is
rea*e'..
>C? SAP AG BC400 8
9.10
SAP AG 2001
000
START1OF1SELECTION0
3RITE: * te?t1""< COLOR $ol/&ea4#n(6
* 9s'1ls#n496
s'1ls#n4 $olo% D0
AT LINE1SELECTION0
3RITE: * te?t1""D COLOR $ol/&ea4#n(0
ULINE0
3RITE: * 9s'1ls#n496
s'1ls#n4 $olo% !0
Te't sy%bols:
00+
002
Basic list
8etail list
Synta' 9'a%ple: Si%ple 8etail 2ist
AT LINE1SELECTION0 AT LINE1SELECTION0
A 'etail list is &r!5ramme' as $!ll!%sE
@!u reate a basi list by $illi)5 t*e basi list bu$$er at a) a&&r!&riate e+e)t bl!( >*ere START/
OF/SELECTION? usi)5 eit*er WRITE9 SKIP- !r +LINE.
;se t*e e+e)t bl!( AT LINE/SELECTION %*e) &r!5rammi)5 'etail lists. .*e)e+er y!u use
WRITE9 SKIP- !r +LINE %it* t*is e+e)t bl!(- y!u $ill t*e 'etail list bu$$er $!r t*e )e6t le+el >t*e
'etail list bu$$er %it* a le+el +alue !)e 5reater t*a) t*e le+el !) %*i* t*e user &er$!rme' t*e
ati!)?.
@!u a) &re:'etermi)e )a+i5ati!) bet%ee) 'etail lists by Bueryi)5 system $iel' ,$/&,"nd at t*e
e+e)t bl!( AT LINE/SELECTION.
>C? SAP AG BC400 #0
9.11
SAP AG 2001
A"rl. Fl"(h! Fro* ,o De$ar!"n( a!
/B 0400 FRA Frank-ur! GF> ?e; Cork 10:10:00
/B 0400 FRA Frank-ur! GF> ?e; Cork 13:30:00
...
S1 0002 S0? S"n(a$ore SF8 San Franc"sco 09:30:00

Cou ha)e chosen /B 0402
Fl"(h! a!e
19.12.2001
20.12.2001
24.12.2001
'a2.
3=0
3=0
3=0
8cc.
240
2<0
3=0
9'a%ple: 8etail 2ist
Ti%etable Ti%etable
8etail: Flights 8etail: Flights
@!u %ill )!% %rite a &r!5ram usi)5 b!t* basi lists a)' 'etail lists.
0*e basi list i) y!ur &r!5ram s*!ul' !)tai) $li5*t 'ata su* as arrier /D a)' $li5*t )umbers-
'e&arture ity a)' air&!rt- 'esti)ati!) ity a)' air&!rt- a)' 'e&arture a)' arri+al times. 0*is 'ata a)
be $!u)' i) t*e 'atabase table SP93/.
0*e user s*!ul' be able t! aess i)$!rmati!) ab!ut a)y &artiular $li5*t by '!uble:li(i)5 its
arrier /D a)' $li5*t )umber. 9li5*t 'ate a)' !u&a)y s*!ul' be 'is&laye'. 0*is 'ata a) be $!u)'
i) t*e 'atabase table S93/G<0. @!u must use t*e SP93/ (ey $iel's i) t*is 'etail list i) !r'er t! rea'
t*e a&&r!&riate 'ata i) S93/G<0. 0*e $!ll!%i)5 5ra&*is 'em!)strate *!% t*is is '!)e.
0*e e6am&le &r!5ram is SAPBC400;DDUD10A/3U3/S0 a)' it is &art !$ 'e+el!&me)t lass
BC400.
>C? SAP AG BC400 ##
9.12
SAP AG 2001
AA 00+1 IFE SF7 +3:30:00
2: 0400 F-A IFE +0:+0:00
2: 0402 F-A IFE +3:30:00
: : : : :
Bu$$ering lobal 8ata in the :ide Area
HIDE +#el4name0
SELECT $a%%#4 $onn#4
a#%p+%om a#%pto 4ept#me
FROM sp+l#
INTO CORRESPONDING FIELDS OF
.a/sp+l#0
3RITE: * .a/sp+l#1$a%%#46
.a/sp+l#1$onn#46
.a/sp+l#1a#%p+%om6
.a/sp+l#1a#%pto6
.a/sp+l#14ept#me0
: .a/sp+l#1$a%%#46
.a/sp+l#1$onn#40
ENDSELECT0
AT LINE1SELECTION0
2ine
3
3
4
4
)
)
:
Field na%e
&aCsp$li=carrid
&aCsp$li=connid
&aCsp$li=carrid
&aCsp$li=connid
&aCsp$li=carrid
&aCsp$li=connid
:
?alue
AA
00+1
2:
0400
2:
0402
:
:ide area
HIDE HIDE
1
2
3
4
%
:
Current list bu$$er
CA- 48 Fro% To 8eparting at CA- 48 Fro% To 8eparting at
) )
) )
) )
.*e) t*e e+e)t A0 3/N1:S131C0/ON is &r!esse'- a &r!5ramIs 'ata !bGets !)tai) t*e same
+alues as be$!re basi list 'is&lay. A 'etail list- *!%e+er- !$te) )ee's 'ata selete' %it*i) t*e basi
list itsel$. @!u a) use t*e </D1 area t! st!re ertai) 'ata $r!m t*e li)e t*at y!u *a+e selete' a)'
t*e) aut!matially i)sert it %*ere y!u )ee' it i) t*e !rres&!)'i)5 'ata !bGet $!r a 'etail list.
0! &re'etermi)e %*i* i)$!rmati!) is lassi$ie' by its li)e &!siti!) %*e) y!u reate a basi list- use
t*e ABAP (ey%!r' </D1 $!ll!%e' by a list !$ t*e 'ata !bGets y!u reBuire. 0*e ru)time system
aut!matially re!r's t*e )ame a)' !)te)ts !$ t*e 'ata !bGet i) relati!) t! its li)e &!siti!) i) t*e
list urre)tly bei)5 reate'.
0*e </D1 5l!balU$iel' stateme)t bu$$ers t*e !)te)t !$ t*e 5l!bal 'ata $iel' 5l!balU$iel' %it*
re$ere)e t! t*e urre)t 'is&lay li)e. @!u '! )!t *a+e t! 'is&lay t*e $iel' be$!re*a)' usi)5 t*e
.R/01 stateme)t. @!u merely *a+e t! &r!5ram t*e </D1 stateme)ts a$ter t*e last .R/01 stateme)t
i) t*e urre)t li)e.
0*e 'ata $iel' a) als! be a $lat struture.
>C? SAP AG BC400 #"
9.13
SAP AG 2001
000
AT LINE1SELECTION0
3RITE: te?t1""<6
.a/sp+l#1$a%%#46
.a/sp+l#1$onn#40
#AR 0D Fro* ,o De$ar!"n( a!
AA 001< GF> SF8 13:30:00
/B 0400 FRA GF> 10:10:00
/B 0402 FRA GF> 13:30:00
...
S1 0002 S0? SF8 09:30:00
&aCsp$li 2: 0400 @@ @@ @@ @@
Te't sy%bols:
00+ Flights $or connection
2ine Selection
AT LINE1SELECTION0 AT LINE1SELECTION0
2ine
3
3
4
4
)
)
:
+4
+4
Field na%e
&aCsp$li=carrid
&aCsp$li=connid
&aCsp$li=carrid
&aCsp$li=connid
&aCsp$li=carrid
&aCsp$li=connid
:
&aCsp$li=carrid
&aCsp$li=connid
?alue
AA
00+1
2:
0400
2:
0402
:
SF
0002
:ide area
CA- 48 Fro% To 8eparting at CA- 48 Fro% To 8eparting at
.*e) y!u selet a li)e >by &!i)ti)5 t! it $!ll!%e' by P/CS !r '!uble:li(?- t*is tri55ers t*e e+e)t
AT LINE/SELECTION.
9irst t*e +alues $!r t*is li)e bu$$ere' i) t*e </D1 area are i)serte' back nto the correspondng
global data ob,ects.
0*e) t*e system &r!esses t*e rele+a)t e+e)t bl!( i) t*e ABAP &r!5ram.
>C? SAP AG BC400 #3
9.14
SAP AG 2001
000
AT LINE1SELECTION0
IF s'1ls#n4 7 <0
3RITE: te?t1""<6
.a/sp+l#1$a%%#46
.a/sp+l#1$onn#40
SELECT +l4ate seatsma? seatso$$
FROM s+l#(&t
INTO CORRESPONDING FIELDS OF .a/s+l#(&t
3HERE $a%%#4 7 .a/sp+l#1$a%%#4
AND $onn#4 7 .a/sp+l#1$onn#40
3RITE:* .a/s+l#(&t1+l4ate6
.a/s+l#(&t1seatsma?6
.a/s+l#(&t1seatso$$0
ENDSELECT0
ENDIF0
Te't sy%bols:
00+ Flights $or connection
AT LINE1SELECTION0 AT LINE1SELECTION0
Synta' 9'a%ple: Additional 8ata $or Selected 2ine
@!u reate a 'etail list by $illi)5 t*e 'etail list bu$$er at t*e AT LINE/SELECTION e+e)t bl!(
usi)5 eit*er WRITE- SKIP- !r +LINE.
/) t*e e6am&le &r!5ram- t*e (ey $iel's !$ t*e airli)e %ill be 'is&laye'. 0*e $li5*ts a+ailable $!r t*is
airli)e i) t*e 'atabase table SFLIG0T are rea' usi)5 a SELECT l!!&.
N!te t*at t*e li)e:s&ei$i i)$!rmati!) !) t*e airli)e is !)ly a+ailable by '!uble:li(i)5 i) t*e 'ata
!bGets i$ t*e rele+a)t 'ata !bGets *a+e bee) &lae' i) t*e </D1 area %*e) t*e basi list %as
reate'.
>C? SAP AG BC400 #4
9.15
SAP AG 2001
8escribe list attributes and strengths
Write a progra% that displays the details o$ a
speci$ic line $ro% your basic list to an interacti"e
list &hene"er the user double=clicks that
particular line
9'plain the runti%e beha"ior o$ your progra%
during the AT 24#9=S929CT47# e"ent
Aou are no& able to:
<ser 8ialog 2ist: <nit Su%%ary
>C? SAP AG BC400 #5
9.166ser 'ia%o* +ist E$ercises
1nt: 1ser 3alog 4st
Topc: 3etal 4sts
At t*e !)lusi!) !$ t*ese e6erises- y!u %ill be able t!E
Create a 'etail list i) a &r!5ram
16te)' t*e &r!5ram =C!""/>>/SELECT/SFLIGHT !r t*e
!rres&!)'i)5 m!'el s!luti!) as $!ll!%sE
O)e t*e user *as selete' a $li5*t !) t*e basi list >'!uble:li( !r 9" !)
t*e rele+a)t list li)e?- 'is&lay a 'etail list !)tai)i)5 all !$ t*e b!!(i)5s
$!r t*e selete' $li5*t.
0em&lateE =C!""/>>/SELECT/SFLIGHT !r
SAPBC400DDS_A+T0ORITY_C0ECK
Program: =C!""/>>/DETAIL/LIST
)odel soluton: SAPC!""UDS/DETAIL/LIST
#:# C!&y y!ur &r!5ram =C!""/>>/SELECT/SFLIGHT !r t*e !rres&!)'i)5
tem&late SAPC!""DDS/AUTHORITY/CHEC@ t! t*e )e% &r!5ram
=C!""/>>/DETAIL/LIST.
#:" Ma(e sure t*at t*e (ey $iel's !$ t*e 'atabase table SFLIGHT are a+ailable t! y!u
$!r reati)5 t*e 'etail list %*e) t*e user selets a $li5*t $r!m t*e basi list >'!uble:
li( !r 9" !) t*e !rres&!)'i)5 list li)e?.
#:3 A'' t*e AT LINE1SELECTION e+e)t t! y!ur &r!5ram t! all!% y!u t! !)strut a
'etail list.
#:4 /) t*e $irst li)e !$ t*e 'etail list- 'is&lay (ey i)$!rmati!) $r!m t*e selete' $li5*t.
;)'er t*is li)e- 'is&lay a *!riC!)tal li)e a)' a bla)( li)e.
#:5 Rea' all !$ t*e b!!(i)5s $r!m 'atabase table SOO@ $!r t*e selete' $li5*t. Ma(e
sure t*at y!u rea' !)ly t*!se $iel's $r!m t*e 'atabase table t*at y!u %a)t t! 'is&lay
i) t*e list. Dis&lay t*e $!ll!%i)5 $iel's $r!m t*e 'atabase table SOO@ !) t*e 'etail
listE
OO@ID6
CUSTOMID6
CUSTTYPE
CLASS6
>C? SAP AG BC400 #6
ORDER/DATE6
SMO@ER6
CANCELLED0
#:6 +ptonal: Dis&lay t*e $iel's LOCCURAM a)' LOCCUR@EY !) t*e 'etail listE
1)sure t*at t*e urre)y am!u)t LOCCURAM is 'is&laye' %it* t*e a&&r!&riate
$!rmatti)5 $!r t*e urre)y LOCCUR@EY. ;se t*e a''iti!) CURRENCY
K$)%%en$'/Me'L i) t*e 3RITE stateme)t.
("ampleE
WRITE= ;a_,!&"'(#/p".e C+RRENCY ;a_,!&"'(#/.-en.$8
;a_,!&"'(#/.-en.$%
#:A +ptonal: Dis&lay t*e OO@ID $iel' i) t*e !l!r COL/@EY.
>C? SAP AG BC400 #A
9.176ser 'ia%o* +ist So%&tions
1nt: 1ser 3alog 4st
Topc: 3etal 4sts
)odel soluton #thout optonal e"ercses: SAPC!""UDS/DETAIL/LIST
<D//////////////////////////////////////////////////////////////<
<D Repo# SAPBC400+DS_DETAIL_LIST <
<D <
<D//////////////////////////////////////////////////////////////<
REPORT ,ap).400-d,_de#a"&_&",#%
CONSTANTS= a.#4#_d",p&a$ TYPE a.#"4_a-#( *AL+E B07B%
DATA= ;a_!&"'(# TYPE ,).400!o..8
.a/s,ooM TYPE s,ooM0
PARAMETERS= pa_.a TYPE ,_.a_"d%
START/OF/SELECTION%
A+T0ORITY/C0ECK OBEECT BS_CARRIDB
ID BCARRIDB FIELD pa_.a
ID BACT*TB FIELD a.#4#_d",p&a$%
CASE ,$/,-).%
W0EN 0%
SELECT .a"d .onn"d !&da#e ,ea#,ma1 ,ea#,o.. FROM ,!&"'(#
INTO CORRESPONDING FIELDS OF ;a_!&"'(#
W0ERE .a"d > pa_.a%
;a_!&"'(#/pe.en#a'e >
500 < ;a_!&"'(#/,ea#,o.. ? ;a_!&"'(#/,ea#,ma1%
WRITE= ? ;a_!&"'(#/.a"d8
;a_!&"'(#/.onn"d8
;a_!&"'(#/!&da#e8
;a_!&"'(#/,ea#,o..8
;a_!&"'(#/,ea#,ma18
;a_!&"'(#/pe.en#a'e8BCB%
2 H#4e Me' +#el4 val)es $o%%espon4#n( to t&e a$t)al l#ne
HIDE: .a/+l#(&t1$a%%#46 .a/+l#(&t1$onn#46
.a/+l#(&t1+l4ate0
ENDSELECT%
W0EN OT0ERS%
WRITE= ? BA-#(o"#$/C(e.9 EoBF005G%
ENDCASE%
CLEAR ;a_!&"'(#%
2 P%o(%am $ont#n)es &e%e6 #+ a l#ne #s sele$te4 on ,as#$ l#st
AT LINE1SELECTION0
IF s'1ls#n4 7 <0
>C? SAP AG BC400 #8
2 @e' +#el4s t%anspo%te4 ,a$M +%om &#4e a%ea to AAP 4ata o,-e$ts
3RITE: * .a/+l#(&t1$a%%#46
.a/+l#(&t1$onn#46
.a/+l#(&t1+l4ate0
ULINE0
S@IP0
2 Sele$t#on o+ ,ooM#n(s6 .&#$& 4epen4 on sele$te4 +l#(&t
SELECT ,ooM#4 $)stom#4 $)stt'pe $lass o%4e%/4ate
smoMe% $an$elle4 lo$$)%am lo$$)%Me'
FROM s,ooM INTO CORRESPONDING FIELDS OF .a/s,ooM
3HERE $a%%#4 7 .a/+l#(&t1$a%%#4
AND $onn#4 7 .a/+l#(&t1$onn#4
AND +l4ate 7 .a/+l#(&t1+l4ate0
2 C%eat#on o+ 4eta#l l#st
3RITE: * .a/s,ooM1,ooM#46
.a/s,ooM1$)stom#46
.a/s,ooM1$)stt'pe6
.a/s,ooM1$lass6
.a/s,ooM1o%4e%/4ate6
.a/s,ooM1smoMe%6
.a/s,ooM1$an$elle40
ENDSELECT0
ENDIF0
CLEAR ;a_!&"'(#%
>C? SAP AG BC400 #8
)odel soluton #th optonal e"ercses: SAPC!""UDS/DETAIL/LIST<
<D//////////////////////////////////////////////////////////////<
<D Repo# SAPBC400+DS_DETAIL_LIST5 <
<D <
<D//////////////////////////////////////////////////////////////<
REPORT ,ap).400-d,_de#a"&_&",#5%
CONSTANTS= a.#4#_d",p&a$ TYPE a.#"4_a-#( *AL+E B07B%
DATA= ;a_!&"'(# TYPE ,).400!o..8
;a_,)oo9 TYPE ,)oo9%
PARAMETERS= pa_.a TYPE ,_.a_"d%
START/OF/SELECTION%
A+T0ORITY/C0ECK OBEECT BS_CARRIDB
ID BCARRIDB FIELD pa_.a
ID BACT*TB FIELD a.#4#_d",p&a$%
CASE ,$/,-).%
W0EN 0%
SELECT .a"d .onn"d !&da#e ,ea#,ma1 ,ea#,o.. FROM ,!&"'(#
INTO CORRESPONDING FIELDS OF ;a_!&"'(#
W0ERE .a"d > pa_.a%
;a_!&"'(#/pe.en#a'e >
500 < ;a_!&"'(#/,ea#,o.. ? ;a_!&"'(#/,ea#,ma1%
WRITE= ? ;a_!&"'(#/.a"d8
;a_!&"'(#/.onn"d8
;a_!&"'(#/!&da#e8
;a_!&"'(#/,ea#,o..8
;a_!&"'(#/,ea#,ma18
;a_!&"'(#/pe.en#a'e8BCB%
2 H#4e Me' +#el4 val)es $o%%espon4#n( to t&e a$t)al l#ne
0IDE= ;a_!&"'(#/.a"d8 ;a_!&"'(#/.onn"d8 ;a_!&"'(#/!&da#e%
ENDSELECT%
W0EN OT0ERS%
WRITE= ? BA-#(o"#$/C(e.9 EoBF005G%
ENDCASE%
CLEAR ;a_!&"'(#%
2 P%o(%am $ont#n)es &e%e6 #+ a l#ne #s sele$te4 on ,as#$ l#st
AT LINE/SELECTION%
IF ,$/&,"nd > 5%
2 @e' +#el4s t%anspo%te4 ,a$M +%om &#4e a%ea to AAP 4ata o,-e$ts
WRITE= ? ;a_!&"'(#/.a"d8 ;a_!&"'(#/.onn"d8 ;a_!&"'(#/!&da#e%
+LINE%
SKIP%
2 Sele$t#on o+ ,ooM#n(s6 .&#$& 4epen4 on sele$te4 +l#(&t
SELECT )oo9"d .-,#om"d .-,##$pe .&a,, ode_da#e
,mo9e .an.e&&ed &o..-am &o..-9e$
FROM ,)oo9 INTO CORRESPONDING FIELDS OF ;a_,)oo9
W0ERE .a"d > ;a_!&"'(#/.a"d
AND .onn"d > ;a_!&"'(#/.onn"d
AND !&da#e > ;a_!&"'(#/!&da#e%
2 C%eat#on o+ 4eta#l l#st
WRITE= ? ;a_,)oo9/)oo9"d COLOR COL/@EY8
;a_,)oo9/.-,#om"d8
;a_,)oo9/.-,##$pe8
>C? SAP AG BC400 "0
;a_,)oo9/.&a,,8
;a_,)oo9/ode_da#e8
;a_,)oo9/,mo9e8
;a_,)oo9/.an.e&&ed8
.a/s,ooM1lo$$)%am CURRENCY .a/s,ooM1lo$$)%Me'6
.a/s,ooM1lo$$)%Me'0
ENDSELECT%
ENDIF%
CLEAR ;a_!&"'(#%
>C? SAP AG BC400 "#
+0
SAP AG 2001
Selection screen attributes and strengths
8e$ining selection screens
9"aluating user input to restrict database selection
Selection screen e"ents
Synta' e'a%ples: Additional input checks &ith error
dialog
Contents:
<ser 8ialog Selection Screen
>C? SAP AG BC400 #
10.2
SAP AG 2001
8escribe selection screen attributes and
strengths
Write a progra% that allo&s you to enter inter"als
on a selection screen and that can be used to
restrict the nu%ber o$ data records retrie"ed $ro%
the database
Write a progra% that contains additional input
checks $or the selection screen and returns to the
selection screen i$ an error occurs
At the conclusion o$ this unit0 you &ill be able to:
<ser 8ialog 2ist: <nit 7b6ecti"es
>C? SAP AG BC400 "
10.3
SAP AG 2001
<se o$ Selection Screens


8atabase
table
ABAP
processing
block
ABAP runti%e syste%
ABAP progra%
Selection criteria
Seleti!) sree)s all!% users t! e)ter seleti!) riteria reBuire' by t*e &r!5ram $!r it t! !)ti)ue.
9!r e6am&le- i$ y!u reate a list !)tai)i)5 'ata $r!m a +ery lar5e 'atabase table- y!u a) use a
seleti!) sree) t! restrit t*e am!u)t !$ 'ata t*at is selete'. At ru)time- t*e user a) selet i)ter+als
$!r !)e !$ t*e (ey $iel's- a)' !)ly 'ata t*at !rres&!)'s t! t*is seleti!) is rea' $r!m t*e 'atabase
a)' 'is&laye' i) t*e list. 0*is !)si'erably re'ues t*e l!a' !) t*e 'atabase a)' )et%!r(.
>C? SAP AG BC400 3
10.4
SAP AG 2001
7"er"ie&: Selection Screen Attributes
Selection Screen Attributes
Selection Screen Attributes
Single Fields ,PA-A(9T9-S.
Single Fields ,PA-A(9T9-S.
?alue Sets ,S929CT=7PT47#S.
?alue Sets ,S929CT=7PT47#S.
Selection Screen 9"ents
Selection Screen 9"ents
>C? SAP AG BC400 4
10.5
SAP AG 2001
Dalue Dalue en!r& en!r&
'ul!"l"n(ual #a$ac"!& 'ul!"l"n(ual #a$ac"!&
Dar"an!s Dar"an!s
Poss"ble Poss"ble
en!r"es en!r"es
hel$ hel$
,&$e checks ,&$e checks
Selection Screen Attributes
0n$u! hel$ 0n$u! hel$
@
Seleti!) sree)s are i)&ut mas(s $!r +alue sets t*at restrit t*e am!u)t !$ 'ata rea' $r!m t*e
'atabase. 0*e $!ll!%i)5 &!ssibilities are a+ailable t! t*e userE
1)tries i) si)5le $iel's
Comple" entresE /)ter+als- !&erati!)s- &atter)s
Sa+i)5 $ille' seleti!) $iel's as $arants
/)&ut *el& a)' sear* *el&s are a+ailable by *!!si)5 t*e 94 $u)ti!) (ey !r t*e &!ssible e)tries
&us*butt!)
@!u a) tra)slate selecton te"ts i)t! !t*er la)5ua5es s! t*at t*ey are t*e) 'is&laye' i) t*e la)5ua5e
i) %*i* t*e user is l!55e' !).
0*e system *e(s t*e ty&eE /$ y!u e)ter a +alue %it* a) i)!rret ty&e- t*e system 'is&lays a) err!r
messa5e a)' ma(es t*e $iel' rea'y $!r )e% i)&ut.
>C? SAP AG BC400 5
10.6
SAP AG 2001
SELECT1OPTIONS 000
PARAMETERS 000
Single "alue
reater than or e5ual

reater than
2ess than
#ot e5ual
2ess than or e5ual
9'clude $ro% selection
8eparture city
Airline 2:
Select
Airline
(ultiple single "alues
4nter"als
Single "alue e'clusion
4nter"al e'clusion
9ntering ?alue Sets
to
(aintain selection options
Seleti!) sree)s all!% y!u t! 'e$i)e seleti!) !&ti!)s $!r !m&le6 e)tries as %ell as sim&le i)&ut
$iel's.
Setti)5 seleti!) !&ti!)s
1)teri)5 multi&le +alues !r i)ter+als
De$i)i)5 a +alue set t*at is )!t t! be selete' a)' is t! be subtrate' $r!m t*e +alue set t! be
selete' at t*e e)'.
1+ery seleti!) sree) !)tai)s a) i)$!rmati!) i!). C*!!se t*is i!) t! 'is&lay a''iti!)al
i)$!rmati!).
>C? SAP AG BC400 6
10.7
SAP AG 2001
<sing the Se%antic 4n$or%ation o$ lobal Types
Selection screen
Airline
lobal types
H Field label
H 4nput help
H Search help TSearch helpU
8ata ele%ent 8ata ele%ent
Structure Structure
ABAP progra%
PARAMETERS pa/$a%% TYPE sp+l#1$a%%#40
H Technical type
Se%antic
in$or%ation
Technical
in$or%ation:
For%atting
rules
/$ a) i)&ut $iel' is ty&e' %it* a data element- t*e $!ll!%i)5 a''iti!)al sema)ti i)$!rmati!) is
a+ailableE
@!u a) use a feld name as a seleti!) te6t
2nput help >9# *el&? $r!m t*e 'ata eleme)t is a+ailable aut!matially
Possble entres help >94 *el&? is a+ailable aut!matially- &r!+i'e' t*e 'ata eleme)t *as bee)
li)(e' %it* a sear* *el&. A sear* *el& is a sta)'al!)e !bGet 'e$i)e' i) t*e Diti!)ary- %*i*
!)tr!ls t*e 'ial!5 %it* t*e user a)' 'ata retrie+al $!r t*e &!ssible e)tries *el&.
/$ a) i)&ut $iel' is ty&e' %it* a structure feld t*at uses a 'ata eleme)t- t*e $!ll!%i)5 sema)ti
i)$!rmati!) is a+ailableE
*eld names a)' nput help >9# *el&? are !&ie' $r!m t*e 'ata eleme)t t*at *as bee) use' t! ty&e
t*e Diti!)ary struture $iel'.
/$ a struture $iel' is !u&le' %it* a sear* *el&- t*e) t*is is t*e sear* *el& t*at is use' $!r t*e
possble entres help >94 *el&? : t*at is- it !bsures t*e 'ata eleme)t sear* *el&. /$ t*ere is )!
sear* *el& !u&le' %it* t*e struture $iel'- t*e system uses t*e 'ata eleme)t sear* *el&.
Bear i) mi)' t*at t*e 5l!bal ty&e y!u *!!se t! &r!+i'e a ty&e $!r a) i)&ut $iel' a$$ets t*e sema)ti
i)$!rmati!) a+ailable t! t*e user.
9!r m!re i)$!rmati!)- re$er t! t*e !)li)e '!ume)tati!) $!r t*e ABAP Diti!)ary.
>C? SAP AG BC400 A
10.8
SAP AG 2001
Te't ele%ents
Titles>headers
ABAP progra%
Te't sy%bols
S7CCA--
PACC4TA
Selection te'ts
89
9# Airline
89
9# 8eparture city
(ultilingual capacity (ultilingual capacity
000
SELECT1OPTIONS so/$a%% FOR 000
PARAMETERS pa/$#t' TYPE 000
Selection Te'ts
8eparture city
Airline 2: to
8ictionary re$erence
Source code
O) t*e seleti!) sree)- t*e $iel' )ames a&&ear as te6t )e6t t! t*e i)&ut $iel's. <!%e+er- y!u a)
re&lae t*ese %it* seleti!) te6ts- %*i* y!u a) t*e) tra)slate i)t! a)y $urt*er la)5ua5es y!u
reBuire. Seleti!) te6ts are 'is&laye' i) t*e userIs l!5!) la)5ua5e.
/$ t*e i)&ut $iel' is ty&e' 'iretly !r i)'iretly %it* a 'ata eleme)t- y!u a) !&y t*e $iel' )ame $r!m
!)e !$ t*e te6ts st!re' i) t*e Diti!)ary.
>C? SAP AG BC400 8
10.9
SAP AG 2001
?ariants
Create a "ariant:
H Fill out the selection screen
H Sa"e as a "ariant
H 9nter a "ariant na%e
H (eaning: 9nter a descripti"e short te't
H Aou can also choose other attributes
Create a "ariant:
Create a "ariant:
H Start the progra%

H Choose the icon on the selection screen

H Choose a "ariant by na%e
H The syste% copies the "alues to the input $ields
<se the "ariant:
8eparture city
Airline 2: to
/$ y!u %a)t t! sa+e t*e +alues >!r s!me !$ t*e +alues? !) a seleti!) sree) t*at y!u *a+e $ille' !ut-
y!u a) '! s! by reati)5 a +aria)t. .*e) y!u start t*e &r!5ram a5ai) later- y!u a) 5et t*ese +alues
$r!m t*e +aria)t a)' 'is&lay t*em i) t*e seleti!) sree).
@!u a) 'e$i)e a)' sa+e +aria)ts $!r a)y &r!5ram t*at !)tai)s a seleti!) sree). @!u '! t*is by
starti)5 t*e &r!5ram a)' t*e) reati)5 a +aria)t by *!!si)5 8oto 5ariants &ave as variant.
7aria)ts all!% y!u t! tail!r seleti!) sree)s t! suit y!ur )ee's. @!u a)E
Preassi5) +alues $!r i)&ut $iel's
<i'e i)&ut $iel's
A si)5le +aria)t a) re$er t! m!re t*a) !)e seleti!) sree) i) t*e same &r!5ram.
7aria)ts are lie)t:s&ei$i.
1+ery seleti!) sree) !)tai)s a) i)$!rmati!) i!). C*!!se t*is i!) t! 'is&lay a''iti!)al
i)$!rmati!).
>C? SAP AG BC400 8
10.10
SAP AG 2001
Single Fields ,PA-A(9T9-S.
Selection Screen Attributes
Selection Screen Attributes
Single Fields ,PA-A(9T9-S.
Single Fields ,PA-A(9T9-S.
?alue Sets ,S929CT=7PT47#S.
?alue Sets ,S929CT=7PT47#S.
Selection Screen 9"ents
Selection Screen 9"ents
>C? SAP AG BC400 #0
10.11
SAP AG 2001
9$$ect o$ the PA-A(9T9-S State%ent
PA-A(9T9-S paCcar
TAP9 sCcarrCid!
ABAP progra%
PARAMETERS PARAMETERS
paCcar
8eclarati"e state%ents
Selection
screen
-e$erence to
ABAP 8ictionary
SCCA--C48
/) a) e6eutable &r!5ram- a si)5le PARAMETERS stateme)t is su$$iie)t t! 5e)erate a sta)'ar'
seleti!) sree).
0*e PARAMETERS Lname3 TYPE 2#$pename3 stateme)t a)' t*e PARAMETERS
2name3 LIKE Kda#a_o)He.#3 stateme)t b!t* 5e)erate a) eleme)tary i)&ut $iel' !) t*e
seleti!) sree)- a)' a 'ata !bGet %it* t*e same ty&e.
/$ t*e user e)ters a +alue a)' *!!ses E1ec$te- t*at +alue is &lae' i) t*e i)ter)al 'ata !bGet L)ameM
i) t*e &r!5ram. 0*e system &ermits !)ly e)tries %it* t*e !rret ty&e.
>C? SAP AG BC400 ##
10.12
SAP AG 2001
-unti%e Beha"ior and 8ata Transport: Para%eters


ABAP runti%e syste%
ABAP progra%
ABAP
processing
block
Ti%e
Selection
screen
8escription o$
selection screen
paCcar
O)e t*e LOAD1OF1PROGRAM e+e)t bl!( *as bee) &r!esse'- t*e seleti!) sree) is se)t t! t*e
&rese)tati!) ser+er. 0*e ru)time system tra)s&!rts t*e 'ata !bGet +alues t*at are 'e$i)e' usi)5
PARAMETERS t! t*e seleti!) sree) i)&ut $iel's !$ t*e same )ame.
0*e user a) t*e) *a)5e t*e +alues i) t*e i)&ut $iel's. /$ t*e user t*e) li(s !) t*e E1ec$te
$u)ti!)- t*e i)&ut $iel' +alues are tra)s&!rte' t! t*e &r!5ram 'ata !bGets %it* t*e same )ame a)'
a) be e+aluate' i) t*e ABAP &r!essi)5 bl!(s.
>C? SAP AG BC400 #"
10.13
SAP AG 2001
<sing Para%eters When Accessing the 8atabase
REPORT 000
DATA .a/sp+l# TYPE sp+l#0
PARAMETERS pa/$a% TYPE s/$a%%/#40
000
SELECT $a%%#4 $onn#4 $#t'+%om $#t'to 000
FROM sp+l#
INTO CORRESPONDING FIELDS OF .a/sp+l#
3HERE $a%%#4 7 pa/$a% 0
3RITE: * .a/sp+l#1$a%%#46 .a/sp+l#1$onn#46
.a/sp+l#1+l4ate6 000 0
ENDSELECT 0
3HERE 3HERE $a%%#4 $a%%#4 7 7 pa pa/ /$a% $a%
SELECT SELECT
ENDSELECT ENDSELECT
/$ y!u *a+e use' t*e PARAMETERS stateme)t t! &r!5ram a) i)&ut $iel' as a (ey $iel' $!r a 'atabase
table- y!u a) use a 3HERE lause at t*e SELECT stateme)t t! limit 'ata seleti!) t! t*is +alue.
/) t*e e6am&le ab!+e !)ly t*!se 'ata re!r's are rea' $r!m 'atabase table SPFLI %*!se (ey $iel'
CARRID *as t*e same +alue as is !)tai)e' i) 'ata !bGet pa/$a% at ru)time.
>C? SAP AG BC400 #3
10.14
SAP AG 2001
?alue Sets ,S929CT=7PT47#S.
Selection Screen Attributes
Selection Screen Attributes
Single Fields ,PA-A(9T9-S.
Single Fields ,PA-A(9T9-S.
?alue Sets ,S929CT=7PT47#S.
?alue Sets ,S929CT=7PT47#S.
Selection Screen 9"ents
Selection Screen 9"ents
>C? SAP AG BC400 #4
10.15
SAP AG 2001
9$$ect o$ the S929CT=7PT47#S State%ent
ABAP progra%
soCcarr
Selection
screen
gdCcarrid
8ATA gdCcarrid TAP9 sCcarrCid!
S929CT=7PT47#S soCcarr
F7- gdCcarrid!
8eclarati"e state%ents
SELECT1OPTIONS SELECT1OPTIONS
sign lo& high
7ption
-e$erence to
ABAP 8ictionary
(4 (4
SCCA--C48
@!u use t*e SELECT1OPTIONS )ame FOR 'ataU!bGet stateme)t t! 'e$i)e seleti!) !&ti!)sE 0%!
i)&ut $iel's %it* t*e same ty&e as t*e 'ata !bGet a&&ear !) t*e seleti!) sree)- all!%i)5 y!u t!
e)ter i)ter+al limits. A''iti!)ally- a butt!) a&&ears t*at all!%s y!u t! realiCe !m&le6 set limits.
0*e stateme)t als! 'elares a) i)ter)al table )ame %it*i) t*e &r!5ram- %it* t*e $!ll!%i)5 $!ur
!lum)sE
s#(nE 0*is $iel' 'esi5)ates %*et*er t*e +alue !r i)ter+al s*!ul' be i)lu'e' >2? i) !r e6lu'e'
>(? $r!m t*e seleti!).
opt#on $!r t*e !&erat!r >T- ...?E 9!r a list !$ &!ssible !&erat!rs- re$er t! t*e (ey%!r'
'!ume)tati!) $!r t*e SELECT1OPTIONS stateme)t.
lo.E 0*is $iel' !)tai)s t*e l!%er limit !$ a) i)ter+al !r si)5le +alue.
&#(&E 0*is $iel' !)tai)s t*e u&&er limit !$ a) i)ter+al.
0*is seleti!) table )ame al%ays re$ers t! a 'ata !bGet t*at *as alrea'y bee) 'e$i)e'. 0*e 'ata
!bGet is use' as a tar5et $iel' 'uri)5 'atabase seleti!)- %*ile t*e seleti!) table is a set !$ &!ssible
+alues. 9!r t*is reas!) a s&eial +ersi!) !$ t*e 3HERE lause e6ists $!r 'atabase seleti!). /t
'etermi)es %*et*er !r )!t t*e 'atabase !)tai)s t*e !rres&!)'i)5 $iel' %it*i) t*e $alue set.
N!teE
Similarly- a) i)lusi!) test is als! 'e$i)e' $!r t*e IF stateme)t.
>C? SAP AG BC400 #5
10.16
SAP AG 2001
-unti%e Beha"ior and 8ata Transport: Selection 7ptions


ABAP runti%e syste%
ABAP progra%
ABAP
processing
block
Selection
screen
Ti%e
gdCcarrid
8escription o$
selection screen
soCcarr
/$ t*e user e)ters se+eral +alues !r i)ter+als $!r a seleti!) !&ti!) a)' *!!ses E1ec$te- t*e system
&laes t*em i) t*e i)ter)al table.
>C? SAP AG BC400 #6
10.17
SAP AG 2001
<sing Selection 7ptions When Accessing the 8atabase
REPORT 000
DATA .a/sp+l# TYPE sp+l#0
SELECT1OPTIONS so/$a%% FOR .a/sp+l#1$a%%#40
000
SELECT $a%%#4 $onn#4 $#t'+%om $#t'to 000
FROM sp+l#
INTO CORRESPONDING FIELDS OF .a/sp+l#
3HERE $a%%#4 IN so/$a%%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 000 0
ENDSELECT0
3HERE 3HERE $a%%#4 $a%%#4 IN so/ IN so/$a%% $a%%
SELECT SELECT
ENDSELECT ENDSELECT
0*e ab!+e e6am&le s*!%s *!% y!u a) restrit 'atabase seleti!) t! a ertai) ra)5e usi)5 a seleti!)
table.
C!)'iti!)s i) a) i)ter)al table 'elare' usi)5 SELECT1OPTIONS are i)ter&rete' as $!ll!%sE
/$ t*e i)ter)al table is em&ty- t*e !)'iti!) $iel' IN ,e&name is al%ays true.
/$ t*e i)ter)al table !)ly !)tai)s i)lusi+e eleme)tary !)'iti!)s- su* as "_5- !r "_n- t*e
result is t*e !m&!site !)'iti!) F"_5 OR %%% OR "_n C.
/$ t*e i)ter)al table !)ly !)tai)s e6lusi+e eleme)tary !)'iti!)s su* as e5 !r em- t*e result
is t*e !m&!site !)'iti!) A NOT e_5C AND 000 AND ANOT e_mC
/$ t*e i)ter)al table !)tai)s i)lusi+e eleme)tary !)'iti!)s- su* as #/< !r #/n- a)'
e6lusi+e eleme)tary !)'iti!)s- su* as e/< !r e/m- t*e result is t*e !m&!site !)'iti!) A
"_5 OR 000 OR "_n C AND A NOT e_5 C AND 000 AND A NOT e_m C.
>C? SAP AG BC400 #A
10.18
SAP AG 2001
Selection Screen 9"ents
Selection Screen Attributes
Selection Screen Attributes
Single Fields ,PA-A(9T9-S.
Single Fields ,PA-A(9T9-S.
?alue Sets ,S929CT=7PT47#S.
?alue Sets ,S929CT=7PT47#S.
Selection Screen 9"ents
Selection Screen 9"ents
>C? SAP AG BC400 #8
10.19
SAP AG 2001
Selection Screen 9"ents
Ti%e


LOAD1OF1PROGRAM0
START1OF1SELECTION0
AT SELECTION1SCREEN0
#o
Aes
Progra%
start
/) a) e6eutable &r!5ram- t*e ABAP ru)time system 5e)erates a sta)'ar' seleti!) sree) as l!)5 as
y!u *a+e %ritte) at least !)e PARAMETERS !r SELECT1OPTIONS stateme)t. 0*e e+e)t bl!( AT
SELECTION1SCREEN bel!)5s t! t*e seleti!) sree).
0*e seleti!) sree) is se)t a$ter t*e e+e)t bl!( LOAD1OF1PROGRAM.
1a* time t*e user &resses L1)terM- a &us*butt!)- a $u)ti!) (ey- !r *!!ses a me)u $u)ti!)- t*e
system i)itially arries !ut a ty&e *e(. /$ t*e e)tries '! )!t *a+e t*e !rret ty&e- t*e system
'is&lays a) err!r messa5e- a)' ma(es t*e $iel's rea'y $!r i)&ut a5ai). .*e) t*e e)tries *a+e t*e
!rret ty&e- t*e system &r!esses t*e e+e)t bl!( AT SELECTION1SCREEN.
SubseBue)t &r!5ram $l!% 'e&e)'s !) t*e user ati!)E
/$ t*e user *!!ses L98M !r E1ec$te t*e )e6t e+e)t bl!( is alle'E i) t*is ase START1OF1
SELECTION.
/$ t*e user *!se a)y !t*er $u)ti!)- t*e seleti!) sree) is 'is&laye' a5ai).
>C? SAP AG BC400 #8
10.20
SAP AG 2001
9rror 8ialogs in AT S929CT47#=SC-99#
Ti%e
Progra%
start


LOAD1OF1PROGRAM0
START1OF1SELECTION0
#o authori;ation!!!
AT SELECTION1SCREEN0
IF 000 (essage te't
9rror %essage
9rror check
;se t*e e+e)t bl!( AT SELECTION1SCREEN i$ y!u %a)t t! &r!5ram a''iti!)al i)&ut *e(s $!r
a sta)'ar' seleti!) sree).
0*e e+e)t bl!( AT SELECTION1SCREEN is tri55ere' by ea* user ati!). /$ a) err!r 'ial!5 is
tri55ere' by t*e MESSAGE stateme)t- t*e system rese)'s t*e seleti!) sree) a)' aut!matially
resets all i)&ut $iel's t! rea'y $!r i)&ut.
9!r m!re 'etaile' i)$!rmati!) !) t*e MESSAGE stateme)t- re$er t! t*e (ey%!r' '!ume)tati!).
A''iti!)al i)$!rmati!) a) be $!u)' i) t*e (ey%!r' '!ume)tati!) $!r AT SELECTION1SCREEN.
>C? SAP AG BC400 "0
10.21
SAP AG 2001
Synta' 9'a%ple: Selection Screen Authori;ation Check
PARAMETERS pa/$a% TYPE s/$a%%/#40
2 event p%o$esse4 a+te% leav#n( t&e sele$t#on s$%een
AT SELECTION1SCREEN0
AUTHORITY1CHEC@ ORECT 9S/CARRID9
ID 9CARRID9 FIELD pa/$a%
ID 9ACT;T9 FIELD a$tvt/4#spla'0
IF s'1s),%$ NE "0
2 s&o. sele$t#on s$%een a(a#n .#t& messa(e #n stat)s ,a%
MESSAGE e"!OA,$!""C 3ITH pa/$a%0
ENDIF0
AT SELECTION1SCREEN0 AT SELECTION1SCREEN0
MESSAGE e MESSAGE e
As a) e6am&le !$ a) a''iti!)al i)&ut *e( %it* err!r 'ial!5- a) i)&ut $iel' $!r t*e airli)e /D )ee's
t! be a''e' t! t*e &r!5ram.
A) aut*!riCati!) *e( is t! be arrie' !ut !) t*e seleti!) sree).
/$ t*e user *as aut*!riCati!) t! 'is&lay t*e s&ei$ie' airli)e- t*e &r!5ram !)ti)ues.
/$ t*e user '!es )!t *a+e 'is&lay aut*!riCati!)- t*e) t*e seleti!) sree) is 'is&laye' a5ai) a)' a)
err!r messa5e a&&ears i) t*e status bar.
>C? SAP AG BC400 "#
10.22
SAP AG 2001
8escribe selection screen attributes and
strengths
Write a progra% that allo&s you to enter inter"als
on a selection screen and that can be used to
restrict the nu%ber o$ data records retrie"ed $ro%
the database
Write a progra% that contains additional input
checks $or the selection screen and returns to the
selection screen i$ an error occurs
Aou are no& able to:
<ser 8ialog 2ist: <nit Su%%ary
>C? SAP AG BC400 ""
10.23 Se%ection Screen E$ercises
1nt: 0electon 0creen
At t*e !)lusi!) !$ t*ese e6erises- y!u %ill be able t!E
;se t*e ABAP stateme)t SELECT1OPTIONS t! e)ter !m&le6 +alues
!) a sta)'ar' seleti!) sree).
0a(e a!u)t !$ !m&le6 +alues i) a 'atabase seleti!).
Pr!5ram a) err!r messa5e $!r a sta)'ar' seleti!) sree)
16te)' y!ur &r!5ram =C!""/>>/DETAIL/LIST !r t*e
!rres&!)'i)5 m!'el s!luti!) as $!ll!%sE
16te)' t*e sta)'ar' seleti!) sree) t! all!% y!u t! 'e$i)e a !m&le6
+alue set $!r limiti)5 t*e !))eti)5 $li5*t )umber. 0*e +alue set is t! be
ta(e) i)t! a!u)t %*e) seleti)5 $li5*ts.
A''iti!)ally- *a)5e y!ur &r!5ram s! t*at t*e user a) !)ly &r!5ress
$r!m t*e seleti!) sree) i$ t*e aut*!riCati!) *e( $!r t*e 'esire' airli)e
is suess$ul.
Program: =C!""/>>/SEL/SCREEN
)odel soluton: SAPC!""UDS/SEL/SCREEN
Template: SAPC!""UDS/DETAIL/LIST
#:# C!&y y!ur &r!5ram =C!""/>>/DETAIL/LIST !r t*e !rres&!)'i)5 tem&late
SAPC!""UDS/DETAIL/LIST t! t*e )e% &r!5ram
=C!""/>>/SEL/SCREEN.
#:" 16te)' y!ur seleti!) sree) t! all!% t*e user t! e)ter a !m&le6 +alue ra)5e $!r
t*e flght number CONNID.
.*e) y!u are ty&i)5 t*e airli)e a)' $li5*t )umber- ma(e sure
y!u re$er t! t*e same struture s! t*at t*e sear* *el&s are
!)te6t:'e&e)'e)t.
#:3 ;se t*e !m&le6 +alue set t! restrit t*e am!u)t !$ 'ata selete' $r!m t*e 'atabase
table SFLIGHT.
#:4 C*a)5e y!ur &r!5ram s! t*at t*e user a))!t &r!5ress $r!m t*e seleti!) sree) i$
t*e aut*!riCati!) *e( a5ai)st t*e aut*!riCati!) !bGet S/CARRID $ails. /$ t*e
>C? SAP AG BC400 "3
aut*!riCati!) *e( $ails- 'is&lay a suitable err!r messa5e $r!m messa5e lass
BC400- a)' all!% t*e user t! e)ter a 'i$$ere)t +alue !) t*e seleti!) sree).
>C? SAP AG BC400 "4
10.24Se%ection Screen So%&tions
1nt: 0electon 0creen
)odel soluton: Program SAPC!""UDS/SEL/SCREEN
<D//////////////////////////////////////////////////////////////<
<D Repo# SAPBC400+DS_SEL_SCREEN <
<D <
<D//////////////////////////////////////////////////////////////<
REPORT ,ap).400-d,_,e&_,.een%
CONSTANTS= a.#4#_d",p&a$ TYPE a.#"4_a-#( *AL+E B07B%
DATA= ;a_!&"'(# TYPE ,).400!o..8
;a_,)oo9 TYPE ,)oo9%
PARAMETERS= pa_.a LI@E .a/+l#(&t1$a%%#4%
2 Data +#el4 +o% $omple? %est%#$t#ons appl#e4 to $onne$t#on #4
SELECT1OPTIONS: so/$on FOR .a/+l#(&t1$onn#40
2 F#%st event p%o$esse4 a+te% leav#n( t&e sele$t#on s$%een
AT SELECTION1SCREEN0
AUTHORITY1CHEC@ ORECT 9S/CARRID9
ID 9CARRID9 FIELD pa/$a%
ID 9ACT;T9 FIELD a$tvt/4#spla'0
IF s'1s),%$ KL "0
2 Ret)%n to sele$t#on s$%een a(a#n an4 4#spla' messa(e #n stat)s 2
,a%
MESSAGE ID 9C!""9 TYPE 9E9 NUMER 9"!O9 3ITH pa/$a%0
ENDIF0
START/OF/SELECTION%
SELECT .a"d .onn"d !&da#e ,ea#,ma1 ,ea#,o.. FROM ,!&"'(#
INTO CORRESPONDING FIELDS OF ;a_!&"'(#
W0ERE .a"d > pa_.a
AND $onn#4 IN so/$on%
;a_!&"'(#/pe.en#a'e >
500 < ;a_!&"'(#/,ea#,o.. ? ;a_!&"'(#/,ea#,ma1%
WRITE= ? ;a_!&"'(#/.a"d8
;a_!&"'(#/.onn"d8
;a_!&"'(#/!&da#e8
;a_!&"'(#/,ea#,o..8
;a_!&"'(#/,ea#,ma18
;a_!&"'(#/pe.en#a'e8BCB%
0IDE= ;a_!&"'(#/.a"d8 ;a_!&"'(#/.onn"d8 ;a_!&"'(#/!&da#e%
ENDSELECT%
>C? SAP AG BC400 "5
AT LINE/SELECTION%
IF ,$/&,"nd > 5%
WRITE= ? ;a_!&"'(#/.a"d8 ;a_!&"'(#/.onn"d8 ;a_!&"'(#/!&da#e%
+LINE%
SKIP%
SELECT )oo9"d .-,#om"d .-,##$pe .&a,, ode_da#e
,mo9e .an.e&&ed &o..-am &o..-9e$
FROM ,)oo9 INTO CORRESPONDING FIELDS OF ;a_,)oo9
W0ERE .a"d > ;a_!&"'(#/.a"d
AND .onn"d > ;a_!&"'(#/.onn"d
AND !&da#e > ;a_!&"'(#/!&da#e%
WRITE= ? ;a_,)oo9/)oo9"d8
;a_,)oo9/.-,#om"d8
;a_,)oo9/.-,##$pe8
;a_,)oo9/.&a,,8
;a_,)oo9/ode_da#e8
;a_,)oo9/,mo9e8
;a_,)oo9/.an.e&&ed8
;a_,)oo9/&o..-am C+RRENCY ;a_,)oo9/&o..-9e$8
;a_,)oo9/&o..-9e$%
ENDSELECT%
ENDIF%
>C? SAP AG BC400 "6
++
SAP AG 2001
Screen Attributes and Strengths
Creating Screens
2ayout
Field Attributes
Flo& 2ogic
8ata Transport
<sing Pushbuttons and 9"aluating <ser Actions
Contents:
<ser 8ialogs: Screens
>C? SAP AG BC400 #
11.2
SAP AG 2001
At the conclusion o$ this unit0 you &ill be able to:
<ser 8ialog Screen: <nit 7b6ecti"es
8escribe screen attributes and strengths
Write a progra% that:
8isplays data on a screen
Allo&s the user to change so%e o$ that data
Allo&s the user to in$luence $urther progra%
processing using pushbuttons
>C? SAP AG BC400 "
11.3
SAP AG 2001
Fle'ible Fle'ible
progra% $lo& progra% $lo&
200
+20
+40
+00
300
Type Type checks checks
Consistency check Consistency check
during data entry during data entry
Poss"ble en!r"es Poss"ble en!r"es
hel$ hel$
0n$u! 0n$u! hel$ hel$
@
Screen Attributes
9diting 9diting
options options
Sree)s are ma'e u& !$ m!re t*a) Gust a sree) lay!ut %it* i)&ut a)' !ut&ut $iel's. 0*ey als!
*a+e t*eir !%) &r!essi)5 l!5i.
0*e $at t*at t*e ABAP Diti!)ary is i)te5rate' i) t*e system mea)s t*at aut!mati !)siste)y
*e(s $!r sree) i)&ut $iel's are &r!+i'e'. 0*ese *e(s i)lu'e ty&e *e(s- $!rei5) (ey
*e(s- a)' $i6e' +alue *e(s. All !$ t*ese *e(s are aut!matially su&&lie' %it* i)$!rmati!)
$r!m t*e ABAP Diti!)ary.
C*e(s li(e t*e !)es ab!+e a) be !m&leme)te' by !t*er &r!5ram:s&ei$i *e(s. .it* t*e
te*)iBues a+ailable $!r sree)s - y!u a) !)tr!l t*e !r'er i) %*i* *e(s are &er$!rme' a)'-
i$ err!rs !ur- ma(e t*e $iel's i)&ut rea'y a5ai)- %*ere a&&r!&riate.
@!u a) als! set u& sree) lay!ut i) a +ery $le6ible %ay. /)&ut $iel's- !ut&ut $iel's- ra'i!
butt!)s- *e(b!6es- a)' e+e) &us*butt!)s a) be &lae' !) sree)s. 0*ese $eatures all!% users
t! 'etermi)e t*e 'ireti!) i) %*i* t*e &r!5ram %ill &r!ee'.
0*e same e'iti)5 !&ti!)s are a+ailable $!r t*e sree) as $!r list 'is&lay a)' t*e seleti!) sree)E
t*e $i6e' &!i)t )umbers a)' t*e 'ate are set a!r'i)5 t! t*e user 'e$ault +alues- t*e time i)
$!rmat **EmmEss- am!u)ts a!r'i)5 t! t*e setti)5 i) a urre)y $iel'- a)' le)5t*s a)' %ei5*ts
a!r'i)5 t! t*e !)te)t !$ a u)it:!$:measure $iel'.
>C? SAP AG BC400 3
11.4
SAP AG 2001
7ptions $or Calling Screens
+00
200
300
+20
+40
Transaction code
CA22 SC-99# +00!


0! start a sree) seBue)eE
S&ei$y t*e $irst sree) as t*e start sree) !$ a tra)sati!) !'e !$ t*e ty&e !ialo' transaction
Call a sree) $r!m a)y !)e ABAP &r!essi)5 bl!( i) t*e &r!5ram
0*is u)it !)e)trates !) t*e latter !&ti!).
>C? SAP AG BC400 4
11.5
SAP AG 2001
Fl(! Fl(! #onn #onn. . De$! De$! Des! Des!. .
/B 0400 FRA Frank-ur! GF> ?e; Cork
/B 0400 FRA Frank-ur! GF> ?e; Cork
...
S1 0002 S0? S"n(a$ore SF8 San Franc"sco

Ti%etable
Change $light data Change $light data
Airline
Flight nu%ber
8eparture airport
8estination airport
Flight duration
8eparture ti%e
Change
in
database
Screen
Application 9'a%ple: 8estination
2:
0400
H:24
+0:+0:00
F-A
IFE
Sa"e Back
/) t*e $!ll!%i)5 u)its- y!u %ill 'e+el!& a &r!5ram- i) se+eral ste&s- t*at e)ables t*e user t! *a)5e
t*e master 'ata !$ t*e $li5*t timetable.
D!uble:li(i)5 !) a) e)try i) t*e basi list !)tai)i)5 t*e $li5*t timetable alls a sree)- %*i*
'is&lays 'ata $r!m t*e li)e y!u selete'- a)' a''iti!)al i)$!rmati!) ab!ut t*e $li5*t !))eti!).
@!u a) *a)5e t*e $li5*t 'urati!) a)' t*e 'e&arture time.
C*!!si)5 Back ta(es t*e user ba( t! t*e basi list %it*!ut *a)5i)5 a)y 'ata.
C*!!si)5 &ave *a)5es t*e 'ata i) t*e 'atabase.
0*ere is a $u)ti!) m!'ule $!r 'atabase *a)5es t*at is im&leme)te' later !) >see t*e u)it ab!ut
Cr!ss:Pr!5ram M!'ulariCati!)?.
>C? SAP AG BC400 5
11.6
SAP AG 2001
Co%ponents $or Screen Processing
Attributes 9le%ent list Flo& control
Screen nu%ber
Short te't
Screen type
#e't screen
!!!
PROCESS EFORE OUTPUT0
MODULE $lea%/oM/$o4e0
PROCESS AFTER INPUT0
MODULE )se%/$omman40
Screen
Painter
Attributes:
C:A-20
-e5uired entry
$ield
!!!
2ayout
8eparture City
1a* sree) *as t*e $!ll!%i)5 i)$!rmati!)E
Attrbutes:
/)lu'e a $!ur:'i5it )umber as t*e sree) )ame- 'esi5)ati!)- a)' a s*!rt te6t i)$!rmati!) !) t*e
sree) ty&e >$!r e6am&le- normal $!r $ull siCe sree)?.
4ayout:
/)lu'es eleme)ts y!u a) &lae !) t*e sree). 1leme)ts t*at are 'is&laye' !) t*e sree) are alle'
screen elements.
(lement lst:
C!)tai)s t*e attributes !$ t*e sree) eleme)ts- su* as t*e &!siti!)- siCe- a)' 'ata ty&e.
*lo# control:
C!)tai)s t*e &r!essi)5 l!5i t*at is t! be &r!esse' be$!re t*e sree) is se)t t! t*e &rese)tati!)
ser+er >PB+? a)' t*e &r!essi)5 l!5i t*at is t! be &r!esse' a$ter a user ati!) *as ta(e) &lae.
>C? SAP AG BC400 6
11.7
SAP AG 2001
9diting Windo& in the raphical 2ayout 9ditor
raphical 2ayout 9ditor
9le%ent
attributes
9le%ent list
Create $ields &ith
re$erence to the
8ictionary
Toolbar

2ayout area
9r!m t*e Gra&*ial 3ay!ut 1'it!r- y!u a) start !t*er $u)ti!)sE
(lement attrbutes:
All t*e attributes !$ a sree) eleme)t are 'is&laye' i) t*is 'ial!5 b!6. @!u a) *a)5e s!me !$ t*e
attributes i) t*e b!6. 16am&leE y!u a) s&ei$y %*et*er !r )!t a) i)&ut/!ut&ut $iel' is t! be i)&ut
rea'y.
5et from ABAP 3ctonary & 5et from program:
0*is 'ial!5 b!6 all!%s y!u t! 5e)erate $iel's t*at *a+e eit*er a 5l!bal ty&e !r t*e same ty&e as a
'ata !bGet i) t*e &r!5ram.
(lement lstE
S*!%s all t*e eleme)ts 'is&laye' !) t*e sree) %it* t*eir attributes. @!u a) als! *a)5e attributes
*ere..
>C? SAP AG BC400 A
11.8
SAP AG 2001
Fl(! Fl(! #onn #onn. . De$! De$! Des! Des!. .
/B 0400 FRA Frank-ur! GF> ?e; Cork
/B 0400 FRA Frank-ur! GF> ?e; Cork
...
S1 0002 S0? S"n(a$ore SF8 San Franc"sco

Ti%etable
Change $light data Change $light data
Airline
Flight nu%ber
8eparture airport
8estination airport
Flight duration
8eparture ti%e
9'a%ple o$ 2e"el +: Create Screen
Screen
@!ur $irst ste& is t! reate a sree)- s&ei$y its lay!ut- a)' 'e$i)e its $iel' attributes.
0*e $iel's Airli)e- 9li5*t )umber- De&arture air&!rt- a)' Desti)ati!) air&!rt are t! a&&ear as !ut&ut
$iel's. 0*e $iel's 9li5*t 'urati!) a)' De&arture time are a+ailable as i)&ut:rea'y $iel's.
0*e user s*!ul' be able t! all t*e sree) by '!uble:li(i)5 a li)e %it*i) t*e basi list a)' retur) t!
t*e basi list by *!!si)5 t*e a&&r!&riate $u)ti!) !) t*e sree).
>C? SAP AG BC400 8
11.9
SAP AG 2001
#ancel Ces ?o
Create ob6ect
Screen +00 does not e'ist!
8o you &ant to create the ob6ect@
Creating a Screen: Screen Attributes
:
AT LINE1SELECTION0
:
CALL SCREEN <""0
:
Short te't
#e't screen
0
ABAP
<"" <"" 8ouble=click
Screen Attributes
Supple%ental data display
Screen type
#or%al
Subscreen
(odal dialog bo'
Screen
Painter
0*ere are se+eral %ays t! reate sree)sE
Through for#ard na$gatonE @!u a) reate sree)s $r!m %it*i) t*e ABAP 1'it!r by '!uble:
li(i)5 !) t*e sree) )umber. 0*is tra)s$ers y!u t! Sree) Pai)ter aut!matially.
1sng +b,ect -a$gatorE @!u a) reate a )e% &r!5ram !bGet sree) $!r y!ur &r!5ram 'iretly
$r!m t*e !bGet list i) t*e )a+i5ati!) area.
.*e) y!u reate a sree)- t*e system %ill as( y!u t! e)ter screen attrbutes. 1)ter a s*!rt
'esri&ti!) !$ t*e sree)- selet sree) ty&e (ormal, a)' e)ter t*e )umber !$ t*e subseBue)t sree).
/$ y!u e)ter 0 $!r t*e subseBue)t sree)- t*e system $irst &r!esses y!ur sree) !m&letely a)' t*e)
retur)s t! &r!essi)5 at t*e &!i)t %*ere t*e sree) all is set. >N!te t*at D0D i) t*e e)try $iel' $!r t*e
subseBue)t 'y)&r! is )!t 'is&laye' beause t*is is atually t*e i)ital +alue.?
/) t*e e6am&le i) t*e 5ra&*i- t*e sree) t*e user reates is alle' $r!m %it*i) t*e basi list.
0*ere$!re- CALL SCREEN 500 must bel!)5 t! t*e AT LINE/SELECTION e+e)t bl!(%
>C? SAP AG BC400 8
11.10
SAP AG 2001
4nput Fields &ith -e$erence to Fields o$ a
8ictionary Structure
T
V
Airline
Flight nu%ber
8eparture airport
8estination airport
Flight duration
8eparture ti%e
S8A#CC7##
0*ere are t%! %ays !$ assi5)i)5 $iel' attributes t! t*e reBuire' sree) $iel'sE
Copyng data from the 3ctonaryE @!u a) !&y ty&es a)' $iel' attributes $r!m e6isti)5
ABAP Diti!)ary strutures. 0*is ma(es all i)$!rmati!) ab!ut t*e !bGet a+ailable t! y!u-
i)lu'i)5 sema)ti i)$!rmati!) ab!ut its 'ata eleme)ts a)' $!rei5) (ey 'e&e)'e)ies. 0*e )ame
!$ t*e Diti!)ary $iel' is aut!matially a'!&te' as a $iel' )ame.
Copyng data from the programE @!u a) !&y $iel' attributes $r!m 'ata !bGets alrea'y
'e$i)e' %it*i) y!ur &r!5ram t! t*e sree). /) !r'er t! '! t*is- *!%e+er- a) ati+ate' !&y !$ t*e
&r!5ram must alrea'y e6ist. 0*e )ame !$ t*e 'ata !bGet is aut!matially ta(e) as t*e $iel'
)ame.
0*e Gra&*ial Sree) Pai)ter all!%s y!u t! 'e$i)e 'i$$ere)t sree) eleme)ts >$!r e6am&le- i)&ut a)'
!ut&ut $iel's- (ey%!r' te6ts- b!r'ers- a)' s! !)? %it* relati+e ease. C*!!se t*e 'esire' sree)
eleme)t a)' t*e) &lae it !) t*e sree) usi)5 t*e m!use.
@!u a) 'elete sree) eleme)ts sim&ly by &!i)ti)5 t! t*em a)' *!!si)5 Delete.
@!u a) m!+e sree) eleme)ts by seleti)5 t*em a)' 'ra55i)5 t*em t! a )e% &!siti!).
>C? SAP AG BC400 #0
11.11
SAP AG 2001
Changing the 9le%ent Attributes o$ a Field:
Attribute Windo&
T
V
Attributes Attributes
8ict
FCode FTyp
e
2ine Colu
%n
#a%e
Te't
Prog 8isp
Airline
Flight nu%ber
8eparture airport
8estination airport
Flight duration
8eparture ti%e
4nput $ield
7utput $ield
-e5uired $ield
! ! !
S8A#CC7##=CA--48
0! mai)tai) t*e attributes !$ a sree) $iel'- selet t*e $iel' a)' *!!se Attrib$tes)
@!u a) assi5) t*e attribute man!atory >.e#$ire! fiel!? t! a sree) $iel'. At ru) time- t*e $iel' %ill
be mar(e' a!r'i)5ly i$ it is set t! i)itial +alue.
/$ )!t all reBuire' $iel's *a+e bee) $ille' at ru) time a)' a user ati!) is &er$!rme'- a) err!r 'ial!5 is
tri55ere' by t*e ABAP ru) time system a)' all i)&ut $iel's are !)e a5ai) 'is&laye' rea'y $!r i)&ut.
>C? SAP AG BC400 ##
11.12
SAP AG 2001
Fl(! Fl(! #onn #onn. . De$! De$! Des! Des!. .
/B 0400 FRA Frank-ur! GF> ?e; Cork
/B 0400 FRA Frank-ur! GF> ?e; Cork
...
S1 0002 S0? S"n(a$ore SF8 San Franc"sco

Ti%etable
Change $light data Change $light data
Airline
Flight nu%ber
8eparture airport
8estination airport
Flight duration
8eparture ti%e
Screen
9'a%ple 2e"el 2: 8isplaying 8ata
2:
0400
H:24
+0:+0:00
F-A
IFE
/) ste& t%! y!u lear) *!% t! 'is&lay 'ata !) a sree) by &r!5rammi)5 'ata tra)s&!rt $r!m t*e basi
list t! t*e sree).
9!r t*e user- t*e &r!5ram %!r(s i) t*e $!ll!%i)5 ma))erE
By '!uble:li(i)5 !) a li)e i) t*e basi list- t*e user bra)*es t! t*e sree) %*ere t*e m!st
im&!rta)t items !$ i)$!rmati!) $!r t*e $li5*t !))eti!) *e !r s*e *as *!se) are 'is&laye'. 0*e
$li5*t 'urati!) a)' 'e&arture time are 'is&laye' i) a $iel' t*at is rea'y $!r i)&ut a)' *e)e a) be
*a)5e'.
0*e user retur)s t! t*e basi list i) !)e !$ se+eral %ays.
.it* t*is i) mi)'- t*is &art !$ t*e u)it %ill 'eal %it*E
Setti)5 u& &rereBuisites $!r aut!mati 'ata tra)s&!rt bet%ee) t*e &r!5ram a)' sree) $iel's
De$i)i)5 t*e sree) i)ter$ae a)' &r!5rammi)5 'ata tra)s&!rt t! t*e 'ata !bGets !$ t*e i)ter$ae
>C? SAP AG BC400 #"
11.13
SAP AG 2001
Screen 4nter$ace
Screen
8ata ob6ects
ABAP
processing
block
ABAP progra%
8ATA &aCsp$li TAP9 sp$li!
TAB29S sdynCconn! TALES TALES
8eclarati"e state%ents
&aCsp$li
Process
Be$ore
7utput
Process
A$ter
4nput
sdynCconn
S8A#CC7##
0*e TALES stateme)t 'e$i)es a) i)ter)al 'ata !bGet t*at ser+es as a) i)ter$ae $!r t*e sree). 0*e
TABLES stateme)t al%ays re$ers t! a) ABAP Diti!)ary !bGet >$!r e6am&le- tra)s&are)t table !r
struture?.
/$ t*e sree) $iel's a)' t*e TABLES stateme)t re$er t! t*e same ABAP Diti!)ary !bGet- t*is 'ata
!bGetIs 'ata is aut!matially tra)s&!rte' t! t*e sree) $iel's e+ery time t*e sree) is tra)smitte'.
A)y )e% e)tries !r *a)5es t*at t*e user ma(es !) t*e sree) are t*e) tra)s$erre' ba( i)t! t*is 'ata
!bGet.
As a rule- strutures t*at !)tai) $iel's !$ t*e same ty&e $!r t*e 'i$$ere)t tables are reate' i) t*e
ABAP Diti!)ary. 0*e $li5*t 'ata &r!5rams bei)5 reate' i) t*is !urse use !)e struture $!r master
'ata mai)te)a)e >,d$n_.onn? a)' a)!t*er $!r b!!(i)5s 'ata >,d$n_)oo9?. ;si)5 y!ur !%)
strutures as i)ter$aes usually *el&s ma(e a &r!5ram easier t! u)'ersta)' a)' *el&s t! a+!i' err!rs
as %ell.
>C? SAP AG BC400 #3
11.14
SAP AG 2001
S$%een <""
Ti%e


8ata Transport $ro% the Progra% to the Screen
ABAP runti%e syste%
ABAP progra%
DATA .a/sp+l# TYPE sp+l#0
TALES s4'n/$onn0
.a/sp+l#
s4'n/$onn
Process
Be$ore
7utput
Process
A$ter
4nput
CALL SCREEN <""0
Data tra)s&!rt bet%ee) &r!5ram 'ata !bGets a)' sree) $iel's %it* t*e same )ame ta(es &lae
aut!matiallyE
/mme'iately be$!re t*e sree) is se)t t! t*e &rese)tati!) ser+er- t*at is- after t*e PB+ e+e)t *as
bee) $ully &r!esse'- t*e !)te)ts $r!m $iel's %it* t*e same )ames are !&ie' $r!m t*e ABAP %!r(
area i)t! t*e sree) $iel's.
ABAP stateme)ts $ailitate 'ata tra)s&!rt bet%ee) ABAP &r!5ram 'ata !bGets a)' t*e %!r( area
'esi5)ate' as t*e sree) i)ter$ae.
>C? SAP AG BC400 #4
11.15
SAP AG 2001
Ti%e


8ata Transport $ro% the Screen to the Progra%
Process
Be$ore
7utput
Process
A$ter
4nput
.a/sp+l#
s4'n/$onn
CALL SCREEN <""0
S$%een <""
Data tra)s&!rt bet%ee) sree) $iel's a)' &r!5ram 'ata !bGets %it* t*e same )ame ta(es &lae
aut!matiallyE
/mme'iately a$ter a user &er$!rms a) ati!) !) t*e sree)- t*at is- before t*e PA2 e+e)t is $ully
&r!esse'- t*e !)te)ts !$ t*e $iel's %it* t*e same )ame are !&ie' $r!m t*e sree) $iel's i)t! t*e
ABAP %!r( area.
ABAP stateme)ts $ailitate 'ata tra)s&!rt bet%ee) Gets t*e %!r( area 'esi5)ate' as t*e sree)
i)ter$ae a)' &r!5ram 'ata !bGets..
>C? SAP AG BC400 #5
11.16
SAP AG 2001
8ata Transport in the Progra% 9'a%ple


ABAP runti%e syste%
CALL SCREEN <""0
Ti%e
Auto%atic
data transport
:489 area
in data ob6ects
TAB29S structure
in screen $ields
Screen $ields in
TALES structure
AT LINE1SELECTION0
Fill the
TAB29S structure
&ith current data
$or selected line
0*e sam&le &r!5ram s*!ul' 'is&lay sree) 'ata t*at mat*es t*e li)e selete' i) t*e basi list.
/$ 'ata !bGets a)' t*eir +alues %ere st!re' i) t*e 0IDE area %*e) t*e basi list %as reate'- t*e 'ata
bel!)5i)5 t! t*e selete' li)e %ill be &lae' i) t*e !rres&!)'i)5 'ata !bGets.
@!u must !&y t*e 'ata t! be 'is&laye' !) t*e sree) t! a TABLES struture. @!u a) '! t*is i) a)y
ABAP &r!essi)5 bl!( t*at is &r!esse' be$!re t*e sree) is se)t t! t*e &rese)tati!) ser+er. 0*ere
are +ari!us %ays !$ '!i)5 t*isE
@!u start by rea'i)5 all t*e 'ata t! be 'is&laye' !) t*e sree) be$!re retrie+i)5 t*e basi list $r!m
t*e 'atabase. @!u t*e) &lae all t*e )eessary 'ata i) t*e 0IDE area. 0*e)- at t*e AT LINE/
SELECTION e+e)t- y!u *a+e t! !&y t*e 'ata i)t! t*e TALES struture !)ly.
3sad$antage: @!u *a+e t! rea' 'ata $r!m t*e 'atabase t*at t*e user may )!t e+e) l!!( at. /$
'etaile' 'ata *as *a)5e' bet%ee) reati)5 t*e basi list a)' 'is&layi)5 t*e sree)- t*e system %ill
'is&lay t*e %r!)5 'ata.
Be$!re t*e sree) is alle' usi)5 t*e SELECT SINGLE stateme)t- y!u rea' t*e a''iti!)al 'ata $!r
t*e selete' (ey >0IDE area? $r!m t*e 'atabase.
Ad$antage: @!u re'ue t*e +!lume !$ 'ata y!u )ee' t! rea' $r!m t*e 'atabase %*e) y!u reate
t*e basi list. 0*e 'etaile' list is u&:t!:'ate.
3sad$antage: 0*e system se)'s a Buery t! t*e 'atabase e+ery time t*e user '!uble:li(s t*e list.
>C? SAP AG BC400 #6
11.17
SAP AG 2001
4%ple%enting the Sa%ple Progra%
Fields:
(A#8T
CA--48
C7##48
C7<#T-AF-
C4TAF-7(
A4-PF-7(
C7<#T-AT7
C4TAT7
A4-PT7
F2T4(9
89PT4(9
A--T4(9
84STA#C9
84ST48
F2TAP9
Basic
2ist :489 Area
Screen:
7utput Field 4nput Field

Be$ore calling the screen Be$ore calling the screen: :


S929CT S4#29 W F-7( S929CT S4#29 W F-7( sp$li sp$li !!! !!!
&aCsp$li Structure: sdynCconn
O) t*e last 'e+el!&me)t le+el- t*e &r!5ram s*!ul' all!% t*e user t! *a)5e 'ata i) t*e 'atabase. 0*e
user s*!ul' be able t! *a)5e t*e $iel's FLTIME a)' DEPTIME. 0! e)able t*e user t! *a)5e 'ata
$!r se+eral airli)es- a basi list !$ t*e airli)es $!r %*i* t*e user is all!%e' t! *a)5e 'ata s*!ul' be
'is&laye'. 0*e user rea*es t*e *a)5e sree) by '!uble:li(i)5 i) t*e basi list. O)e t*e *a)5es
are ma'e suess$ully- t*e user retur)s t! t*e basi list. <!%e+er- a )e% basi list is )!t reate'.
0*ere$!re- t*e 'ata t*at a) be *a)5e' s*!ul' )!t a&&ear !) t*e basi list.
0! e)sure t*at t*e 'atabase 'ata 'is&laye' !) t*e sree) is u&:t!:'ate- t*e re!r' is rea' a5ai) $r!m
t*e 'atabase at t*e be5i))i)5 !$ AT LINE/SELECTION.
A'+a)ta5es !$ t*is met*!'E
9!r t*e basi list- !)ly t*!se !lum)s !$ t*e 'atabase table t*at are 'is&laye' !) t*e list )ee' t! be
rea'. 0*is a) im&r!+e &er$!rma)e %it* lar5e lists.
0*e 'ata t*at is 'is&laye' !) t*e sree) is al%ays u&:t!:'ate- e+e) i$ t*e 'ata re!r' selete' *as
Gust bee) *a)5e' usi)5 t*is &r!5ram.
C*a)5es ma'e t! t*e 'atabase usi)5 t*e sree) '! )!t lea' t! i)!rret +alues i) t*e basi list
beause t*e m!'i$iable $iel's are )!t !)tai)e' i) t*e basi list.
>C? SAP AG BC400 #A
11.18
SAP AG 2001
START1OF1SELECTION0
SELECT $a%%#4 $onn#4 a#%p+%om $#t'+%om a#%pto $#t'to
INTO CORRESPONDING FIELDS OF .a/sp+l#
FROM sp+l#0
3RITE: * .a/sp+l#1$a%%#4 COLOR COL/@EY6
.a/sp+l#1$onn#4 COLOR COL/@EY6
000
2 ,)++e%#n( Me' +#el4s
HIDE: .a/sp+l#1$a%%#46 .a/sp+l#1$onn#40
ENDSELECT0
AT LINE1SELECTION0
SELECT SINGLE 2 FROM sp+l#
INTO .a/sp+l#
3HERE $a%%#4 7 .a/sp+l#1$a%%#4
AND $onn#4 7 .a/sp+l#1$onn#40

CALL SCREEN <""0
HIDE: HIDE: .a .a/ /sp+l# sp+l#1 1$a%%#4 $a%%#46 6 .a .a/ /sp+l# sp+l#1 1$onn#4 $onn#40 0
SELECT SINGLE 2 FROM SELECT SINGLE 2 FROM sp+l# sp+l#
INTO INTO .a .a/ /sp+l# sp+l#
3HERE 3HERE $a%%#4 $a%%#4 7 7 .a .a/ /sp+l# sp+l#1 1$a%%#4 $a%%#4
AND AND $onn#4 $onn#4 7 7 .a .a/ /sp+l# sp+l#1 1$onn#4 $onn#40 0
MO;E1CORRESPONDING MO;E1CORRESPONDING .a .a/ /sp+l# sp+l# to to s4'n s4'n/ /$onn $onn0 0
Synta': Sa%ple Progra% &ith 8ata Transport
0! 'is&lay 'ata !) t*e sree)- t*e TABLES struture must be $ille' %it* urre)t 'ata be$!re t*e
sree) is se)t t! t*e &rese)tati!) ser+er. 0*e e6am&le i) t*e 5ra&*i s*!%s !)e %ay !$ '!i)5 t*is.
0*e 0IDE stateme)t is use' t! &lae (ey $iel's !$ 'atabase tables %it* re$ere)e t! t*e list li)e i) t*e
0IDE area. 0*e) t*e urre)t 'ata $!r t*e li)e selete' is a+ailable i) $iel's ;a_,p!&"/.a"d
a)' ;a_,p!&"/.onn"d at e+e)t AT LINE/SELECTION.
0*e 'ata re!r' is rea' $r!m t*e 'atabase usi)5 SELECT SINGLE. 0*is e)sures t*at t*e 'ata is u&:
t!:'ate.
0*e !rres&!)'i)5 $iel's !$ t*e ;a_,p!&" %!r( area are !&ie' t! t*e TABLES struture
,d$n_.onn usi)5 MO*E1CORRESPONDING. 0*e system tra)s&!rts t*e struture 'ata t! t*e sree)
$iel's aut!matially.
Alter)ati+ely- y!u a) &lae t*e 'ata i)t! t*e TABLES struture 'iretly %*e) t*e 'atabase is
aesse'- usi)5 t*e INTO CORRESPONDING FIELDS a''iti!).
>C? SAP AG BC400 #8
11.19
SAP AG 2001
Fl(! Fl(! #onn #onn. . De$! De$! Des! Des!. .
/B 0400 FRA Frank-ur! GF> ?e; Cork
/B 0400 FRA Frank-ur! GF> ?e; Cork
...
S1 0002 S0? S"n(a$ore SF8 San Franc"sco

Ti%etable Ti%etable
Change $light data Change $light data
Airline
Flight nu%ber
8eparture airport
8estination airport
Flight duration
8eparture ti%e
Screen Screen
9'a%ple 2e"el 3: Assigning Pushbuttons
(essage 2in status line
(essage +
in status line
2:
0400
H:24
+0:+0:00
F-A
IFE
Sa"e Back
/) ste& t*ree y!u lear) *!% t! assi5) &us*butt!) $u)ti!)s. 0*ese $u)ti!)s all!% 'i$$ere)t (i)'s !$
&r!5ram l!5i t! be &r!esse' a!r'i)5 t! user *!ie.
9!r t*e user- t*e &r!5ram %!r(s i) t*e $!ll!%i)5 ma))erE
By '!uble:li(i)5 !) a li)e- t*e user bra)*es t! a sree) %*ere t*e m!st im&!rta)t items !$
i)$!rmati!) $!r t*e !))eti!) t*e user *!se are 'is&laye'. 0*e $li5*t 'urati!) a)' 'e&arture time
a) be *a)5e'.
By *!!si)5 t*e Ba( &us*butt!)- t*e user retur)s t! t*e basi list %it*!ut %riti)5 a)y *a)5es t!
t*e 'atabase. 0*e messa5e DSree) %as le$t %it*!ut a)y *a)5es bei)5 ma'eD is 'is&laye' i) t*e
status bar !$ t*e basi list.
C*!!se Sa+e t! %rite all !$ y!ur *a)5es t! t*e 'atabase. 0*e *a)5es ta(e e$$et i) t*e &r!5ram
!)ly at a later time. 0*e &us*butt!) is alrea'y &re&are' i) t*e $!ll!%i)5 seti!). 0*e user retur)s
t! t*e basi list a$ter *!!si)5 t*e &us*butt!) a)' a messa5e is 'is&laye' i) t*e status bar. .
A$ter ea* !t*er user ati+ity- t*e sree) is 'is&laye' !)e a5ai).
.it* t*is i) mi)'- t*is &art !$ t*e u)it 'eals %it*E
9l!% l!5i i) PBO a)' PA/ e+e)t bl!(s
;si)5 PBO a)' PA/ m!'ules as ABAP &r!essi)5 bl!(s $!r sree) &r!5rammi)5
1+aluati)5 i)$!rmati!) !) %*i* &us*butt!) %as selete' at t*e time !$ PA/
>C? SAP AG BC400 #8
11.20
SAP AG 2001
-unti%e Beha"ior When <ser Chooses a
Pushbutton
Ti%e


lobal data ob6ect
ABAP runti%e syste%
ABAP progra%
Back
Function code BACE
okCcode
BACE
CASE oM/$o4e0
3HEN 9AC@90
000
ENDCASE0
/$ t*e user *!!ses a &us*butt!)- t*e ru) time system !&ies t*e ass!iate' $u)ti!) !'e t! a s&eial
sree) $iel'. 0*is sree) $iel' is usually alle' t*e o9_.ode%
0*e !)te)t !$ t*is sree) $iel' is t*e) aut!matially tra)s&!rte' i$ t*ere is a) ABAP 'ata !bGet !$
t*e same )ame.
0*e !)te)t !$ t*is o9_.ode $iel' a) t*e) be e+aluate' i) a) ABAP &r!essi)5 bl!(.
0*is me*a)ism all!%s y!u t! reate a &r!5ram $l!% t*at 'e&e)'s !) t*e userIs ati!)s. 0*e
$!ll!%i)5 sli'es 'eal %it* *!% y!u 'elare t*e o9_.ode $iel'- *!% y!u reate &us*butt!)s a)'
assi5) $u)ti!) !'es t! t*em- a)' *!% y!u a) *a)5e t*e sree) seBue)e.
>C? SAP AG BC400 "0
11.21
SAP AG 2001
8e$ining Pushbuttons > Assigning Function Codes
T
V
Attributes Attributes
8ict
FCode FType
2ine
Colu%
n
#a%e
Te't
Prog 8isp
Airline
Flight nu%ber
8eparture airport
8estination airport
Flight ti%e
8eparture ti%e
Back
4nput $ield
7utput $ield
! ! !
B<TT7#2
Sa"e
BACE
Back
0! be able t! tra)s&!rt i)$!rmati!) as t! %*i* &us*butt!) %as *!se)- y!u must assi5) a $u)ti!)
!'e t! ea* &us*butt!). @!u a) '! t*is eit*er i) t*e Gra&*ial 3ay!ut 1'it!r usi)5 t*e
mai)te)a)e $u)ti!) $!r $iel' attributes !r $r!m t*e eleme)t list.
>C? SAP AG BC400 "#
11.22
SAP AG 2001
(aking the Co%%and Field <sable
Screen Pa"n!er Screen Pa"n!er: /"s! : /"s! o- o- 4le*en!s 4le*en!s
B<TT7#+
B<TT7#2
7ECC789 7E
Sa"e
Back
SA?9
BACE
Field na%e
!!! !!!
TALES s4'n/$onn0
DATA: oM/$o4e l#Me s'1)$omm0
ABAP
9ditor
Screen
Painter
Function code Field te't
eneral attributes
DATA DATA oM oM/ /$o4e $o4e LI@E LI@E s' s'1 1)$omm )$omm0 0
+
2
7ECC789 7ECC789
0*e !mma)' $iel' ser+es as a s&eial $iel' i)t! %*i* !rres&!)'i)5 $u)ti!) !'es are &lae' a$ter
e+ery user ati!).
0*is $iel' must be 5i+e) a )ame i) t*e last li)e !$ t*e list !$ eleme)ts !) ea* sree). Ge)erally- y!u
use t*e )ame OSUCOD1.
/) t*e 'elarati!) &art !$ t*e &r!5ram- 'e$i)e a !rres&!)'i)5 'ata !bGet %it* t*e same )ame. At ru)
time- %*e)e+er a user ati!) is tri55ere'- t*e $u)ti!) !'e !$ t*e &us*butt!) *!se) is &lae' i)t!
t*e 'ata !bGet. @!u a) use t*e system $iel' sy:u!mm as a re$ere)e $iel' $!r t*e ty&e.
>C? SAP AG BC400 ""
11.23
SAP AG 2001
Ti%e


Calling (odules
+00
PB7
CALL SCREEN <""0
MODULE name
OUTPUT0
ENDMODULE0
MODULE
name0

PA4
MODULE
name0

MODULE name
INPUT0
ENDMODULE0
0*e ABAP stateme)t CALL SCREEN KnnnnL i)terru&ts t*e &r!essi)5 !$ t*e &r!essi)5 bl!(
a)' alls a sree).
1a* sree) *as t%! e+e)t bl!(sE
PROCESS EFORE OUTPUT APB+B is &r!esse' imme'iately be$!re a sree) is 'is&laye'.
At t*is time- m!'ules are alle' t*at ta(e are !$ tas(s su* as &resetti)5 +alues i) sree) $iel's.
PROCESS AFTER INPUT APA2B is &r!esse' imme'iately a$ter a user ati!). All &r!5ram
l!5i t*at is i)$lue)e' by user ati!) must be &r!esse' at PAI.
-ote: 0*e !'e $!r t*e e+e)ts PBO a)' PA/ is %ritte) usi)5 t*e Sree) Pai)ter, )!t %it* t*e ABAP
1'it!r. 0*ese t%! e+e)t bl!(s ma(e u& t*e $l!% l!5i !$ a sree). A s&eial small set !$ !mma)'s
>not ABAP stateme)ts? is a+ailable $!r &r!5rammi)5 $l!% l!5i. 0*e m!st im&!rta)t stateme)t *ere
is alle'E MODULE m!'uleU)ame. 0*is alls t*e m!'uleU)ame ABAP &r!essi)5 bl!(. .it*i) t*is
bl!( y!u a) !'e i) ABAP as usual.
)odules are ABAP &r!essi)5 bl!(s %it* )! i)ter$ae t*at a) be alle' !)ly $r!m %it*i) t*e $l!%
l!5i. M!'ules are e)l!se' %it*i) t*e ABAP stateme)ts MOD+LE a)' ENDMOD+LE%
>C? SAP AG BC400 "3
11.24
SAP AG 2001
PROCESS EFORE OUTPUT0

ABAP
9ditor
Screen
Painter
Back
Sa"e
9"aluating the Function Code $or PA4
MODULE )se%/$omman4/"<"" INPUT0
CASE oM/$o4e0
3HEN 9AC@90 000
3HEN 9SA;E90 000
ENDCASE0
ENDMODULE0
MODULE MODULE )se% )se%/ /$omman4 $omman4/"<"" INPUT0 /"<"" INPUT0
ENDMODULE0 ENDMODULE0
CASE CASE
PROCESS AFTER INPUT0

MODULE )se%/$omman4/"<""0 MODULE MODULE )se% )se%/ /$omman4 $omman4/"<""0 /"<""0
@!u a) e+aluate user ati!)s i) a PA/ m!'ule. ;sually- t*is PA/ m!'ule is alle'
-,e_.ommand_nnnn- %*ere nnnn sta)'s $!r t*e sree) )umber. /) t*is m!'ule- e+aluate t*e
$u)ti!) !'e i) t*e o9_.ode $iel'.
-ote: 9!r *ist!rial reas!)s- m!'ules *a+e )! i)ter$ae a)' )! l!al +ariables. @!u a) aess all t*e
ABAP &r!5ramIs 5l!bal 'ata i) m!'ules.
>C? SAP AG BC400 "4
11.25
SAP AG 2001
PROCESS AFTER INPUT0
MODULE )se%/$omman4/<""0
MODULE )se%/$omman4/<"" INPUT0
ENDMODULE0
ABAP
9ditor
Screen
Painter
Creating (odules <sing For&ard #a"igation
#ancel Ces ?o
Create ob6ect
PA4 %odule <S9-CC7((A#8C+00 does not e'ist!
8o you &ant to create the ob6ect@
3S4RA#8''A?DA0100
PA0 *oule
?e; "nclue
'a"n $ro(ra*
0nclue selec!"on
@B#400A00ADC?PR8
Create PA4 %odule
As a rule- y!u im&leme)t MOD+LE alls %it*i) a sree)Is $l!% !)tr!l >PBO a)' PA/ e+e)ts?. 0*e
m!'ules t*emsel+es are reate' usi)5 ABAP.
0*ere are t%! %ays t! reate a m!'uleE
*or#ard na$gatonE 0! reate a m!'ule- '!uble:li( !) t*e m!'ule )ame i) t*e $l!% l!5i
$r!m %it*i) t*e &creen Painter.
-a$gaton areaE /$ y!u %a)t t! reate a m!'ule $r!m %it*i) t*e !bGet list !$ t*e &r!5ram-
*!!se a )e% &r!5ram !bGet PBO mod-&e !r PAI mod-&e.
A m!'ule a) be alle' $r!m m!re t*a) !)e sree) >reusability?.
Ma(e sure t*at m!'ules alle' at PBO e+e)ts are 'e$i)e' usi)5 t*e stateme)t MOD+LE %%%
O+TP+T- %*ereas m!'ules 'e$i)e' usi)5 t*e stateme)t MOD+LE %%% INP+T a) be alle' !)ly
at PA/ e+e)ts.
>C? SAP AG BC400 "5
11.26
SAP AG 2001
Ti%e


#e't Screen: CA22 SC-99# State%ent
+00
PB7
CALL SCREEN <""0
PA4
Screen attributes
#e't screen 0
Ne?t s$%een "
/$ y!u e)ter 0 $!r t*e )e6t sree)- t*e system $irst &r!esses y!ur sree) !m&letely a)' t*e)
!)ti)ues &r!essi)5 t*e &r!5ram $r!m t*e &!i)t %*ere t*e sree) %as alle'.
>C? SAP AG BC400 "6
11.27
SAP AG 2001
Ti%e


#e't Screen: Set Statically
CALL SCREEN <""0
000
Ne?t s$%een <""
+00
PB7
PA4
Screen attributes
#e't screen +00
/$ y!u set t*e )e6t sree) $!r sree) #00 t! #00- t*e system &r!esses t*e sree) a5ai) a$ter it *as
$i)is*e' &r!essi)5 t*e PA/ m!'ule.
>C? SAP AG BC400 "A
11.28
SAP AG 2001
Ti%e


#e't Screen: Set 8yna%ically
CALL SCREEN <""0
000
S9T SC-99# 0!
SET SCREEN "0 SET SCREEN "0
"
Ne?t s$%een "
+00
PB7
PA4
Screen attributes
#e't screen +00
;si)5 t*e ABAP stateme)t SET SCREEN )))) $r!m %it*i) a PA/ m!'ule- y!u a) *a+e t*e )e6t
sree) set 'y)amially. 0*e stati e)try is t*e) su&&resse'.
0*e )umber !$ t*e urre)t sree) is e)tere' by t*e system as t*e sta)'ar' e)try $!r t*e )e6t sree).
0*is e)sures t*at t*e 1)ter (ey !r t*e 5ree) *e(mar( lea' t! a $iel' *e( !)lyH a$ter%ar's t*e
sree) is tra)smitte' !)e a5ai)- &!ssibly %it* a res&eti+e err!r messa5e. 0! lea+e t*e sree)- a)
a&&r!&riate &us*butt!) must be 'e$i)e' t*at tri55ers a sree) *a)5e %it*i) t*e PA/ m!'ule.
-ote: /$ t*e system &r!esses t*e same sree) a5ai)- it als! ru)s t*r!u5* all t*e PBO m!'ules a5ai).
/$ y!u 'ei'e t! $ill t*e TABLES struture i) a PBO m!'ule- ma(e sure t*at 'ata *a)5es ma'e by
t*e user are )!t !+er%ritte) !) t*e sree) i$ t*e m!'ule 5ets alle' t%ie
>C? SAP AG BC400 "8
11.29
SAP AG 2001
Synta' 9'a%ple: 9"aluating the Function Codes
DATA oM/$o4e LI@E s'1)$omm0

0
0
MODULE )se%/$omman4/"<"" INPUT0
CASE oM/$o4e0
3HEN 9AC@90
SET SCREEN "0
MESSAGE s"OEAC!""C0
3HEN 9SA;E90
2 $all#n( a +)n$t#on mo4)le to save $&an(es
2 #s le+t o)t +o% 4#4a$t#$al %easons
SET SCREEN "0
MESSAGE s"OEAC!""C0
ENDCASE0
ENDMODULE0
CASE CASE oM oM/ /$o4e $o4e0 0
3HEN 9AC@90 3HEN 9AC@90
3HEN 9SA;E90 3HEN 9SA;E90
9!r t*e e6am&le $!r e+aluati)5 $u)ti!) !'es- t%! &us*butt!)s are 'isusse'E
C*!!si)5 BACS 'y)amially sets t*is +alue t! 0. 0*is se)'s t*e user ba( t! t*e all&!i)t. /) !ur
ase- t*is mea)s t*e user retur)s t! t*e basi list. Messa5e 05A a&&ears i) t*e status bar !$ t*e )e6t
sree).
.it* SA719 t*e &r!5ram be*a+es i) t*e same %ay as BACS. 0*e user retur)s t! t*e basi listH
*!%e+er- t*ere is a )e% messa5e i) t*e status bar. /) t*e u)it ab!ut Cr!ss:Pr!5ram M!'ulariCati!)-
t*e &r!5ram is e)*a)e' %it* a 'ata re!r' *a)5e.
>C? SAP AG BC400 "8
11.30
SAP AG 2001
Ti%e
-unti%e Beha"ior $or Special Situation: #o
Function Code 4s Assigned to the 9#T9- Eey
Screen $ield
7ECC789
Basic list
8ata ob6ect
okCcode
BACE
BACE
BACE
Screen +00
BACE
BACE
BACE
8ouble=click
Back to
basic list
Trans%it
screen +00
8ouble=click
Trans%it
screen +00
Back to
basic list@
0*is seti!) %al(s t*r!u5* a &artiular se)ari! t! &!i)t !ut t*e )eessity !$ a) a''iti!)al &r!5ram
ste&.
0*e user starts t*e &r!5ram a)' '!uble:li(s t! 'is&lay 'etaile' i)$!rmati!) !) t*e sree). A$ter
'etermi)i)5 t*at all t*e 'ata is !rret t*e user retur)s t! t*e basi list by *!!si)5 t*e 5ree) arr!%.
/) t*is %ay- t*e $u)ti!) !'e BACS- %*i* is assi5)e' t! t*is sta)'ar' &us*butt!)- is &lae' i) t*e
!mma)' $iel' a)' t*e) it is tra)s&!rte' aut!matially t! t*e 5l!bal 'ata !bGet o9_.ode !$ t*e
ABAP &r!5ram. 0*is $u)ti!) !'e is t*e) e+aluate' i) a PA/ m!'ule. 0*e )e6t sree) is set t! 0.
0*e) AT LINE/SELECTION is &r!esse' $urt*er. /$ t*ere is )! WRITE stateme)t t*ere- t*e system
'is&lays t*e basi list a5ai).
0*e user t*e) 'is&lays 'etails $!r a)!t*er re!r' by '!uble:li(i)5 it. 0*r!u5* aut!mati $iel'
tra)s&!rt- t*e !)te)t !$ t*e 5l!bal 'ata !bGet o9_.ode is tra)s&!rte' i)t! t*e sree) $iel' %it* t*e
same )ame a)' t*e sree) is 'is&laye'.
/$ t*e user )!% *!!ses Enter- t*e sree) is 'is&laye' !)e a5ai)- &r!+i'e' no $u)ti!) !'e *as
bee) assi5)e' t! t*e 1)ter (ey. >Sta)'ar' aseV? 0*ere$!re- t*e !mma)' $iel' is not !+er%ritte).
0*e $u)ti!) !'e BACS remai)s i) t*e !mma)' $iel' a)' is !&ie' t! t*e 5l!bal 'ata !bGet
o9_.ode at t*e be5i))i)5 !$ t*e PA/ e+e)t.
0*is $u)ti!) !'e is t*e) e+aluate' i) a PA/ m!'ule. C!)seBue)tly- as 'esribe' ab!+e- t*e system
5!es ba( t! t*e basi list- i)stea' !$ 'is&layi)5 t*e sree) a5ai).
>C? SAP AG BC400 30
11.31
SAP AG 2001
Solution 7ption:
8eleting the Co%%and Field $or PB7
PROCESS EFORE OUTPUT0
MODULE $lea%/oM/$o4e0
PROCESS AFTER INPUT0

MODULE )se%/$omman4/"<""0
ABAP
9ditor
MODULE $lea%/oM/$o4e OUTPUT0
CLEAR oM/$o4e0
ENDMODULE0

MODULE )se%/$omman4/"<"" INPUT0
CASE oM/$o4e0
000
ENDMODULE0
Screen
Painter
Back
Sa"e
MODULE MODULE $lea% $lea%/ /oM oM/ /$o4e $o4e OUTPUT0 OUTPUT0
ENDMODULE0 ENDMODULE0
CLEAR CLEAR oM oM/ /$o4e $o4e0 0
MODULE MODULE $lea% $lea%/ /oM oM/ /$o4e $o4e0 0
/$ t*e !mma)' $iel' is )!t i)itialiCe'- err!rs a) !ur si)e )!t e+ery &us*butt!) must *a+e a
$u)ti!) !'e assi5)e' t! it. 0*ere are t%! %ays t! i)itialiCe a !mma)' $iel'E
/)itialiCe t*e o9_.ode $iel' i) a PBO m!'ule. 0*e) it is set t! t*e i)itial +alue at PA/- u)less t*e
user *as arrie' !ut a user ati!) t! %*i* a $u)ti!) !'e is assi5)e'. /) t*is ase- t*e !(U!'e
$iel' !)tai)s t*e urre)t $u)ti!) !'e.
;se a) au6iliary $iel' a)' !&y t*e !)te)t !$ t*e o9_.ode $iel' i)t! t*e au6iliary $iel' i) a PA/
m!'ule- t*e) i)itialiCe t*e o9_.ode $iel'. /) t*is ase- t*e au6iliary $iel' must be Buerie' i) t*e
PA/ m!'ule $!r t*e $u)ti!) !'e e+aluati!).
>C? SAP AG BC400 3#
11.32
SAP AG 2001
Aou are no& able to:
<ser 8ialog Screen: <nit Su%%ary
8escribe screen attributes and strengths
Write a progra% that:
8isplays data on a screen
Allo&s the user to change so%e o$ that data
Allo&s the user to in$luence $urther progra%
processing using pushbuttons
>C? SAP AG BC400 3"
11.33Screen E$ercises
1nt: 0creen
Topc: Creatng 0creens
At t*e !)lusi!) !$ t*ese e6erises- y!u %ill be able t!E
Create sree)s
Call e6isti)5 sree)s $r!m t*e &r!5ram
0*e &r!5ram SAPC!""UDT/DYNPRO/A e)ables y!u t! 'is&lay all
b!!(i)5s ma'e by !)e tra+el a5e)y as a list.
As a $irst ste&- *a)5e t*e &r!5ram as $!ll!%sE
A sree) is t! be alle' %*e)e+er t*e user '!uble:li(s a li)e i) t*e basi
list. 0*is sree) s*!ul' !)tai) i)&ut $iel's $!r s&ei$i b!!(i)5 'ata t*at
is )!t 'is&laye' !) t*e list. 0*is sree) s*!ul' als! !)tai) !ut&ut $iel's
$!r b!!(i)5 i)$!rmati!) t*at is alrea'y 'is&laye' !) t*e list. A)y user
ati!) s*!ul' result i) t*e basi list bei)5 'is&laye' a5ai)
Program: =C!""/>>/DYNPRO
)odel soluton: SAPC!""UDS/DYNPRO/A
Template: SAPBC400+DT_DYNPRO_A
#:# C!&y t*e tem&late SAPBC400+DT_DYNPRO_A t! y!ur )e% &r!5ram
=C!""/>>/DYNPRO.
#:" Be!me $amiliar %it* t*e &r!5ram. 0est t*e &r!5ram usi)5 t*e tra+el a5e)y
)umber #WW >CC is y!ur 5r!u& )umber?.
#:3 Seleti)5 a li)e !) t*e basi list >by '!uble:li(i)5 !r usi)5 9"? s*!ul' all a
sree). Create t*is sree) >sree) )umber #00? usi)5 $!r%ar' )a+i5ati!).
#:4 9!r t*e attributes- assi5) sree) )umber 0 as t*e )umber !$ t*e )e6t sree)- s! t*at
a$ter a)y user ati!) !) sree) #00- t*e user retur)s t! t*e basi list.
#:5 Create i)&ut/!ut&ut $iel's !) t*e sree). .*e) y!u are assi5)i)5 $iel' ty&es- re$er
t! ABAP ABAP Diti!)ary struture SDYN_BOOK.
C!&y b!!(i)5 table (ey $iel's CARRID- CONNID- FLDATE- a)' OO@ID %it* t*eir $iel'
labels.
0*e ust!mer )ame NAME s*!ul' be !&ie' %it*!ut a $iel' label a)' s*!ul' be 'is&laye'
)e6t t! t*e ust!mer )umber.
>C? SAP AG BC400 33
0*e $iel's CUSTOMID- CUSTTYPE- SMO@ER- CLASS- LOCCURAM- a)' LOCCUR@EY
s*!ul' be !&ie' %it* $iel' labels.
#:6 Mai)tai) t*e sree) $iel' attributesE
9iel's CARRID- CONNID- FLDATE- OO@ID6 a)' CUSTOMID s*!ul' be 'is&laye' as
!ut&ut $iel's >O$tp$t fiel! attribute?.
0*e ust!mer )ame NAME s*!ul' be 'is&laye' )e6t t! t*e ust!mer )umber %it*!ut te6t
>O$tp$t only attribute?.
0*e $iel's CUSTTYPE- SMO@ER- CLASS- LOCCURAM6 a)' LOCCUR@EY are i)&ut/!ut&ut
$iel's >Inp$t fiel!3O$tp$t fiel! attributes?.
>C? SAP AG BC400 34
("ercses
1nt: 0creen
Topc: 3ata Transport
At t*e !)lusi!) !$ t*ese e6erises- y!u %ill be able t!E
9ill t*e sree) $iel's %it* 'ata $r!m t*e &r!5ram
C*a)5e y!ur &r!5ram =C!""/>>/DYNPROE
D!uble:li(i)5 !) a li)e !$ t*e basi list 'is&lays 'etails !$ t*e selete'
b!!(i)5 !) t*e sree). /$ t*e user *a)5es 'ata !) t*e sree)- t*e) t*ese
*a)5es s*!ul' be a+ailable i) t*e &r!5ram !)e t*e user *as le$t t*e
sree).
Program: =C!""/>>/DYNPRO
)odel soluton: SAPC!""UDS/DYNPRO/
".# C*a)5e y!ur &r!5ram IBC400_##_DYNPRO !r !&y t*e tem&late
SAPBC400+DS_DYNPRO_A t! t*e )e% &r!5ram IBC400_##_DYNPRO_B%
"." /) y!ur &r!5ram- use t*e TALES stateme)t t! reate a %!r( area %it* t*e same
)ame. 0*is %!r( area %ill t*e) ser+e as t*e sree) i)ter$ae.
":3 1)sure t*at t*e (ey $iel's !$ t*e SOO@ 'atabase table a)' t*e ust!mer )ame are
still a+ailable >HIDE: ...? i) t*e AT LINE1SELECTION e+e)t bl!( a$ter a li)e
*as bee) selete' !) t*e basi list >'!uble li( !r 9"?.
":4 C*a)5e y!ur &r!5ram a!r'i)5ly s! t*at 'ata i) t*e 'atabase a) be *a)5e'.
Ma(e sure t*at t*e sree) a) be &r!esse' !)ly i$ t*e user *as *a)5e aut*!riCati!)
$!r t*e airli)e selete'.
Be$!re t*e sree) is alle'- retrie+e t*e 'ata !$ t*e selete' &!sti)5 $r!m t*e SBOOK
'atabase table i)t! a suitable %!r( area >)ame &r!&!salE .a/s,ooM? 0! ma(e sure
t*at t*e 'ata is u&:t!:'ate. /$ t*e 'ata re!r' a))!t be rea'- t*e system must 'is&lay
i)$!rmati!) messa5e #A6 $r!m messa5e lass BC400. /$ t*e 'ata is rea'
suess$ully- all t*e sree).
":5 /mme'iately be$!re t*e sree) is alle'- !&y t*e rele+a)t 'ata i)t! t*e TALES
%!r( area.
>C? SAP AG BC400 35
("ercses
1nt: 0creen
Topc: *eld Transports and 0ubse.uent 0creen Processng
At t*e !)lusi!) !$ t*ese e6erises- y!u %ill be able t!E
Create &us*butt!)s !) sree)s
Pr!ess t*e system !'e tri55ere' %*e) t*e user li(s !) a
&us*butt!) a)' t*us !)tr!l t*e &r!5ram $l!%
Set t*e )e6t sree) 'y)amially
C*a)5e y!ur &r!5ram =C!""/>>/DYNPROE
O) t*e sree)- t*e user s*!ul' be able t! !)tr!l &r!5ram $l!% t*r!u5*
t%! &us*butt!)s.
Program: =C!""/>>/DYNPRO
)odel soluton: SAPC!""UDS/DYNPRO/C
3:# C*a)5e y!ur &r!5ram =C!""/>>/DYNPRO !r !&y t*e tem&late
SAPC!""UDS/DYNPRO/ t! t*e )e% &r!5ram =C!""/>>/DYNPRO/C.
3:" De$i)e t%! &us*butt!)s !) t*e sree) t*at all!% t*e user t! eit*er retur) t! t*e basi
list >PUSH/AC@? !r t! sa+e t*e *a)5e' 'ata >PUSH/SA;E?E
Name !$
&us*butt!)
Te"t 9u)ti!) !'e
P;S<UBACS Ba( BAC:
P;S<USA71 &ave
!r i!)
/CONUS@S01MUSA71
0A@(
3:3 Name t*e O@/CODE $iel' !) t*e sree) a)' 'e$i)e a 'ata !bGet !$ t*e same )ame
>a)' !rres&!)'i)5 ty&e? i) t*e &r!5ram.
3:4 Na+i5ate i) t*e $l!% l!5i. Create a m!'ule $!r $u)ti!) !'e &r!essi)5 >usi)5
$!r%ar' )a+i5ati!)? at P%+C(00 A*T(% 2-P1TE
9u)ti!) !'e Acton Ne6t sree)
BACS N!)e 3ist
SA71 *rst: 3ist
>C? SAP AG BC400 36
9u)ti!) !'e Acton Ne6t sree)
/)$!rmati!) messa5e )!.
060>BC400?
All !t*ers N!)e Sree) #00
3:5 1)sure t*at &ressi)5 Enter al%ays 'is&lays sree) #00- re5ar'less !$ t*e )a+i5ati!)
*ist!ry. /)itialiCe t*e +:>C+3( $iel' i) a PBO m!'ule.
>C? SAP AG BC400 3A
11.34Screens So%&tions
1nt: 0creens
Topc: Creatng 0creens
)odel 0oluton: Program SAPC!""UDS/DYNPRO/A
<D//////////////////////////////////////////////////////////////<
<D Repo# SAPBC400+DS_DYNPRO_A <
<D <
<D <
<D//////////////////////////////////////////////////////////////<
REPORT ,ap).400-d,_d$npo_a%
CONSTANTS a.#4#_d",p&a$ TYPE a.#"4_a-#( *AL+E B07B%
2 De+#n#t#on o+ sele$t#on s$%een
PARAMETERS pa_an-m TYPE ,)oo9/a'en.$n-m%
2 .o%Ma%ea +o% sele$t
DATA= ;a_)oo9"n' TYPE ,).400_)oo9"n'%
START/OF/SELECTION%
2 sele$t#n( 4ata )s#n( an AAP 4#$t#ona%' v#e. to (et t&e 4ata +%om
2 s,ooM an4 t&e $)stome% name +%om s$)stom
SELECT .a"d .onn"d !&da#e )oo9"d .-,#om"d name
FROM ,).400_)oo9"n'
INTO CORRESPONDING FIELDS OF ;a_)oo9"n'
W0ERE a'en.$n-m > pa_an-m%
A+T0ORITY/C0ECK OBEECT BS_CARRIDB
ID BCARRIDB FIELD ;a_)oo9"n'/.a"d
ID BACT*TB FIELD a.#4#_d",p&a$%
IF ,$/,-). > 0%
2 O)tp)t
WRITE= ? ;a_)oo9"n'/.a"d COLOR .o&_9e$8
;a_)oo9"n'/.onn"d COLOR .o&_9e$8
;a_)oo9"n'/!&da#e COLOR .o&_9e$8
;a_)oo9"n'/)oo9"d COLOR .o&_9e$8
;a_)oo9"n'/name%
ENDIF%
ENDSELECT%
AT LINE1SELECTION0
CALL SCREEN <""0
#:3 Create a sree) usi)5 $!r%ar' )a+i5ati!)
>C? SAP AG BC400 38
>'!uble:li( #00 i) t*e CA44 0C%((- D00 stateme)t?.
#:4 Mai)tai) sree) attributes
: 1)ter a 'esri&ti+e s*!rt te6t
: Set t*e )e6t sree) t! 0
#:5 3ay!ut
: Na+i5ate t! t*e Gra&*ial 3ay!ut 1'it!r
: C*!!se t*e ict!Progra" #iel$s i!)
: 1)ter 037->B++:
: C*!!se t*e %et #ro" ictionary i!)
: Selet t*e $iel's y!u %a)t
*!!se &nter t! !)$irm- a)' 'ra5 t*ese $iel's t! t*e sree)

: #st Bl!(E
Copy key feldsE CARRID6 CONNID6 FLDATE6 a)' OO@ID
%it* $iel' )ames
: ")' Bl!(E
Copy customer name -A)(
%it*!ut a $iel' )ame >*!!se t*e Witho't te(t ra'i! butt!)?
: 3r' Bl!(E
C!&y t*e feldsE CUSTOMID6 CUSTTYPE6 SMO@ER6 CLASS6
LOCCURAM- a)' LOCCUR@EY
%it* $iel' )ames
#:6 C*a)5e t*e $iel' attributes :
$!r e6am&le- by '!uble:li(i)5 t*e i)&ut $iel'
: C*a)5e t*e attributesE
: 0*e $iel's CA%%239 C+--239 *43AT(- B++:23- a)' C10T+)23
s*!ul' be 'is&laye' as !ut&ut $iel's >O$tp$t fiel! attribute?.
: 0*e ust!mer )ame -A)( s*!ul' be 'is&laye' )e6t t! t*e ust!mer )umber
%it*!ut te6t
>O$tp$t only attribute?.
: 0*e $iel's C10TT7P(- 0)+:(%- C4A00- 4+CC1%A)- a)'
4+CC1%:(7 s*!ul' be b!t* i)&ut:rea'y a)' !ut&ut:rea'y >t*e Inp$t3O$tp$t fiel!
attribute?.
.
>C? SAP AG BC400 38
0olutons
1nt: 0creens
Topc: 3ata Transport
)odel 0oluton: Program SAPC!""UDS/DYNPRO/
<D//////////////////////////////////////////////////////////////<
<D Repo# SAPBC400+DS_DYNPRO_B <
<D <
<D <
<D//////////////////////////////////////////////////////////////<
REPORT ,ap).400-d,_d$npo_)%
CONSTANTS= a.#4#_d",p&a$ TYPE a.#"4_a-#( *AL+E B07B8
a.#4#_.(an'e TYPE a.#"4_a-#( *AL+E B06B%
2 De+#n#t#on o+ sele$t#on s$%een
PARAMETERS pa_an-m TYPE ,)oo9/a'en.$n-m%
2 .o%Ma%ea +o% l#st
DATA ;a_)oo9"n' TYPE ,).400_)oo9"n'%
2 .o%Ma%ea +o% s#n(le ,ooM#n( to ,e $&an(e4
DATA .a/s,ooM TYPE s,ooM0
2 .o%Ma%ea +o% 4'np%o
TALES s4'n/,ooM0
START/OF/SELECTION%
2 sele$t#n( 4ata )s#n( an A4#$t#ona%' v#e. to (et t&e 4ata +%om
2 s,ooM an4 t&e $)stome% name +%om s$)stom
SELECT .a"d .onn"d !&da#e )oo9"d .-,#om"d name
FROM ,).400_)oo9"n'
INTO CORRESPONDING FIELDS OF ;a_)oo9"n'
W0ERE a'en.$n-m > pa_an-m%
A+T0ORITY/C0ECK OBEECT BS_CARRIDB
ID BCARRIDB FIELD ;a_)oo9"n'/.a"d
ID BACT*TB FIELD a.#4#_d",p&a$%
IF ,$/,-). > 0%
2 O)tp)t
WRITE= ? ;a_)oo9"n'/.a"d COLOR .o&_9e$8
;a_)oo9"n'/.onn"d COLOR .o&_9e$8
;a_)oo9"n'/!&da#e COLOR .o&_9e$8
;a_)oo9"n'/)oo9"d COLOR .o&_9e$8
;a_)oo9"n'/name%
HIDE: .a/,ooM#n(1$a%%#46
.a/,ooM#n(1$onn#46
.a/,ooM#n(1+l4ate6
.a/,ooM#n(1,ooM#46
.a/,ooM#n(1name0
>C? SAP AG BC400 40
ENDIF%
ENDSELECT%
AT LINE/SELECTION%
AUTHORITY1CHEC@ ORECT 9S/CARRID9
ID 9CARRID9 FIELD .a/,ooM#n(1$a%%#4
ID 9ACT;T9 FIELD a$tvt/$&an(e0
IF s'1s),%$ 7 "0
SELECT SINGLE 2
FROM s,ooM
INTO .a/s,ooM
3HERE $a%%#4 7 .a/,ooM#n(1$a%%#4
AND $onn#4 7 .a/,ooM#n(1$onn#4
AND +l4ate 7 .a/,ooM#n(1+l4ate
AND ,ooM#4 7 .a/,ooM#n(1,ooM#40
IF s'1s),%$ 7 "0
MO;E1CORRESPONDING .a/s,ooM TO s4'n/,ooM0
MO;E .a/,ooM#n(1name TO s4'n/,ooM1name0
CALL SCREEN 500%
ENDIF0
ELSE 0
MESSAGE ID 9C!""9 TYPE 9S9 NUMER 9"!E9
3ITH .a/,ooM#n(1$a%%#40
ENDIF0
>C? SAP AG BC400 4#
1nt: 0creens
Topc: *eld Transports and 0ubse.uent 0creen Processng
)odel 0oluton: Program SAPC!""UDS/DYNPRO/C
<D//////////////////////////////////////////////////////////////<
<D Repo# SAPBC400+DS_DYNPRO_C <
<D <
<D <
<D//////////////////////////////////////////////////////////////<
REPORT ,ap).400-d,_d$npo_.%
CONSTANTS= a.#4#_d",p&a$ TYPE a.#"4_a-#( *AL+E B07B8
a.#4#_.(an'e TYPE a.#"4_a-#( *AL+E B06B%
2 De+#n#t#on o+ sele$t#on s$%een
PARAMETERS pa_an-m TYPE ,)oo9/a'en.$n-m%
2 .o%Ma%ea +o% l#st
DATA ;a_)oo9"n' TYPE ,).400_)oo9"n'%
2 .o%Ma%ea +o% s#n(le ,ooM#n( to ,e $&an(e4
DATA ;a_,)oo9 TYPE ,)oo9%
2 .o%Ma%ea +o% 4'np%o
TABLES ,d$n_)oo9%
2 va%#a,le +o% +)n$t#on $o4e o+ )se% a$t#on
DATA oM/$o4e LI@E s'1)$omm0
START/OF/SELECTION%
2 sele$t#n( 4ata )s#n( a 4#$t#ona%' v#e. to (et t&e 4ata +%om
2 s,ooM an4 t&e $)stome% name +%om s$)stom
SELECT .a"d .onn"d !&da#e )oo9"d .-,#om"d name
FROM ,).400_)oo9"n'
INTO CORRESPONDING FIELDS OF ;a_)oo9"n'
W0ERE a'en.$n-m > pa_an-m%
A+T0ORITY/C0ECK OBEECT BS_CARRIDB
ID BCARRIDB FIELD ;a_)oo9"n'/.a"d
ID BACT*TB FIELD a.#4#_d",p&a$%
IF ,$/,-). > 0%
2 O)tp)t
WRITE= ? ;a_)oo9"n'/.a"d COLOR .o&_9e$8
;a_)oo9"n'/.onn"d COLOR .o&_9e$8
;a_)oo9"n'/!&da#e COLOR .o&_9e$8
;a_)oo9"n'/)oo9"d COLOR .o&_9e$8
;a_)oo9"n'/name%
0IDE= ;a_)oo9"n'/.a"d8
;a_)oo9"n'/.onn"d8
>C? SAP AG BC400 4"
;a_)oo9"n'/!&da#e8
;a_)oo9"n'/)oo9"d8
;a_)oo9"n'/name%
ENDIF%
ENDSELECT%
CLEAR ;a_)oo9"n'%
AT LINE/SELECTION%
A+T0ORITY/C0ECK OBEECT BS_CARRIDB
ID BCARRIDB FIELD ;a_)oo9"n'/.a"d
ID BACT*TB FIELD a.#4#_.(an'e%
IF ,$/,-). > 0%
SELECT SINGLE <
FROM ,)oo9
INTO ;a_,)oo9
W0ERE .a"d > ;a_)oo9"n'/.a"d
AND .onn"d > ;a_)oo9"n'/.onn"d
AND !&da#e > ;a_)oo9"n'/!&da#e
AND )oo9"d > ;a_)oo9"n'/)oo9"d%
IF ,$/,-). > 0%
MO*E/CORRESPONDING ;a_,)oo9 TO ,d$n_)oo9%
MO*E ;a_)oo9"n'/name TO ,d$n_)oo9/name%
CALL SCREEN 500%
ENDIF%
ELSE %
MESSAGE ID BBC400B TYPE BSB N+MBER B04JB
WIT0 ;a_)oo9"n'/.a"d%
ENDIF%
CLEAR= ;a_,)oo98 ;a_)oo9"n'%
<D//////////////////////////////////////////////////////////////<
<D Mod-&e CLEAR_OK_CODE O+TP+T <
<D//////////////////////////////////////////////////////////////<
<D #e1# <
<D//////////////////////////////////////////////////////////////<
MODULE $lea%/oM/$o4e OUTPUT0
CLEAR oM/$o4e0
ENDMODULE0 5 CLEAR/O@/CODE OUTPUT
<D//////////////////////////////////////////////////////////////<
<D Mod-&e +SER_COMMAND_0500 INP+T <
<D//////////////////////////////////////////////////////////////<
<D #e1# <
<D//////////////////////////////////////////////////////////////<
MODULE )se%/$omman4/"<"" INPUT0
CASE oM/$o4e0
3HEN 9AC@90
LEA;E TO SCREEN "0
3HEN 9SA;E90
MO;E1CORRESPONDING s4'n/,ooM TO .a/s,ooM0
MESSAGE ID 9C!""9 TYPE 9I9 NUMER 9"W"90
LEA;E TO SCREEN "0
>C? SAP AG BC400 43
ENDCASE0
ENDMODULE0 5 USER/COMMAND/"<"" INPUT
>C? SAP AG BC400 44
+2
SAP AG 2001
Creating inter$aces using the (enu Painter &ith the
subob6ects:
Title
(enu bar
Standard toolbar
Application toolbar
Function key assign%ent
Contents:
4nter$aces
>C? SAP AG BC400 #
12.2
SAP AG 2001
At the conclusion o$ this unit0 you &ill be able to:
4nter$aces: <nit 7b6ecti"es
Create a <4 title
Create a <4 status $or a list and a screen that
contains the $ollo&ing subob6ects:
(enu bar
Standard toolbar
Application toolbar
Function key assign%ent
>C? SAP AG BC400 "
12.3
SAP AG 2001
7"er"ie&: Screen
Flight data 9dit oto Syste% :elp
Bel$ F1
#hoose F2
Back F3
!
!
!
(enu bar
Standard toolbar
Application toolbar
Eey assign%ent
768 tit%e
SET TITLEAR KnL0
768 stat&s
SET PF1STATUS KnL0
0*e sree) !)tai)s t*e $!ll!%i)5 eleme)tsE
0*e ttle bar !)tai)s t*e title !$ t*e urre)t sree).
0*e menu bar !)tai)s e6&a)'able me)us.
0*e menus !)tai) t*e e6eutable $u)ti!)s $!r t*e urre)t &r!5ram. Me)us a) als! !)tai)
subme)us >asa'i)5 me)us?. 0*e me)us &ystem a)' *elp a) be $!u)' !) e+ery sree) i) R/3 a)'
al%ays !)tai) t*e same $u)ti!)s. Neit*er !$ t*ese me)us may be *a)5e' !r *i''e).
0*e standard toolbar !)tai)s i!)s $!r $reBue)tly use' $u)ti!)s. 0*e R/3 sta)'ar' t!!lbar al%ays
!)tai)s t*e same i!)s %it* sta)'ar' $u)ti!)s assi5)e' t! t*em. 9u)ti!)s t*at a))!t be e6eute'
!) t*e urre)t sree) are 5raye' !ut.
0*e functon key assgnment a) be 'is&laye' by ri5*t:li(i)5. /'eally- y!u s*!ul' be able t!
e6eute all me)u $u)ti!)s usi)5 $u)ti!) (eys as %ell.
0*e applcaton toolbar !)tai)s i!)s a)' &us*butt!)s $!r $reBue)tly use' $u)ti!)s !) a
&artiular sree).
1a* &r!5ram is reate' %it* a) i)ter$ae !)tai)i)5 all !$ t*e ab!+e t!!ls a)' !bGets. Di$$ere)t
+ie%s !$ t*is i)ter$ae are t*e) reate' $!r i)'i+i'ual sree)sE G;/ status.
>C? SAP AG BC400 3
12.4
SAP AG 2001
7b6ecti"e: 9'a%ple Progra% 4nter$ace

Print
Sa"e > send
Sa"e CtrlBS
9'it
7$$ice
-eport tree
File!!!
Flight data 9dit oto Syste% :elp
Print
Sa"e > send
Sa"e CtrlBS
9'it
7$$ice
-eport tree
File!!!
Flight data 9dit oto Syste% :elp
2ist
Screen
0+00
@!u %ill 'e$i)e a) i)ter$ae $!r t*e e)tire e6am&le &r!5ram. 0*e +ari!us statuses %ill *a+e t*e
$!ll!%i)5 attributesE
0*e same me)u bar %ill be a+ailable !) b!t* t*e list a)' t*e sree). O)ly t*!se me)u $u)ti!)s t*at
a) be e6eute' %ill a&&ear i) bla(.
/) t*e sta)'ar' t!!lbar- !)ly t*!se $u)ti!)s t*at a) be e6eute' %ill a&&ear i) !l!r. Sree)
$u)ti!)ality %ill )!t be altere' i) a)y %ay.
0*e sree) %ill *a+e its !%) title.
>C? SAP AG BC400 4
12.5
SAP AG 2001
Create Status
Flight data 9dit oto Syste% :elp Flight data 9dit oto Syste% :elp
SET PF1STATUS 9LIST/STATUS90
2ist Screen
@!u set a status usi)5 t*e SET PF/STAT+S stateme)t be$!re t*e 'is&lay !$ t*e sree).
0*is status remai)s +ali' $!r all subseBue)t sree)s &r!+i'e' y!u '! )!t set a )e% status.
>C? SAP AG BC400 5
12.6
SAP AG 2001
Setting a Status $or 9ach Screen
Flight data 9dit oto Syste% :elp
Flight data 9dit oto Syste% :elp
2ist Screen
SET PF1STATUS 9DYNP/<""90 SET PF1STATUS 9DYNP/<""90 SET PF1STATUS 9LIST/STATUS90 SET PF1STATUS 9LIST/STATUS90
/) t*e e6am&le- a se&arate status is set $!r ea* sree). <!%e+er- t*e same $u)ti!)s are t! be
a+ailable i) e+ery status.
N!t all $u)ti!)s are a&&r!&riate !) b!t* sree)sH $!r e6am&le t*e &ri)t $u)ti!) is use$ul !)ly !) t*e
list.
De&e)'i)5 !) %*et*er it is a list !r a sree)- t*e $u)ti!)s s*!ul' be bla( >ati+e !r e6eutable? !r
5ray >i)ati+e !r )!t e6eutable?.
>C? SAP AG BC400 6
12.7
SAP AG 2001
-e$erences to Subob6ects
Flight data 9dit Flight data 9dit oto oto Syste% :elp Syste% :elp
(enu bar (enu bar
Standard toolbar>$unction key assign%ent Standard toolbar>$unction key assign%ent
Application toolbar Application toolbar
SET PF1STATUS 9DYNP/<""90 SET PF1STATUS 9LIST/STATUS90
Flight data 9dit Flight data 9dit oto oto Syste% :elp Syste% :elp
9!r t*e sa(e !$ sim&le mai)te)a)e- %e '! )!t %a)t t! reate t*e sub!bGets me)u bar a)' sta)'ar'
t!!lbar %it* $u)ti!) (eys a)' a&&liati!) t!!lbars $!r t*e sree) status a5ai).
0*ere$!re %e sim&ly re$ere)e t*e sub!bGets alrea'y reate' i) t*e !)te6t !$ t*e list status a)'
'e$i)e- $r!m t*e &!i)t !$ +ie% !$ t*e status- %*i* $u)ti!)s are ati+e !r i)ati+e.
>C? SAP AG BC400 A
12.8
SAP AG 2001
Creating <4 Statuses $or 2ists
G30 "n!er-ace: S!a!us /0S,AS,A,3S oes no! e2"s!.
Do &ou ;an! !o crea!e !he ob+ec!K
#ancel
Create ob6ect
Ces ?o
START1OF1SELECTION0
SET PF1STATUS 0
Create status
22222
/0S,AS,A,3S
S!a!us -or -l"(h! l"s!
Pro(ra*
S!a!us
S!a!us a!!r"bu!es
Shor! !e2!
S!a!us !&$e
8nl"ne s!a!us
D"alo( bo2
#on!e2! *enu
9LIST/STATUS9
@!u a) reate !r mai)tai) statuses i) t*ree 'i$$ere)t %aysE
By usi)5 t*e ob,ect lst n t*e ObGet Na+i5at!r
By usi)5 for#ard na$gaton i) t*e ABAP 1'it!r-
By usi)5 t*e )enu Panter.
.*e) reati)5 a status y!u a) reate a )e% me)u bar- a&&liati!) t!!lbar- a)' (ey assi5)me)t >t!&
'!%)?- a'!&t e6isti)5 !bGets >b!tt!m u&?- !r use a !mbi)ati!) !$ b!t* met*!'s.
G;/ status )ames a) *a+e a ma6imum !$ "0 *araters.
By *!!si)5 a status ty&e- y!u 'etermi)e %*et*er- $!r i)sta)e- a status re$ers t! a )!rmal sree) !r a
'ial!5 b!6. De&e)'i)5 !) t*e status ty&e- y!u *a+e a *!ie !$ 'i$$ere)t ty&es !$ $u)ti!)s.
>C? SAP AG BC400 8
12.9
SAP AG 2001
Ad6usting Statuses
Ad6ust status te%plate
24STCSTAT<S
4nclude te%plate in
status
Te%plate status!!!
2ist status
Selection screen
!!!
H Standard list $unctions are copied
H Standard description $or %enu bar
and key settings is entered
(enu bar
2ine selection list
i
i
i
Application toolbar
2ine selection list
Function keys
2ist 9dit oto
2ist o$ Functions
Standard list $unctions Standard list $unctions
Standard description Standard description
Aou can change the
description
0*e A!$st template $u)ti!) i) t*e E1tras me)u all!%s y!u t! i)lu'e sta)'ar'iCe' $u)ti!) !'es
i) y!ur status. 0*is $u)ti!) als! all!%s y!u t! i)lu'e !bGets $r!m a status !$ y!ur *!ie i) t*e
e6isti)5 status. @!u a) *!!se )!rms $!r list statuses a)' seleti!) sree)s !r use a)y status y!u
%a)t $r!m a)!t*er ABAP &r!5ram.
/$ y!u *!!se A!$st stat$s +ist stat$s- t*e system 5e)erates sta)'ar' list $u)ti!)s a)' t*e
sta)'ar' e)tries $!r t*e me)u a)' a&&liati!) t!!lbar- a)' t*e assi5)me)t !$ $u)ti!)s t! $u)ti!)
(eys. 1a* me)u bar- a&&liati!) t!!lbar- a)' $u)ti!) (ey setti)5 is als! 5i+e) a 'e$ault )ame-
%*i* y!u s*!ul' re&lae %it* a) e6&la)at!ry s*!rt te6t.
@!u a) 'is&lay t*e 5e)erate' $u)ti!)s by *!!si)5 t*e Information i!).
>C? SAP AG BC400 8
12.10
SAP AG 2001
Status in the (enu Painter: Function Eeys
F2
F/
!!!
Standard toolbar
NEX AC@ R3
PIC@
NPRI NSC P11
(enu bar
Flight data %enu bar
Application toolbar
i
Function keys
Flight data $unction keys
i
Flight data application toolbar
P1

PJ PJJ
i
@
NSCJ
Choose
-eco%%ended $unction key assign%ents
Freely assignable $unction keys
F)
F*
!!!
K000L Select
Sey assi5)me)t a) be 'i+i'e' i)t! t*ree areasE
0tandard toolbarE Certai) $u)ti!) !'es are &re'e$i)e' $!r t*e $u)ti!)s &ave- Back- E1it
pro'ram- "ancel- Print- $!r t*e &croll i!)s- a)' $!r t*e Enter &us*butt!). Sim&ly assi5) t*ese
!'es t! t*e sta)'ar' t!!lbar i!) a)' t*ey %ill be aut!matially assi5)e' t! t*eir !rres&!)'i)5
sta)'ar' $u)ti!) (eys.
%ecommended functon key assgnment: 0*e system &r!&!ses t*e $u)ti!)s t*at y!u s*!ul'
5e)erally assi5) t! s&ei$i $u)ti!) (eys.
*reely assgnable functon keys: 0*e system lists all t*e remai)i)5 $u)ti!) !'es t*at are )!t
assi5)e' by sta)'ar's. 9r!m t*is list- y!u a) *!!se a&&r!&riate $u)ti!) (eys $!r &r!5ram:
s&ei$i $u)ti!)s.
@!u a) als! 'e$i)e butt!)s !) a) a&&liati!) t!!lbar $!r $reBue)tly use' $u)ti!) (eys. 0*ese
&us*butt!)s a) *a+e i!)s !r te6t.
>C? SAP AG BC400 #0
12.11
SAP AG 2001
Statuses in the (enu Painter: (enu Bar
(enu bar
Flight data %enu bar
Application toolbar
i
Function keys
Flight data $unction keys
i
Flight data application toolbar
Flight data
Code Te't
9dit oto
Code Te't Code Te't
PIC@
NSC
NSCJ
R3
i
Choose
Find
Find ne't
Cancel
PRI
NEX
Back AC@
Print
Sa"e>send
9'it
O
/$ s! 'esire'- t*e system %ill su55est sta)'ar's $!r y!ur me)u bar. 0*ese a) als! be m!'i$ie'.
Me)u bars a) !)tai) u& t! ei5*t me)us. @!u a) 'e$i)e u& t! si6 !$ t*ese y!ursel$- but t*e &ystem
a)' *elp me)us are sta)'ar' a)' are a''e' automatcally by t*e system.
>C? SAP AG BC400 ##
12.12
SAP AG 2001
4ncluding 9'isting 9le%ents
(enu bar
SCREEN
SCREEN
i
i
i
2ist o$ Functions
8isplays e'isting
ob6ects and
allo&s you
to select the%
Application toolbar
SCREEN
Function keys
Create a )e% status $!r t*e sree) a)' use t*e i!) s*!%) i) t*e $i5ure t! 'is&lay all t*e me)u bars
a)' $u)ti!) (ey assi5)me)ts alrea'y 'e$i)e'. 0*e e6am&le &r!5ram 'is&lays !)ly !)e me)u bar !r
$u)ti!) (ey assi5)me)t.
D!uble:li( t*is t! re$ere)e t*e same me)u bar a)' $u)ti!) (ey assi5)me)t $!r t*e sree) status
as $!r t*e list status.
>C? SAP AG BC400 #"
12.13
SAP AG 2001
Setting Functions to Acti"e or 4nacti"e in the
Status
Function code
Flight data 9dit oto
Code Te't
+: Select $unction
code
2: Toggle bet&een acti"e and
inacti"e using the button
Back AC@
Application toolbar
Function keys
Flight data $unction keys
i
Flight data application toolbar
(enu bar
Flight data %enu bar
i
i
0! set status $u)ti!)s t! ati+e !r i)ati+e- &r!ee' as $!ll!%sE
S%it* t! t*e *a)5e m!'e !$ t*e status.
P!i)t t! t*e $u)ti!) !'e y!u %a)t t! ati+ate a)' *!!se Active Inactive !) t*e a&&liati!)
t!!lbar.
/) t*e e6am&le i) t*e 5ra&*i- %e are a''i)5 t*e SA*E $u)ti!)- %*i* is )!t a sta)'ar' list $u)ti!)-
t! t*e sta)'ar' t!!lbar a)' t*e ,li'ht !ata me)u. 0*e system i)$!rms us t*at %e are re$ere)i)5 t*e
me)u bar a)' sta)'ar' t!!lbar. /$ %e !)$irm t*e 'ial!5 b!6- t*e system aut!matially a''s t*e
SA*E $u)ti!) t! t*e me)u bar a)' sta)'ar' t!!lbar i) t*e list status a)' sets it t! i)ati+e.
0*e BACK a)' SA*E $u)ti!)s i) !ur e6am&le are e+aluate' i) t*e PA/ m!'ule
-,e_.ommand_0500.
>C? SAP AG BC400 #3
12.14
SAP AG 2001
Creating a <4 Title $or a Screen
MODULE stat)s/"<"" OUTPUT0
SET PF1STATUS 9DYNP/<""90
SET TITLEAR 9<""90
ENDMODULE0
Title code
Title
Flight connections
Sa"e
Pro(ra*
,"!le coe
,"!le
Create title
22222
100
#han(e -l"(h! !"*es
G30 "n!er-ace: ,"!le 100 oes no! e2"s!.
Do &ou ;an! !o crea!e !he ob+ec!K
#ancel
Create ob6ect
Ces ?o
9<""9
#on!"nue
@!u a) reate !r mai)tai) titles i) t*ree 'i$$ere)t %aysE
By usi)5 t*e ob,ect lst i) t*e Re&!sit!ry Br!%ser
By usi)5 for#ard na$gaton $r!m t*e ABAP 1'it!r
By usi)5 t*e )enu Panter
A G;/ title:)ame a) *a+e a ma6imum !$ "0 *araters.
-ote: /$ y!u reate t*e su55este' PBO m!'ule ,#a#-,_nnnn usi)5 $!r%ar' )a+i5ati!)- t*e SET
TITLEBAR B:::B stateme)t is aut!matially 5e)erate' i) t*e m!'ule. /t is i)ati+e. @!u a) use
t*is su55esti!) by erasi)5 t*e star a)' e)teri)5 t*e )umber !$ t*e title. N!% y!u a) reate t*e title
usi)5 $!r%ar' )a+i5ati!).
>C? SAP AG BC400 #4
12.15
SAP AG 2001
Aou are no& able to:
4nter$aces: <nit Su%%ary
Create a <4 title
Create a <4 status $or a list and a screen that
contains the $ollo&ing subob6ects:
(enu bar
Standard toolbar
Application toolbar
Function key assign%ent
>C? SAP AG BC400 #5
12.168nter9aces E$ercises
1nt: 2nterfaces
At t*e !)lusi!) !$ t*ese e6erises- y!u %ill be able t!E
Create user i)ter$aes $!r a &r!5ram
/)lu'e a G;/ status a)' G;/ title i) a &r!5ram
16te)' y!ur &r!5ram =C!""/>>/DYNPROE
0*e system is t! 'is&lay te6ts !rres&!)'i)5 t! t*e list a)' sree) i) t*e
title bar. @!u must s&ei$y t*e !rret status $!r t*e list a)' sree).
Program: =C!""/>>/DYNPRO
)odel soluton: SAPC!""UDS/DYNPRO/D
Template: SAPC!""UDS/DYNPRO/C
#:# 16te)' y!ur &r!5ram =C!""/>>/DYNPRO !r !&y t*e tem&late
SAPC!""UDS/DYNPRO/C t! t*e )e% &r!5ram =C!""/>>/DYNPRO/D.
#:" 4st status:
#:":# 9irst 'e$i)e a status $!r t*e list. Create t*e status >ty&eE 'ial!5
status? usi)5 $!r%ar' )a+i5ati!). /)lu'e t*e rele+a)t ABAP
stateme)t i) t*e &r!essi)5 bl!( START1OF1SELECTION. 0*e
status y!u reate must !rres&!)' t! t*e sta)'ar' list status. Create
a suitable $u)ti!) (ey assi5)me)t- a&&liati!) t!!lbar a)' me)u
bar. C*!!se E1tras A!$st templates +ist stat$s t! a'' t*e
sta)'ar' $u)ti!) !'es. C*a)5e t*e )ame !$ t*e le$t me)u list
$r!m +ist t! Bookin's.
#:":" A'' t*e $u)ti!) !'e SA71- %*i* y!u must be able t! aess usi)5
t*e &ave i!) i) t*e sta)'ar' t!!lbar- t! t*e $u)ti!) (ey assi5)me)t. @!u must als!
be able t! *!!se SA71 usi)5 a) e)try i) t*e Bookin's me)u list. Deati+ate t*e
SA71 $u)ti!) i) t*is status.
#:3 0creen status:
#:3:# Assi5) a status >ty&eE 'ial!5 status? t! t*e sree). 0! '! s!- i)lu'e t*e
rele+a)t ABAP stateme)t i) a m!'ule at t*e &!i)t !$ t*e PROCESS BEFORE
O+TP+T. D! not reate t*e $u)ti!) (ey assi5)me)t- a&&liati!) t!!lbar- a)' me)u
>C? SAP AG BC400 #6
bar a5ai)- but i)stea' re$ere)e t*e !bGets reate' i) t*e last ste& >#:":"?. Ati+ate
t*e $u)ti!) !'es BACK a)' SA*E i) t*is status a)' ati+ate t*e i)ter$ae.
#:4 O&ti!)al :
Assi5) a G;/ title t! t*e basi list a)' sree) >usi)5 $!r%ar' )a+i5ati!)?.
>C? SAP AG BC400 #A
12.178nter9aces So%&tions
1nt: 2nterfaces
#:":# /) t*e &r!5ram s!ure !'e- a'' t*e SET PF/STAT+S BLISTB stateme)t t! t*e
START/OF/SELECTION e+e)t.
>-oteE 0e6t bet%ee) t*e t%! a&!str!&*es must be i) u&&erase?.
/) t*e &r!5ram li)e SET PF/STAT+S BLISTB- '!uble:li( t*e LIST status
)ame.
0*e system 'is&lays a 'ial!5 b!6 !)tai)i)5 t*e %!r's O0*e G;/ i)ter$ae status
T3/S0F '!es )!t e6ist. D! y!u %a)t t! reate itKP
C*!!se 9es t! !)$irm.
1)ter t*e s*!rt te6t.
C*!!se t*e status ty&e Dialo' stat$s.
C*!!se E1tras A!$st template +ist stat$s
A'Gust t*e )ame !$ t*e me)u bar a)' $u)ti!) (ey assi5)me)t t! suit y!ur !%)
)ee's.
C*a)5e t*e )ame !$ t*e me)u +ist t! Bookin's.
#:":" /) t*e sta)'ar' t!!lbar- e)ter t*e $u)ti!) !'e SA*E ab!+e t*e &ave i!) a)'
*!!se Enter. D!uble:li( t! !&e) t*e Bookin's me)u- e)ter SA*E as a $u)ti!)
!'e- a)' assi5) t*e te6t &ave bookin's t! it.
C*!!se Active Inactive t! 'eati+ate SA*E $!r t*is status.
Ati+ate t*e status.
#:3 G!t! t*e *a)5e m!'e !$ sree) #00. >Ri5*t:li( !) t*e sree) )umber i) t*e
!bGet list !$ t*e &r!5ram.? /) t*e $l!% l!5i- a'' t*e MODULE
set/stat)s/"<"" stateme)t t! t*e PROCESS BEFORE O+TP+T e+e)t.
D!uble:li( t*e )ame !$ t*e m!'ule t! reate t*e m!'ule >usi)5 $!r%ar'
)a+i5ati!)?- !)$irm t*e 'ial!5 b!6 by *!!si)5 )es- *!!se 7ain pro'ram i) t*e
subseBue)t 'ial!5 b!6- a)' a'' t*e $!ll!%i)5 s!ure !'eE
2U111111111111111111111111111111111111111111112
2U Mod-&e SET_STAT+S_0500 O+TP+T
2U111111111111111111111111111111111111111111112
MOD+LE ,e#_,#a#-,_0500 O+TP+T%
SET PF1STATUS 9DYNPRO90
ENDMOD+LE%
Create t*e status usi)5 $!r%ar' )a+i5ati!). D!uble:li( BDYNPROB i) t*e SET
PF/STAT+S BDYNPROB stateme)t.
C*!!se 9es t! !)$irm t*e 'ial!5 b!6.
/) t*e )e6t 'ial!5 b!6- e)ter a s*!rt te6t a)' *!!se Dialo' stat$s.
Plae t*e urs!r !) t*e menu bar a)' *!!se t*e re$ere)e i!). Create t*e
re$ere)e t! t*e e6isti)5 me)u bar by '!uble:li(i)5.
>C? SAP AG BC400 #8
P!i)t t! ,$nction keys a)' *!!se t*e re$ere)e i!). Create t*e re$ere)e t! t*e
e6isti)5 $u)ti!) (ey assi5)me)t by '!uble:li(i)5.
Ati+ate t*e t%! $u)ti!)s SA*E a)' BACK by &!i)ti)5 t! t*e $u)ti!) !'e i) t*e
me)u !r !) t*e $u)ti!) (ey assi5)me)t a)' *!!si)5 t*e Activate i!)
Ati+ate t*e status.
Ati+ate t*e sree).
#:4 16te)' t*e &r!5ram s!ure !'e i) t*e e+e)t
START/OF/SELECTION%=
SET PF/STAT+S BLISTB%
SET TITLEAR 9LIST90
Create t*e title usi)5 $!r%ar' )a+i5ati!) a)' e)ter t*e te6t i) t*e 'ial!5 b!6.
16te)' t*e s!ure !'e !$ t*e SET/STATUS/"<"" m!'uleE
2U1111111111111111111111111111111111111111112
2U Mod-&e SET_STAT+S_0500 O+TP+T
2U1111111111111111111111111111111111111111112
MOD+LE ,e#_,#a#-,_0500 O+TP+T%
SET PF/STAT+S BDYNPROB%
SET TITLEAR 9DYNPRO90
ENDMOD+LE%
Create t*e title usi)5 $!r%ar' )a+i5ati!) a)' e)ter t*e te6t i) t*e 'ial!5 b!6.
Ati+ate t*e status a)' t*e &r!5ram.
>C? SAP AG BC400 #8
0ource code for the program SAPC!""UDS/DYNPRO/D
<D//////////////////////////////////////////////////////////////<
<D Repo# SAPBC400+DS_DYNPRO_D <
<D <
<D//////////////////////////////////////////////////////////////<
REPORT ,ap).400-d,_d$npo_d%
CONSTANTS= a.#4#_d",p&a$ TYPE a.#"4_a-#( *AL+E B07B8
a.#4#_.(an'e TYPE a.#"4_a-#( *AL+E B06B%
2 De+#n#t#on o+ sele$t#on s$%een
PARAMETERS pa_an-m TYPE ,)oo9/a'en.$n-m%
2 .o%Ma%ea +o% l#st
DATA ;a_)oo9"n' TYPE ,).400_)oo9"n'%
2 .o%Ma%ea +o% s#n(le ,ooM#n( to ,e $&an(e4
DATA ;a_,)oo9 TYPE ,)oo9%
2 .o%Ma%ea +o% 4'np%o
TABLES ,d$n_)oo9%
2 va%#a,le +o% +)n$t#on $o4e o+ )se% a$t#on
DATA= o9_.ode LIKE ,$/-.omm%
START/OF/SELECTION%
SET PF1STATUS 9LIST90
SET TITLEAR 9LIST90
2 sele$t#n( 4ata )s#n( a 4#$t#ona%' v#e. to (et t&e 4ata +%om
2 s,ooM an4 t&e $)stome% name +%om s$)stom
SELECT .a"d .onn"d !&da#e )oo9"d .-,#om"d name
FROM ,).400_)oo9"n'
INTO CORRESPONDING FIELDS OF ;a_)oo9"n'
W0ERE a'en.$n-m > pa_an-m%
A+T0ORITY/C0ECK OBEECT BS_CARRIDB
ID BCARRIDB FIELD ;a_)oo9"n'/.a"d
ID BACT*TB FIELD a.#4#_d",p&a$%
IF ,$/,-). > 0%
2 O)tp)t
WRITE= ? ;a_)oo9"n'/.a"d COLOR .o&_9e$8
;a_)oo9"n'/.onn"d COLOR .o&_9e$8
;a_)oo9"n'/!&da#e COLOR .o&_9e$8
;a_)oo9"n'/)oo9"d COLOR .o&_9e$8
;a_)oo9"n'/name%
0IDE= ;a_)oo9"n'/.a"d8
;a_)oo9"n'/.onn"d8
;a_)oo9"n'/!&da#e8
;a_)oo9"n'/)oo9"d8
;a_)oo9"n'/name%
ENDIF%
ENDSELECT%
CLEAR ;a_)oo9"n'%
AT LINE/SELECTION%
A+T0ORITY/C0ECK OBEECT BS_CARRIDB
ID BCARRIDB FIELD ;a_)oo9"n'/.a"d
ID BACT*TB FIELD a.#4#_.(an'e%
IF ,$/,-). > 0%
>C? SAP AG BC400 "0
SELECT SINGLE <
FROM ,)oo9
INTO ;a_,)oo9
W0ERE .a"d > ;a_)oo9"n'/.a"d
AND .onn"d > ;a_)oo9"n'/.onn"d
AND !&da#e > ;a_)oo9"n'/!&da#e
AND )oo9"d > ;a_)oo9"n'/)oo9"d%
IF ,$/,-). > 0%
MO*E/CORRESPONDING ;a_,)oo9 TO ,d$n_)oo9%
MO*E ;a_)oo9"n'/name TO ,d$n_)oo9/name%
CALL SCREEN 500%
ENDIF%
ELSE %
MESSAGE ID BBC400B TYPE BSB N+MBER B04JB
WIT0 ;a_)oo9"n'/.a"d%
ENDIF%
CLEAR= ;a_,)oo98 ;a_)oo9"n'%
<D//////////////////////////////////////////////////////////////<
<D Mod-&e STAT+S_0500 O+TP+T <
<D//////////////////////////////////////////////////////////////<
< #e1# <
<///////////////////////////////////////////////////////////////<
MOD+LE STAT+S_0500 O+TP+T%
SET PF1STATUS 9DYNPRO90
SET TITLEAR 9DYNPRO9% Kop#"ona&
ENDMOD+LE% K STAT+S_0500 O+TP+T
<D//////////////////////////////////////////////////////////////<
<D Mod-&e CLEAR_OK_CODE O+TP+T <
<D//////////////////////////////////////////////////////////////<
<D #e1# <
<///////////////////////////////////////////////////////////////<
MOD+LE .&ea_o9_.ode O+TP+T%
CLEAR o9_.ode%
ENDMOD+LE% K CLEAR_OK_CODE O+TP+T
>C? SAP AG BC400 "#
<D//////////////////////////////////////////////////////////////<
<D Mod-&e +SER_COMMAND_0500 INP+T <
<D//////////////////////////////////////////////////////////////<
<D #e1# <
<D//////////////////////////////////////////////////////////////<
MOD+LE -,e_.ommand_0500 INP+T%
CASE o9_.ode%
W0EN BBACKB%
LEA*E TO SCREEN 0%
W0EN BSA*EB%
MO*E/CORRESPONDING ,d$n_)oo9 TO ;a_,)oo9%
MESSAGE ID BBC400B TYPE BIB N+MBER B0L0B%
LEA*E TO SCREEN 0%
ENDCASE%
ENDMOD+LE% K +SER_COMMAND_0500 INP+T
>C? SAP AG BC400 ""
+3
SAP AG 2001
SAP<4 $or :T(2 and 9asy Web Transaction
(aking selected transactions a"ailable $or the Web
(aking $unctions a"ailable in a Web=speci$ic layout
Contents:
7utlook: 8e"eloping 4nternet Applications
>C? SAP AG BC400 #
13.2
SAP AG 2001
Create a transaction code $or an 9asy Web
Transaction
Create an 4nternet ser"ice
Publish an 4nternet ser"ice
Test an 9asy Web Transaction using a Web
bro&ser
At the conclusion o$ this unit0 you &ill be able to:
7utlook: 8e"eloping 4nternet Applications
>C? SAP AG BC400 "
13.3
SAP AG 2001
Ai%: ABAP Progra% <ser 8ialogs in a Web Bro&ser
Progra%
start


ABAP runti%e syste%
ABAP progra%
@
!!!
Web Bro&ser
ht%l
ht%l
Action
ht%l
0! lau)* a) SAP &r!5ram $r!m a .eb br!%ser- y!u *a+e t! 5e)erate <0M3 &a5es $!r t*e sree)s.
@!u a) 5e)erate t*ese aut!matially.
>C? SAP AG BC400 3
13.4
SAP AG 2001
4nternet Transaction Ser"er
Progra%
start


ABAP runti%e syste%
ABAP progra%
4TS
!!!
Web Bro&ser
ht%l
ht%l
ht%l
0*e /)ter)et 0ra)sati!) Ser+er arries !ut t*is tas(.
>C? SAP AG BC400 4
13.5
SAP AG 2001
4TS Progra%%ing (odels
Business logic 8ialog logic Screen layout
Screen Screen
ABAP progra% ABAP progra%
H H (odule (odule
H H Function %odule Function %odule
H H BAP4 BAP4
:T(2
B<S4#9SS
=
Te%plate
ABAP progra% ABAP progra%
H H (odule (odule
H H Function %odule Function %odule
H H BAP4 BAP4
Screen Screen
:T(2
B<S4#9SS
=
Te%plate
H H -FC=co%patible -FC=co%patible
$unction %odule $unction %odule
H H BAP4 BAP4
4TS $lo& $ile
SAP<4
$or
:T(2
9asy
Web
Transaction
4TS
Flo&
2ogic
0*ere are t*ree &r!5rammi)5 m!'els $!r reati)5 i)ter)et a&&liati!)sE
0AP512 for 6T)4E <ere a) ABAP &r!5ram %it* user 'ial!5s &r!+i'es t*e basis $!r t*e 'is&lay-
'ial!5 l!5i- a)' busi)ess l!5i. 0*e lay!ut is 5e)erate' aut!matially $r!m t*e sree)
i)$!rmati!). 0*e a&&eara)e i) t*e .eb br!%ser !)tai)s e6atly t*e same eleme)ts as t*e sree).
(asy Web TransactonE O)ly t*e busi)ess l!5i a)' t*e 'ial!5 l!5i are !&ie' $r!m t*e ABAP
&r!5ram. @!u a) t*e) *a)5e t*e lay!ut !$ t*e &a5e.
2T0 *lo# 4ogcE O)ly t*e &ure busi)ess l!5i is e6eute' i) a) ABAP &r!5ram- %*i* a) be
alle' e6ter)ally : t*is is usually a BAP/ !r a) R9C:!m&atible $u)ti!) m!'ule. 0*e 'ial!5 l!5i
a)' lay!ut are 'e$i)e' !) t*e /0S.
0*e $!ll!%i)5 &a5es 'isuss t*e &r!5rammi)5 m!'els SAPG;/ $!r <0M3 a)' 1asy .eb
0ra)sati!) i) m!re 'etail.
>C? SAP AG BC400 5
13.6
SAP AG 2001
SAP<4 $or :T(2 and 9asy Web Transaction
ITS ITS
Web bro&ser Web bro&ser
SAP Syste%
SAP<4 $or :T(2:
The 4TS generates a
:T(2
B<S4#9SS
te%plate
dyna%ically
Publish
9asy Web Transaction:
The de"eloper generates a
static :T(2
B<S4#9SS
te%plate
SAP G;/ $!r <0M3 5e)erates <0M3 'y)amially $r!m t*e rele+a)t SAP sree)s. 9eatures !$ t*is
&r!ess areE
Sim&le- SAP sree):base' lay!ut
SAP sree) eleme)ts >su* as te6t !r i)&ut $iel's? are ma&&e' #E# t! t*e $iel's !) t*e 5e)erate'
<0M3 &a5e
N! !t*er <0M3 eleme)ts are a+ailable
N! $urt*er 'e+el!&me)t is )eessary
/) t*e .eb br!%ser- t*e user must e)ter t*e $!l!%i)5 &at*E
http:&&Eser$erF:EportF&EpathF&#gate&Eser$ce>nameF&
.it* 1asy .eb 0ra)sati!) t*e 'e+el!&er reates stati 6T)4
B102-(00
templates. 9eatures !$ t*is
&r!ess areE
9le6ible 'esi5) !$ t*e lay!ut. 0*e sree) i)$!rmati!) ser+es as a basis $!r t*e tem&lateH *!%e+er-
y!u a) a'Gust t*e tem&late t! suit i)'i+i'ual )ee's >$!r e6am&le- *i'e !m&le6 $u)ti!)s !r
i)lu'e a''iti!)al M/M1 !bGets?.
@!u a) a'' a''iti!)al $u)ti!)s.
9urt*er 'e+el!&me)t )eessaryE
@!u )ee' t! reate- e'it- a)' &ublis* <0M3 tem&lates. @!u als! )ee' t! im&leme)t a''iti!)al
$u)ti!)s y!ursel$.
>C? SAP AG BC400 6
13.7
SAP AG 2001
Change re5uest
Sa"e
8e"elop%ent class
DBC400CVV
Progra% na%e
DBC400CVVVVVVVVVV
Transaction classi$ication:
Pro$essional <ser Transaction
9asy Web Transaction
Creating 9WT Transaction Codes
Transaction code
Short te't
4nitial ob6ect:
Progra% and screen ,dialog transaction.
Progra% and selection screen ,report transaction.
Custo%er na%espace
Ser"ice
/) t*e ObGet Na+i5at!r- !&e) t*e !bGet list !$ t*e &r!5ram $!r %*i* y!u %a)t t! reate a) 1asy
.eb 0ra)sati!). /) t*e a&&r!&riate !)te6t me)u- *!!se
"reate Transaction)
1)ter a tra)sati!) !'e. C!m&ly %it* t*e ust!mer )ames&ae !)+e)ti!)s. 1)ter a s*!rt te6t) /$ t*e
&r!5ram is a) e6eutable &r!5ram- *!!se Pro'ram an! selection screen -.eport Transaction))
O) t*e )e6t sree)- e)ter t*e )ame !$ t*e &r!5ram. C*!!se Easy Web Transaction $!ll!%e' by &ave)
O) t*e )e6t sree)- e)ter t*e )ame !$ t*e 'e+el!&me)t lass t! %*i* t*e tra)sati!) !'e is t! be
assi5)e'.
O) t*e )e6t sree)- assi5) t*e *a)5e reBuest.
>C? SAP AG BC400 A
13.8
SAP AG 2001
Creating an 4nternet Ser"ice $or 9WT
7b6ect #a"igator 7b6ect #a"igator
DBC400C9WT
4nternet Ser"ice
8isplay 8isplay
9asy Web Transaction
Transaction code
4TS %i'ed %ode
Web application
start te%plate
Web9A$$l"ca!"on Bu"ler: #rea!e ser)"ce
4nternet Ser"ice
DBC400C9WT
Ser"ice DBC400C9WT does not e'ist!
8o you &ant to create the ob6ect@
Aes Aes
O)e %ay !$ ma(i)5 a tra)sati!) a+ailable !+er t*e /0S 'iretly is t! reate a ser+ie $ile. 0*e
ser+ie $ile !)tai)s t*e i)$!rmati!) i)'iati)5 %*i* tra)sati!) is t! be starte'.
@!u a) reate a ser+ie $!r a tra)sati!) i) t*e ObGet Na+i5at!r. C*!!se Internet &ervices a)' e)ter
a )ame $!r y!ur ser+ie. Ma(e sure y!u !m&ly %it* t*e ust!mer )ames&ae !)+e)ti!)s. /)ter)et
ser+ies are !$te) 5i+e) t*e same )ame as t*e tra)sati!) ass!iate' %it* t*em. @!u !ul'- *!%e+er-
use a 'i$$ere)t )ame- &artiularly i$ y!u are reati)5 se+eral ser+ies $!r t*e same tra)sati!).
C*!!se Enter !r t*e Display i!). /$ t*ere is )! ser+ie sa+e' u)'er t*e )ame y!u *a+e e)tere'-
y!u a) !)$irm t*e Buery %it* Enter.
/) t*e 'ial!5 b!6 t*at a&&ears- *!!se Easy Web Transaction a)' e)ter t*e tra)sati!) !'e.
Sa+e t*e ser+ie.
-ote:
/$ y!u *!!se IT& mi1e! mo!e, y!u '! )!t )ee' t! 5e)erate a stati <0M3 &a5e $!r ea* sree). /$ a
sree) is )!t ass!iate' %it* a) <0M3 &a5e- t*e SAPG;/ $!r <0M3 5e)erates t*e &a5e
'y)amially at ru)time.
>C? SAP AG BC400 8
13.9
SAP AG 2001
Creating Te%plates
7b6ect #a"igator 7b6ect #a"igator
DBC400C9WT
4nternet Ser"ice
DBC400C9WT
The%e //
!!!
Create
Web A$$l"ca!"on Bu"ler: #rea!e !e*$la!e
4nternet Ser"ice
The%e
DBC400C9WT
Create :T(2 $ro% screen
:T(2 te%plate na%e
Progra% na%e
Screen nu%ber
!!!
Sa"e
!!!
!!!
Te%plate
0! reate tem&lates $!r a ser+ie- *!!se "reate Template i) t*e !)te6t me)u $!r a t*eme.
/) t*e 'ial!5 b!6 $!r y!ur ser+ie a)' t*e selete' t*eme- e)ter t*e &r!5ram )ame a)' sree)
)umber- %*i* %ill ser+e as a basis $!r t*e tem&late.
Sa+e t*e tem&late.
>C? SAP AG BC400 8
13.10
SAP AG 2001
Publishing an 4nternet Ser"ice
7b6ect #a"igator 7b6ect #a"igator
DBC400C9WT
4nternet Ser"ice
DBC400C9WT
The%e //
!!!
Publish
Ser"ice $ile
Co%plete ser"ice
Publish
Co%plete ser"ice
SAP Syste%
ITS
9asy Web 9asy Web
Transaction Transaction
Ser"ice $ile
:T(2
B<S4#9SS
te%plate
SAP 2ibrary
@!u must sa+e t*e /)ter)et ser+ie i) a $ile t*e /0S a) aess. @!u a) &ublis* t*e ser+ie i) t*e
.eb A&&liati!) Buil'er i) t*e ObGet Na+i5at!rE
/) t*e ObGet Na+i5at!r- !&e) t*e !bGet list $!r t*e /)ter)et ser+ie.
/) t*e !)te6t me)u $!r t*e ser+ie- *!!se P$blish "omplete service)
-ote:
@!ur user:s&ei$i /0S setti)5s must be !rret be$!re y!u a) &ublis* a ser+ie. @!u a) *e( t*e
setti)5s i) t*e ObGet Na+i5at!r by *!!si)5 %tilities &ettin's IT& >tab i) t*e 'ial!5 b!6?.
>C? SAP AG BC400 #0
13.11
SAP AG 2001
&ttp:**#(tE"0.4+0sap1a(04e:<"V"*s$%#pts*.(ate*P,$!""/e.t*:
Testing the Web Transaction
7b6ect #a"igator 7b6ect #a"igator
DBC400C9WT
4nternet Ser"ice
DBC400C9WT
The%e //
!!!
Publish
Start ser"ice
Start ser"ice
Web bro&ser Web bro&ser
Web ser"er Path Ser"ice na%e
0! test a tra)sati!) a$ter &ublis*i)5 itE
C*!!se &tart service $r!m t*e !)te6t me)u >i) t*e /)ter)et ser+ie !bGet list?
1)ter http:&&Eser$erFG:EportFH&EpathF&#gate&Eser$ce>nameF& as t*e &at* i) a .eb br!%ser.
>C? SAP AG BC400 ##
13.12
SAP AG 2001
Create a transaction code $or an 9asy Web
Transaction
Create an 4nternet ser"ice
Publish an 4nternet ser"ice
Test an 9asy Web Transaction using a Web
bro&ser
Aou are no& able to:
7utlook: 8e"eloping 4nternet Applications
>C? SAP AG BC400 #"
+4
SAP AG 2001
Working &ith Function (odules
Working &ith (ethods
Working &ith BAP4s
Contents:
Cross=Progra% (odulari;ation
>C? SAP AG BC400 #
14.2
SAP AG 2001
Ac5uire in$or%ation on $unction %odules
4nclude $unction %odule calls in your progra%
4nclude ob6ect instances and %ethod calls in your
progra%
4nclude the A2? grid control $or displaying data in
a $i'ed screen area
Ac5uire in$or%ation on BAP4s
4nclude BAP4 calls in your progra%
At the conclusion o$ this unit0 you &ill be able to:
Cross=Progra% (odulari;ation: <nit 7b6ecti"es
>C? SAP AG BC400 "
14.3
SAP AG 2001
Working &ith Function (odules
Working &ith Function (odules
Working &ith Function (odules
Working &ith (ethods
Working &ith (ethods
Working &ith BAP4s
Working &ith BAP4s
>C? SAP AG BC400 3
14.4
SAP AG 2001
Function (odule
0n!er-ace 0n!er-ace
0*$or! 0*$or! $ara*e!ers $ara*e!ers
sy=subrc
A!!r"bu!es
/ocal a!a ob+ec!s
Source coe
0*$or! 0*$or! $ara*e!ers $ara*e!ers 42$or! 42$or! $ara*e!ers $ara*e!ers #han("n( $ara*e!ers #han("n( $ara*e!ers 42ce$!"ons 42ce$!"ons
Func!"on 'oule
*uncton modules are ati+ely i)te5rate' m!'ulariCati!) u)its %it* a) i)ter$ae.
9u)ti!) m!'ules a)- t*ere$!re- be alle' s&ei$ially $r!m %it*i) &r!5rams !r $u)ti!) m!'ules.
0*e i)ter$ae !$ a $u)ti!) m!'ule a) !)tai) t*e $!ll!%i)5 eleme)tsE
2mport parameters are &asse' t! t*e $u)ti!) m!'ule. /) 5e)eral- t*ese &arameters are assi5)e'
sta)'ar' ABAP Diti!)ary ty&es. /m&!rt &arameters a) als! be !&ti!)al.
("port parameters are reei+e' $r!m t*e $u)ti!) m!'ules. 16&!rt &arameters are al%ays
!&ti!)al.
Changng parameters are &asse' t! t*e $u)ti!) m!'ule a)' a) be *a)5e' by it.
("ceptons &r!+i'e i)$!rmati!) ab!ut err!r situati!)s. /$ a $u)ti!) m!'ule i)itiates a) e6e&ti!)-
&r!essi)5 !$ t*e $u)ti!) m!'ule is i)terru&te'. /t is &!ssible t! set a retur) !'e- i$ )eessary- i)
t*e alli)5 &r!5ram.
As is t*e ase %it* subr!uti)es- a $u)ti!) m!'ule a) !)tai) l!al ty&e a)' 'ata !bGet 'e$i)iti!)s.
>C? SAP AG BC400 4
14.5
SAP AG 2001
Function roup
Func!"on 'oule
F'4
0n!er-ace 0n!er-ace
Sub=
routine
4nter$ace 4nter$ace
Screen
lobal
data ob6ects
A functon group re&rese)ts t*e mai) &r!5ram $!r $u)ti!) m!'ules. Se+eral $u)ti!) m!'ules t*at
!&erate !) t*e same 'ata !)te)t are !mbi)e' t! $!rm a $u)ti!) 5r!u&.
0*e $u)ti!) 5r!u& remai)s ati+e $!r as l!)5 as t*e alli)5 &r!5ram is ati+e. 9!r e6am&le- i$ a)
e6eutable &r!5ram alls a $u)ti!) m!'ule- its e)tire $u)ti!) 5r!u& is l!a'e' as %ell. /t remai)s
ati+e u)til t*e e6eutable &r!5ram is !m&lete'.
A $u)ti!) 5r!u& a) !)tai) t*e same !m&!)e)ts as a) e6eutable &r!5ram. 0*ese i)lu'eE
3ata +b,ects
0*ese are t*e) 5l!bal i) relati!) t! t*e $u)ti!) 5r!u&- t*at is- t*ey are +isible t! a)' *a)5eable
by all $u)ti!) m!'ules %it*i) t*e 5r!u&. 0*e +ali'ity &eri!' is t*e same as $!r t*e $u)ti!) 5r!u&.
0ubroutnes
0*ese a) be alle' $r!m all $u)ti!) m!'ules i) t*e 5r!u&.
0creens
0*ese a) be alle' $r!m all $u)ti!) m!'ules i) t*e 5r!u&.
>C? SAP AG BC400 5
14.6
SAP AG 2001
8ata Flo& Within a Function roup
Func!"on 'oule
F'4
0n!er-ace 0n!er-ace
0*e 5l!bal 'ata !$ a $u)ti!) m!'ule is retai)e' u)til t*e &r!5ram t*at !)tai)e' t*e $irst all !$ a
$u)ti!) m!'ule i) t*e $u)ti!) 5r!u& is $i)is*e'.
0*us- i$ a $u)ti!) m!'ule t*at %rites +alues t! t*e 5l!bal 'ata is alle'- !t*er $u)ti!) m!'ules i)
t*e same $u)ti!) 5r!u& a) aess t*is 'ata %*e) t*e &r!5ram alls t*em.
See) $r!m t*e !utsi'e- t*e 5l!bal 'ata is e)a&sulate'- t*at is- it is )!t &!ssible t! aess it 'iretly.
0*ere$!re- y!u must *a+e $u)ti!) m!'ules t*at all!% !r'erly aess $r!m t*e !utsi'e.
0*e same a&&lies t! all t*e !t*er !m&!)e)ts !$ t*e $u)ti!) 5r!u& >sree)s- subr!uti)es?.
>C? SAP AG BC400 6
14.7
SAP AG 2001
9'a%ple: Trans%itting a Standard 8ialog
Syste% Syste% :elp :elp
SAP R:3
I
Ces
L#on!e2!9S$ec"-"c ,"!leM
NConte't=speci$ic additional te'tO
8ata &ill be lost
Cancel
?o
/) se+eral ABAP &r!5rams- a sta)'ar' 'ial!5 is tra)smitte' as s!!) as t*e user selets "ancel)
0*e &r!esse' sree) al%ays !)tai)s t*e se)te)eE D Data %ill be l!st.D 0*e title a)' t*e t%! li)es
$!ll!%i)5 it are !)te6t:s&ei$i. 0*e user a) *!!se !)e !$ t%! !&ti!)sE 9es !r (o)
>C? SAP AG BC400 A
14.8
SAP AG 2001
4ntegration o$ the Standard 8ialog
ABAP
progra%
Function
group
I
NAdditional te'tO
G
N !!! O
Addit! te't
Title
Ces ?o
-eply
Call
-eaction
L,"!leM
0*is 'ial!5 b!6 is e)a&sulate' i) a $u)ti!) m!'ule.
/$ y!u all t*is $u)ti!) m!'ule- t*e system a) &ass t*e a''iti!)al a)' title te6ts t! t*e $u)ti!)
m!'ule usi)5 t*e im&!rt &arameters.
0*e $u)ti!) m!'ule tra)smits a sree) !$ t*e $u)ti!) 5r!u& t*at 'is&lays t*e te6t li)es a)' t*e title-
a)' !)tai)s t*e 9es a)' (o butt!)s.
A) e6&!rt &arameter t*e) !)tai)s t*e i)$!rmati!) re5ar'i)5 %*i* butt!) t*e user *as *!se).
@!u a) i)te5rate t*is 'ial!5 i) y!ur &r!5ram as $!ll!%sE
Call t*e $u)ti!) m!'ule as s!!) as t*e user *as *!se) "ancel)
A$ter t*e all- e+aluate t*e a)s%er a)' reat a!r'i)5ly.
>C? SAP AG BC400 8
14.9
SAP AG 2001
Searching $or Function (odules
Searching &ithin a particular application co%ponent:
App%ication #ierarc#y
Searching &ith the help o$ a progra% that uses the $unction
%odule being searched $or:
Search in the ABAP 9ditor $or the CA22 F<#CT47# state%ent
Change to debugging %ode during progra% e'ecution and
set breakpoint in the CA22 F<#CT47# state%ent
4$ the $unction %odule trans%its a screen0 display the
progra% na%e and the screen nu%ber using F+ and technical
in$or%ation or na"igate directly ,double=click.
Duri)5 y!ur sear* $!r $u)ti!) m!'ules >a)' all !t*er Re&!sit!ry !bGets?- y!u %ill be su&&!rte' by
t*e ABAP .!r(be)* i) ma)y %ays.
/) t*e Re&!sit!ry /)$!rmati!) System- y!u a) use &arts !$ t*e te*)ial )ame- $!r e6am&le-
CON9/RM- !r &arts !$ t*e s*!rt te6t- $!r e6am&le- Confrmaton prompt9 'uri)5 y!ur sear*.
/$ y!u ()!% t*e a&&liati!) !m&!)e)t- y!u s*!ul' al%ays use t*e Application hierarchy) @!u use
t*is t! all t*e 'e+el!&me)t lasses i) Buesti!).
/$ y!u ()!% a &r!5ram t*at alrea'y uses t*e $u)ti!) m!'ule- y!u a) sear* i) t*is &r!5ram $!r t*e
all usi)5 t*e CALL F+NCTION stateme)t.
/) t*e ase !$ a m!'al 'ial!5 b!6- y!u '! )!t *a+e t*e sta)'ar' )a+i5ati!) met*!' >&ystem
&tat$s) at y!ur 'is&!sal t! be able t! $i)' sree) a)' &r!5ram )ames. /) su* ases- &!i)t t! a te6t
$iel' a)' selet ,4, Technical information)
/) all ases- be$!re y!u i)te5rate t*e $u)ti!) m!'ule i) y!ur &r!5ram- y!u must ma(e sure t*at it is
release!)
>C? SAP AG BC400 8
14.10
SAP AG 2001
9'ceptions Changing 9'port
Analysis o$ a Function (odule 4nter$ace
Function (odule P7P<PCT7CC7#F4-(C27SSC7FC8ATA
Attributes 4%port
Para%eters
,4E,/0?41
,4E,/0?42
,0,/4
S,AR,A#8/3'?
S,AR,AR8W
?alue 7ptional !!! -e$! type 8escription
Source
code

!!!
Re.u"re -unc!"on
*oule $ara*e!ers
%ust be $asse
ur"n( !he call
O)e y!u *a+e $!u)' a $u)ti!) m!'ule- y!u must $i)' !ut m!re ab!ut its i)ter$ae.
;)'er t*e Attrib$tes seti!) , y!u %ill $i)' !ut %*et*er t*e $u)ti!) m!'ule is release'.
0*e reBuire' &arameters i) t*e $u)ti!) m!'ule must be Osu&&lie' %it* 'ataP 'uri)5 t*e all. 0! $i)'
!ut %*i* a''iti!)al &arameters are t! be &asse' a)' %*e)- re$er t! t*e '!ume)tati!) !$ t*e
$u)ti!) m!'ule a)' t! t*e '!ume)tati!) !) i)ter$ae &arameters.
@!u a) als! )a+i5ate 'iretly t! t*e s!ure !'e !$ t*e $u)ti!) m!'ule.
>C? SAP AG BC400 #0
14.11
SAP AG 2001
8ocu%entation
H Short te't
H Function
H 9'a%ple
H #otes
H Additional in$or%ation
H Para%eters
H 9'ceptions
H Function group
Test 9n"iron%ent
4%port para%eters
9'port para%eters
9'ceptions
Function %odule
8ocu%entation and Testing
@!u a) test $u)ti!) m!'ules usi)5 t*e test e)+ir!)me)t. A) i)&ut tem&late all!%s y!u t! s&ei$y
t*e IMPORT a)' CHANGING &arameters. @!u a) als! s%it* t! 'ebu55i)5 m!'e. 0*e +alues i) t*e
EXPORT a)' CHANGING &arameters are liste' a$ter e6euti!).
/$ a) e6e&ti!) situati!) !urs- t*e system re!r's t*e e6e&ti!)- a)' als! 'is&lays a messa5e te6t-
i$ a+ailable.
0*e time reBuire' $!r e6euti)5 t*e $u)ti!) m!'ule is 'is&laye'. 0*ese +alues are subGet t! t*e
same limitati!)s as t*e .$ntime analysis $u)ti!). @!u s*!ul' t*ere$!re re&eat t*e test se+eral times
usi)5 t*e same 'ata.
@!u a) st!re test 'ata i) a test 'ata 'iret!ry.
@!u a) reate test seBue)es.
>C? SAP AG BC400 ##
14.12
SAP AG 2001
Calling a Function (odule
ABAP progra%
PA4
MODULE )se%/$omman4/"<"" INPUT0
CASE oM/$o4e0
3HEN 9CANCEL90
CALL FUNCTION
9POPUP/TO/CONFIRM/LOSS/OF/DATA9
EXPORTING
te?tl#ne 7 te?t1""<
t#tle 7 te?t1""D
IMPORTING
ans.e% 7 pop/ans.e%0
CASE pop/ans.e%0
.&en 9R90
000
.&en 9N90
000
ENDCASE0
000
ENDCASE0
te'tline
title
CALL FUNCTION CALL FUNCTION
EXPORTING EXPORTING
IMPORTING IMPORTING
ans&er
@!u all $u)ti!) m!'ules usi)5 t*e ABAP stateme)t CALL F+NCTION. 0*e )ame !$ t*e $u)ti!)
m!'ule $!ll!%s i) a&ital letters e)l!se' i) si)5le Bu!tati!) mar(s.
A$ter (8P+%T2-5 *as ta(e) &lae- t*e system &asses +alues t! t*e Impo# &arameters !$ t*e
$u)ti!) m!'ule.
A$ter 2)P+%T2-5 *as ta(e) &lae- t*e $u)ti!) m!'ule retur)s t*e result t*r!u5* its E1po#
&arameter.
3!!(i)5 at t*is $r!m t*e alli)5 &r!5ramIs si'e- %e see t*at t*e &arameters &asse' t! t*e $u)ti!)
m!'ule are e6&!rte'- a)' t*!se &asse' $r!m t*e $u)ti!) m!'ule t! t*e &r!5ram are im&!rte'.
O) t*e Parameter assi'nment sree)- t*e system 'is&lays t*e )ames !$ t*e i)ter$ae &arameters !$
t*e $u)ti!) m!'ule >$!rmal &arameters? t! t*e le$t !$ t*e eBual si5). 0*e system 'is&lays t*e alli)5
&r!5ramIs 'ata !bGets >atual &arameters? t! t*e ri5*t !$ t*e eBual si5).
>C? SAP AG BC400 #"
14.13
SAP AG 2001
4%ple%entation o$ a Function (odule Call
Syste% Syste% :elp :elp
SP7+
ABAP E/itor( C#an*in* t#e Report 00012B
Function %odules
P7P<PCT7CC7#F4-(C
CALL FUNCTION
9POPUP/TO/CONFIRM/LOSS/OF/DATA9
EXPORTING
te?tl#ne 7 000
t#tle 7 000
IMPORTING
ans.e% 7 000
Fill in actual
para%eters
B
or:
Sdrag=and=dropS


CALL F*"CTI)"
4nsert pattern
0)0*0#T)#C)"FI%!#L)SS#)F#DATA
Pattern
0! &r!5ram t*e $u)ti!) m!'ule all- al%ays use t*e Pattern $u)ti!).
Alter)ati+ely- y!u a) 'is&lay t*e $u)ti!) 5r!u& i) t*e )a+i5ati!) area a)' t*e) &ull t*e $u)ti!)
m!'ule all i)t! t*e ABAP 1'it!r area usi)5 'ra5:a)':'r!&.
0*e ABAP stateme)t CALL FUNCTION 9F+NCTION_MOD+LE_NAMEB is t*us i)serte'- t!5et*er
%it* t*e e)tire list !$ i)ter$ae &arameters a)' e6e&ti!)s- at t*e urre)t urs!r &!siti!) i) t*e s!ure
!'e !$ t*e &r!5ram. O&ti!)al &arameters a)' e6e&ti!)s are i)serte' as !mme)ts. /) t*is %ay- y!u
a+!i' ty&i)5 err!rs a)' !missi!)s.
A$ter &r!5rammi)5 t*e $u)ti!) m!'ule all- y!u must $ill i) t*e urre)t atual &arameters a)'- i$
)eessary- &r!5ram t*e e6e&ti!) *a)'li)5.
>C? SAP AG BC400 #3
14.14
SAP AG 2001
:andling o$ 9'ceptions
CALL FUNCTION 9C!""/UPDATE/FLTIME9
EXPORTING
#v/$a%%#4 7 .a/sp+l#1$a%%#4
#v/$onn#4 7 .a/sp+l#1$onn#4
#v/+lt#me 7 .a/sp+l#1+lt#me
#v/4ept#me 7 .a/sp+l#14ept#me
EXCEPTIONS
+l#(&t/not/+o)n4 7 <
000 7 000
OTHERS 7 !0
CASE s'1s),%$0
3HEN "0
MESSAGE s<!VA,$!""C0
3HEN <0
MESSAGE #""EA,$!""C0
3HEN 000
000
3HEN !0
MESSAGE #<!XA,$!""C0
ENDCASE0
i"Ccarrid
i"Cconnid
i"C$lti%e
i"Cdepti%e
EXCEPTIONS EXCEPTIONS
8atabase
table
s' s'1 1s),%$ s),%$
.it* m!st $u)ti!) m!'ules- e6e&ti!)s are tri55ere' i) err!r situati!)s. /) su* ases- t*e
e6e&ti!)s are assi5)e' t! t*e )umber +alues a$ter 12C1P0/ONS.
/$ t*e $u)ti!) m!'ule tri55ere' su* a) e6e&ti!)- t*e res&eti+e +alue is &lae' i)t! t*e system
$iel' ,$/,-)..
/$ y!u '! )!t %a)t t! list t*e tri55ere' e6e&ti!) u)'er 12C1P0/ONS !r y!u a))!t '! s!- t*e
e6e&ti!) is assi5)e' t! t*e O0<1RS ase- &r!+i'e' t*is a''iti!) is liste'.
By e+aluati)5 t*is $iel'- y!u a) t*e) reat a!r'i)5ly. /) t*e e6am&le s*!%) i) t*e 5ra&*i-
suitable messa5es are tra)smitte'.
/$ )! e6e&ti!) %as tri55ere' !r )eit*er t*e e6e&ti!) )!r O0<1RS %as liste' u)'er 12C1P0/ONS9
t*e system sets t*e ,$/,-). $iel' t! 0.
>C? SAP AG BC400 #4
14.15
SAP AG 2001
Working &ith (ethods
Working &ith Function (odules
Working &ith Function (odules
Working &ith (ethods
Working &ith (ethods
Working &ith BAP4s
Working &ith BAP4s
>C? SAP AG BC400 #5
14.16
SAP AG 2001
Classes and 7b6ects
H attr+
H attr2
H !!!
H %eth+
H %eth2
H !!!
#a%e
Attributes ,data ob6ects.:
(ethods ,$unctions.:
Class:
technical
description
o$ ob6ects
attr+
attr2
%eth+
41++
!!!
%eth2
attr+
attr2
%eth+
+23
!!!
%eth2
attr+
attr2
%eth+
H
!!!
%eth2
7b6ects:
-unti%e instances
in a class
At $irst 5la)e- a lass is +ery mu* li(e a $u)ti!) 5r!u& si)e it !)tai)s 'ata !bGets >attributes?
a)' $u)ti!)s >met*!'s?. 0*ese !m&!)e)ts a) be &r!tete' $r!m aess by !m&!)e)ts !$ !t*er
&r!5rams. 0*e) t*ey a) be aesse' !)ly by met*!'s bel!)5i)5 t! t*e lass.
/) !)trast t! $u)ti!) 5r!u&s- lasses a) *a+e multi&le i)sta)es- t*at is- m!re t*a) !)e ru)time
!bGet a) be reate' $!r ea* &r!5ram i) a lass. /) !t*er %!r's- a lass !)tai)s t*e te*)ial
'esri&ti!) !$ !bGets >i)sta)es?. All t*ese !bGets- t*ere$!re- *a+e t*e same attributes a)' &r!+i'e
t*e same met*!'s. <!%e+er- t*ey a) be 'isti)5uis*e' &*ysially. 0*eir attributes a) *a+e 'i$$ere)t
$eatures.
Classes a) be 'e$i)e' eit*er l!ally %it*i) a) e6eutable &r!5ram !r 5l!bally i) t*e Class Buil'er.
0*e ABAP ru)time system &r!+i'es su&&!rt $!r sta)'ar' !bGet:!rie)te' sy)ta6 eleme)ts as !$
Release 4.6A. 9!r m!re 'etails- re$er t! t*e SAP !)li)e library.
>C? SAP AG BC400 #6
14.17
SAP AG 2001
ABAP progra%
Creating 7b6ects and Calling (ethods
DATA %e+< TYPE REF TO $lass0
DATA %e+D TYPE REF TO $lass0
CREATE ORECT %e+< 000
CREATE ORECT %e+D 000
CALL METHOD %e+<1Lmet&<
EXPORTING 000
IMPORTING 000
EXCEPTIONS 000
CALL METHOD %e+D1Lmet&<
EXPORTING 000
IMPORTING 000
EXCEPTIONS 000
000
re$+ re$2
%eth+
%eth+
0! reate i)sta)es !$ lasses a)' t! be able t! aess t*em- y!u )ee' re$ere)e +ariables- %*i* are
&!i)ters t! t*ese i)sta)es. @!u 'e$i)e t*ese re$ere)e +ariables usi)5 DATA e!een.e_name
TYPE REF TO .&a,,_name.
At &r!5ram start- t*e 'ata !bGets are reate' i) mem!ry. <!%e+er- si)e )! i)sta)es *a+e bee)
reate' yet- t*e re$ere)e +ariables are still em&ty.
At ru)time- y!u a) reate as ma)y i)sta)es !$ lasses as y!u %is* usi)5
C%(AT( +BJ(CT e!een.e_name%
/$ )eessary- t*e im&!rt &arameters !$ t*e s&eial met*!' CONS0R;C0OR must be $ille' %it*
+alues. 0*is s&eial met*!' is e6eute' imme'iately a$ter t*e i)sta)e is reate'. As a rule- basi
setti)5s $!r t*e atual i)sta)e are t*us reate'.
@!u a) all met*!'s !$ a) i)sta)e usi)5
CA44 )(T6+3 e!een.e_name1Lme#(od_name.
/) !)trast t! a $u)ti!) m!'ule all- t*e met*!' )ame is )!t su$$iie)t *ere beause- 5e)erally-
se+eral i)sta)es !$ a lass e6ist $!r ea* &r!5ram. ;si)5 t*e re$ere)e +ariable- $!ll!%e' by t*e
!bGet !m&!)e)t selet!r -F- y!u i)strut a partcular i)sta)e t! e6eute its met*!'.
>C? SAP AG BC400 #A
14.18
SAP AG 2001
9'a%ples o$ Standard Classes: 9n6oySAP Controls
AA
00+1
00*4
2:
0400
0402
Airlines
http:>>&&&!sap!co%
Picture Control
Tree Control :T(2 ?ie&er Control
As !$ Release 4.6A- t*e ABAP .!r(be)* !$$ers se+eral )e% 1)G!ySAP !)tr!ls i) !r'er t! m!+e
'ial!5 $u)ti!)s $r!m t*e a&&liati!) ser+er t! t*e &rese)tati!) ser+er. 0*ese !)tr!ls are alle' !)
a) !bGet:!rie)te' basis usi)5 lasses- t*at is- t*e 0AP Control *rame#ork.
9!r ea* met*!' all- y!u selet t*e !)tr!ls $r!m y!ur ABAP &r!5ram. 0*e C!)tr!l 9rame%!r(
se)'s y!ur reBuests t! t*e &rese)tati!) ser+er %*ere t*ey are !)+erte' !) a &lat$!rm:s&ei$i basis.
@!u a) 5i+e t*e user t*e !&ti!) !$ tri55eri)5 e+e)ts !) t*e &rese)tati!) ser+er. 0*e C!)tr!l
9rame%!r( t*e) !)+erts t*ese e+e)ts a)' y!u a) reat t! t*em i) y!ur ABAP &r!5ram.
9!r m!re 'etails !) t*e 1)G!ySAP !)tr!ls a)' t*e C!)tr!l 9rame%!r(- re$er t! t*e SAP !)li)e
library.
>C? SAP AG BC400 #8
14.19
SAP AG 2001
9'a%ple o$ <sage: A2? rid Control
+1
*4
AA
AA
AA
AA
2:
2:
2:
2:
2:
+1
+1
400
402
400
400
402
2000=0+=+1
2000=02=20
2000=03=++
2000=0)=+/
2000=0+=+3
2000=02=2*
2000=03=2+
2000=03=04
2000=0)=2H
<S8
<S8
<S8
<S8
89(
89(
89(
89(
89(
)+3!*/
+234!)*
+234!)*
)+3!*/
)+3!*/
3*/!00
+234!)*
+234!)*
+234!)*
A32+
141=400
A3+0=300
A3+/
A3+/
A3+0=300
A3+0=300
A32+
141=400
8etails
Sort
Find
Filter
Su%
Print
8o&nload
8isplay "ariant
Toolbar
0*e A37 5ri' !)tr!l is use' $!r 'is&layi)5 )!):*ierar*ial 'ata i) table $!rm. Se+eral user
$u)ti!)s are alrea'y im&leme)te'.
/) t*e !)tr!l- y!u a) a'Gust t*e !lum) %i't* by 'ra55i)5- !r use t*e Optim$m wi!th $u)ti!) t!
a'Gust t*e !lum) %i't* t! t*e 'ata urre)tly 'is&laye'. @!u a) als! *a)5e t*e !lum) seBue)e by
seleti)5 a !lum) a)' 'ra55i)5 it t! a )e% &!siti!).
Sta)'ar' $u)ti!)s are a+ailable i) t*e !)tr!l t!!lbar. 0*e Details &us*butt!) 'is&lays t*e $iel's i)
t*e li)e !) %*i* t*e urs!r is &!siti!)e' i) a m!'al 'ial!5 b!6.
,he Sort -unc!"on "n !he A/D con!rol "s a)a"lable -or as *an& colu*ns as re.u"re. @!u a)
set !m&le6 s!rt riteria a)' s!rt !lum)s i) eit*er ase)'i)5 !r 'ese)'i)5 !r'er.
@!u a) use t*e &earch $u)ti!) t! sear* $!r a stri)5 >5e)eri sear* %it*!ut J? i) li)es !r !lum)s
%it*i) a selete' area.
@!u a) use t*e &$m $u)ti!) t! reBuest t!tals $!r !)e !r m!re )umeri !lum)s. @!u a) use t*e
&$btotal $u)ti!) t! struture !)tr!l le+el listsE selet t*e !lum)s >)!):)umeri $iel's !)ly? t*at
y!u %a)t t! use a)' t*e !rres&!)'i)5 !)tr!l le+el t!tals are 'is&laye'.
9!r Print a)' Downloa! t*e %*!le list is al%ays &r!esse'- )!t Gust t*e seti!)s 'is&laye' !) t*e
sree).
@!u a) als! 'is&lay +aria)ts.
>C? SAP AG BC400 #8
14.20
SAP AG 2001
Progra%s <sing A2? rid Control
Area
Custo%
Container
Control
A2? rid Control
Screen +00
Process
Be$ore
7utput
Process
A$ter
4nput
START1OF1
SELECTION0


A) 1)G!y SAP !)tr!l must al%ays be embe''e' i) a) SAP !)tai)er !)tr!l. 0*is ma)a5es t*e
embe''e' !)tr!ls a)' &r!+i'es a &*ysial area $!r +isualiCati!).
A !)tai)er be!mes t*e parent !$ t*e embe''e' !)tr!l.
Beause !)tai)ers are t*emsel+es !)tr!ls- t*ey a) be )este' %it*i) !)e a)!t*er. /) t*is %ay- y!u
a) %!r( $le6ibly a)' m!'ularly %it* !)tr!ls.
0! be able t! use a) A37 5ri' !)tr!l i) y!ur &r!5ram- y!u reBuire at least !)e !)tai)er a)' !)e
A37 5ri' i)sta)e.
>C? SAP AG BC400 "0
14.21
SAP AG 2001
7b6ects and Classes $or A2? rid Control
Area
Custo%
Container
Control
A2? rid Control


Custo%
Container
A2? rid
Class Builder
C2C<4CA2?C-48
C2C<4CC<ST7(CC7#TA4#9-
@!u a) use t*e $!ll!%i)5 5l!bal lasses >!bGet ty&es? i) t*e "lass B$il!er t! all t*e ust!m
!)tai)er !)tr!ls a)' t*e A37 Gri' C!)tr!l/
C4>512>C10T+)>C+-TA2-(%
C4>512>A4@>5%23
>C? SAP AG BC400 "#
14.22
SAP AG 2001
9"ents
Custo% Control Container: Constructor (ethod
Superclasses
(ethods
C7#ST-<CT7-
C2C<4CC<ST7(CC7#TA4#9-
Class C2C<4CC<ST7(CC7#TA4#9-
Attributes 4nter$aces Attributes (ethods
Para%eters $or %ethod C7#ST-<CT7-
Para%eters
PAR4?,
#8?,A0?4RA?A'4
!!!
?alue 7ptional !!! -e$! type !!! 8escription

4nt! Types

-e5uired
para%eters o$ the
Constructor %ethod
%ust be
passed at
C-9AT9 7BI9CT
9!r m!re 'etaile' i)$!rmati!) !) t*e 5l!bal lass C3UG;/UC;S0OMUCON0A/N1R- y!u a)
)a+i5ate i) t*e Class Buil'er. Dis&lay t*e !bGet list $!r t*e lass i) t*e )a+i5ati!) area !$ t*e ObGet
Na+i5at!r) 0*e) 'is&lay t*e e)tire lass !r i)'i+i'ual !m&!)e)ts i) t*e ABAP 1'it!r. Alter)ati+ely-
y!u a) als! 5! t! t*e Class Buil'er by '!uble:li(i)5 t*e lass )ames $r!m %it*i) a) ABAP
&r!5ram. De&e)'i)5 !) t*e 'is&lay m!'e- y!u a) t*e) 'is&lay t*e i)ter$ae &arameters t*r!u5*
Parameters !r &i'nat$re)
0*e 5l!bal lass C3UG;/UC;S0OMUCON0A/N1R !)tai)s t*e CONS0R;C0OR met*!'. .*e)
y!u reate a) i)sta)e i) a &r!5ram usi)5 CR1A01 OB=1C0- y!u must &ass at least t*e reBuire'
&arameter CON0A/N1RUNAM1. 0*e )ame !$ a ust!m !)tai)er area !) a sree) must be &asse'
t! t*is &arameter.
>C? SAP AG BC400 ""
14.23
SAP AG 2001
A2? rid Control: 4%portant (ethods
Superclasses
4nter$aces
Attributes
(ethods
!!!
C7#ST-<CT7-
!!!
-9F-9S:CTAB29C84SP2AA
!!!
S9TCTAB29CF7-CF4-STC84SP2AA
!!!
-ede$initions
9"ents
C2C<4CA2?C-48
-e5uired para%eter:
#/pa%ent
,-e$erence to C2C<4CC7#TA4#9-.
7ptional para%eter:
#/st%)$t)%e/name
,global line type o$
internal table.
-e5uired para%eter:
#t/o)tta,
,internal standard table
&ith data $or display.
0*e 5l!bal lass C3UG;/UA37UGR/D !)tai)s se+eral met*!'s. 0! 'is&lay t*e !)te)ts !$ a)
i)ter)al table %it* a) A37 5ri' !)tr!l- all y!u )ee' t! '! is t! use t*e $!ll!%i)5 t*ree met*!'sE
C+-0T%1CT+%E
0*e &!i)ter t! t*e !)tai)er !)tr!l i)sta)e must be &asse' t! t*e !)strut!r.
0(T>TAB4(>*+%>*2%0T>320P4A7E
0*e i)ter)al table %it* t*e 'ata t! be 'is&laye' must be &asse' t! t*e &arameter "#_o-##a). 0*is
must be a sta)'ar' i)ter)al table s! t*e user a) use t*e s!rt $u)ti!)s. 9urt*erm!re- te*)ial
i)$!rmati!) is reBuire' $!r e'iti)5 t*e 5ri' !lum)s. 0*e easiest a&&r!a* is t! use a $lat struture !r
a tra)s&are)t table 'e$i)iti!)- t*at is- a 5l!bal ty&e- as t*e li)e ty&e $!r t*e i)ter)al table. /) t*is ase-
y!u still )ee' t! &ass !)ly t*e )ame !$ t*is li)e ty&e t! t*e "_,#-.#-e_name &arameter.
Alter)ati+ely- y!u a) als! set u& a $iel' atal!5 a)' &ass it t! "#_!"e&d.a#a&o'.
%(*%(06>TAB4(>320P4A7E
@!u )ee' t! all t*is met*!' !)ly i$ y!u *a+e *a)5e' t*e !)te)ts !$ t*e i)ter)al table a$ter t*e $irst
'is&lay.
>C? SAP AG BC400 "3
14.24
SAP AG 2001
Creating a Screen 9le%ent SCusto% Control AreaS
Custo%
Control
Area
Type: Custo% Control
#a%e: C7#TA4#9-C+
-esi;ing
?ertical: 9 (ini%u% lines: )
:ori;ontal: 9 (ini%u% colu%ns: 20
C
Custo% Control
Screen Painter
0! reser+e a) area !$ t*e sree) $!r a) 1)G!ySAP !)tr!l- reate a ust!m !)tai)er area usi)5 t*e
Sree) Pai)ter >use t*e +ayo$t butt!)?.
/) t*e t!!lbar t! t*e le$t !$ t*e e'iti)5 area- y!u %ill see a) i!) %it* t*e )ame "$stom control.
C*!!se t*e "$stom control butt!). 0*e) 'e$i)e t*e siCe a)' t*e &!siti!) !$ t*e area i) t*e sree).
0! '! t*is- 'e$i)e t*e t!& le$t !r)er !$ t*e area by *!l'i)5 '!%) t*e m!use butt!). Dra5 t*e
urs!r '!%) 'ia5!)ally t! t*e ri5*t t! %*ere y!u %a)t t*e l!%er ri5*t !r)er. O)e y!u release t*e
m!use butt!)- t*e l!%er ri5*t !r)er is $i6e' i) &!siti!).
@!u a) *a)5e t*e siCe a)' &!siti!) !$ t*e area at a)y time by 'ra55i)5 a)' 'r!&&i)5 t*e 'ra5
symb!ls.
1)ter a )ame $!r t*e sree) eleme)t >*ereE CON0A/N1RU#?.
;se t*e .esi:in' vertical a)' .esi:in' hori:ontal attributes t! s&ei$y %*et*er !r )!t t*e area !$ t*e
ust!m !)tr!l s*!ul' be resiCe' %*e) t*e mai) sree) is resiCe'. @!u a) als! set mi)imum +alues
$!r t*ese attributes usi)5 7in) row a)' 7in) col$mns. 0*e u&&er limit is 'e$i)e' by t*e siCe !$ t*e
area.
>C? SAP AG BC400 "4
14.25
SAP AG 2001
8e$ining -e$erence ?ariables
DATA (4t/sp+l# TYPE s,$!""/t/sp+l#0
DATA: $onta#ne%/% TYPE REF TO $l/()#/$)stom/$onta#ne% 6
(%#4/% TYPE REF TO $l/()#/alv/(%#4 0

DATA oM/$o4e TYPE s'1)$omm0
START1OF1SELECTION0
2 +#ll #nte%nal ta,le 000
CALL SCREEN <""0
$onta#ne% $onta#ne%/% TYPE REF TO /% TYPE REF TO $l $l/ /()# ()#/ /$)stom $)stom/ /$onta#ne% $onta#ne%
containerCr
gdtCsp$li
okCcode
(%#4 (%#4/% TYPE REF TO /% TYPE REF TO $l $l/ /()# ()#/ /alv alv/ /(%#4 (%#4
gridCr
0%! re$ere)e +ariables are reBuire' i) t*e ABAP &r!5ram.
0*e re$ere)e +ariable t*at is t! &!i)t t! t*e !)tai)er !)tr!l i)sta)e is alle' $onta#ne%/% i)
t*e e6am&le i) t*e 5ra&*i- a)' *as t*e 5l!bal lass ty&e .&_'-"_.-,#om_.on#a"ne.
0*e re$ere)e +ariable t*at is t! &!i)t t! t*e 5ri' !)tr!l i)sta)e is alle' '"d_ i) t*e e6am&le i)
t*e 5ra&*i a)' *as t*e 5l!bal lass ty&e .&_'-"_a&4_'"d.
>C? SAP AG BC400 "5
14.26
SAP AG 2001
MODULE $%eate/$ont%ol OUTPUT0
IF $onta#ne%/% IS INITIAL0
CREATE ORECT $onta#ne%/%
EXPORTING $onta#ne%/name 7 9CONTAINER/<90

CREATE ORECT (%#4/%
EXPORTING #/pa%ent 7 $onta#ne%/%0
000
ENDIF0
ENDMODULE0
Creating 4nstances
CREATE ORECT CREATE ORECT $onta#ne% $onta#ne%/% /%
EXPORTING EXPORTING $onta#ne% $onta#ne%/ /name name 7 9CONTAINER/<9 7 9CONTAINER/<9
CREATE ORECT CREATE ORECT (%#4 (%#4/% /%
EXPORTING #/ EXPORTING #/pa%ent pa%ent 7 7 $onta#ne% $onta#ne%/% /%
containerCr
gridCr
@!u reate !)tr!l i)sta)es usi)5 t*e CREATE OBEECT stateme)t.
Ma(e sure y!u let t*e system 5e)erate t*e stateme)t by usi)5 t*e Pattern. /) t*is %ay- y!u a+!i'
ty&i)5 err!rs a)' mista(es. As is t*e ase %it* $u)ti!) m!'ule alls- t*e !m&lete i)ter$ae is
im&leme)te' i) y!ur &r!5ram. CREATE OBEECT is a) i)ter$ae !$ t*e !)strut!r met*!'.
O&ti!)al &arameters are e)tere' as !mme)ts.
0*e !)tr!l &r!essi)5 must be !m&lete before t*e res&eti+e sree) is 'is&laye'. Als!- it s*!ul' be
li)(e' m!'ularly t! t*e &r!essi)5 !$ t*e res&eti+e sree). 9!r t*is reas!)- %e re!mme)' t*at y!u
im&leme)t a PBO m!'ule *ere.
Creati)5 a) i)sta)e $!r t*e !)tr!ls s*!ul' ta(e &lae !)ly !)e- be$!re t*e frst sree) 'is&lay.
4ueryi)5 t*e !)te)t !$ !)e !$ t*e t%! re$ere)e +ariables easily '!es t*is.
Creati)5 i)sta)es $!r t*e !)tai)er !)tr!l is im&leme)te' i) t*e !rres&!)'i)5 PBO m!'ule.
0*ere$!re- it is su$$iie)t i$ y!u e)ter t*e )ame !$ t*e ust!m !)tai)er area. /) !t*er ases- y!u a)
e)ter t*e &r!5ram )ame a)' t*e sree) )umber als!.
.*e) y!u set a) i)sta)e $!r t*e 5ri' !)tr!l- it is su$$iie)t i$ y!u &ass t*e &!i)ter t! t*e !)tai)er
i)sta)e. /) t*is %ay- t*e !)tai)er !)tr!l mai)tai)s t*e te*)ial li)( !$ t*e 5ri' !)tr!l t! t*e
sree).
>C? SAP AG BC400 "6
14.27
SAP AG 2001
Calling (ethods
MODULE $%eate/$ont%ol OUTPUT0
IF $onta#ne%/% IS INITIAL0
000
CALL METHOD
(%#4/%1Lset/ta,le/+o%/+#%st/4#spla'
EXPORTING #/st%)$t)%e/name 7 9SPFLI9
CHANGING #t/o)tta, 7 (4t/sp+l# 0
000
ENDIF0
ENDMODULE0
CALL METHOD CALL METHOD
(%#4 (%#4/%1L /%1Lset set/ /ta,le ta,le/ /+o% +o%/ /+#%st +#%st/ /4#spla' 4#spla'
EXPORTING #/ EXPORTING #/st%)$t)%e st%)$t)%e/ /name name 7 9SPFLI9 7 9SPFLI9
CHANGING CHANGING #t #t/ /o)tta, o)tta, 7 7 (4t (4t/ /sp+l# sp+l#
containerCr
gridCr
0! tra)smit t*e !)te)ts !$ t*e i)ter)al table a)' t*e li)e ty&e t! t*e 5ri' !)tr!l- y!u must all t*e
,e#_#a)&e_!o_!",#_d",p&a$ met*!'.
@!u &ass t*e )ame !$ t*e i)ter)al table t! t*e "#_o-##a) &arameter.
<ere t*e i)ter)al table *as bee) ty&e' %it* t*e tra)s&are)t table SPFLI as li)e ty&e. 0*ere$!re- it is
su$$iie)t t! &ass t*is )ame t! t*e "/,#-.#-e_name &arameter. /) a''iti!)- basi setti)5s !$
t*e 5ri' !)tr!l a) be &asse' as %ell.
/$ t*e !)te)ts !$ t*e i)ter)al table *a)5e 'uri)5 t*e &r!5ram- y!u must all t*e
e!e,(_#a)&e_d",p&a$ met*!' be$!re t*e )e6t sree) is 'is&laye'.
>C? SAP AG BC400 "A
14.28
SAP AG 2001
Working &ith BAP4s
Working &ith Function (odules
Working &ith Function (odules
Working &ith (ethods
Working &ith (ethods
Working &ith BAP4s
Working &ith BAP4s
>C? SAP AG BC400 "8
14.29
SAP AG 2001
Business Application Progra%%ing 4nter$ace
BAP4
A BAP4 is a &ell=de$ined inter$ace to processes and
data o$ a business application syste%0 i%ple%ented
as a business ob6ect %ethod in the
Business 7b6ect -epository ,B7-.!
A BAP/ a) be +ie%e' as t*e '!!r t! t*e SAP systemH t*is i)ter$ae &r!+i'es aess t! busi)ess 'ata
a)' &r!esses i) t*e SAP system $r!m t*e !utsi'e.
1a* !bGet i) t*e BOR a) *a+e se+eral met*!'s- !)e !r m!re !$ %*i* a) be im&leme)te' as
BAP/s.
BAP/s usually e6ist $!r basi $u)ti!)s !$ a busi)ess !bGet- su* asE
Creati)5 !bGets
4ueryi)5 t*e attributes !$ a) !bGet
C*a)5i)5 t*e attributes !$ a) !bGet
>C? SAP AG BC400 "8
14.30
SAP AG 2001
Business
Work$lo&
8istributed scenarios ,A29.
4nternet >
4ntranet
Custo%erLs and partnerKs
o&n code
IA?A0 C0 !!!
->3 Co%ponent
Creation
B
Business
Co%ponent
Business
Co%ponent
Business
Co%ponent
BAP4 <sage
A BAP/ a) be use' $!r +ari!us a&&liati!)s. 9!r e6am&leE
Q /)ter)et a&&liati!) !m&!)e)tsE De&iti!) !$ i)'i+i'ual SAP R/3 $u)ti!)s i) t*e /)ter)et !r
i)tra)et : $!r e6am&le- $!r users %*! '! )!t *a+e SAP R/3 e6&erie)e.
Q R/3 !m&!)e)t reati!)E C!mmu)iati!) bet%ee) t*e busi)ess !bGets !$ 'i$$ere)t SAP R/3
!m&!)e)ts >s!luti!)s?.
Q Cust!mersF !r &art)ersF !'eE 16ter)al lie)ts >$!r e6am&le- alter)ati+e G;/s? 'iretly aess
busi)ess 'ata a)' &r!esses !$ t*e SAP R/3 System. /) &artiular- BAP/ alls >as alls !$ RPC:
e)able' $u)ti!) m!'ules als!? a) be im&leme)te' i) !t*er &r!5rammi)5 la)5ua5es.
>C? SAP AG BC400 30
14.31
SAP AG 2001
Standardi;ed BAP4s
et2ist
Supplies a list o$ ob6ect key $ields that satis$y selected
criteria ,search $unction.
et8etail
Supplies detailed in$or%ation ,attributes. on an ob6ect
,the $ull key %ust be speci$ied.
Create0 Change0 8elete0 Cancel
Creating0 changing0 and deleting ob6ects
Add4te%0 -e%o"e4te%
Creating and re%o"ing subob6ects ,$or e'a%ple0
ite% in an order.
0*ere are sta)'ar' met*!'s $!r BAP/s %it* sta)'ar'iCe' )ames.
S!me !$ t*e m!st im&!rta)t sta)'ar' met*!' )ames are liste' *ere.
>C? SAP AG BC400 3#
14.32
SAP AG 2001
Finding BAP4 Function (odules
:ierarchy Alphabetical 8etail 8ocu%entation Tools Pro6ect
FlightBooking
FlightCusto%er
FlightConnection
-eturn
Flight8ata
et2ist
(ethod ,BAP4.
API/SFLIGHT/GETDETAIL
AirlineCarrier
Connection#u%ber
8ate7$Flight
et8etail
(ethod
Business ob6ect
Short te't
#e& as o$ release
Function %odule
!"C
Fl#(&t 4eta#ls
Fl#(&tooM#n(
GetDeta#l
8ouble=click:
#a"igation in
Function Builder
/) Release 4.6C- BAP/s are im&leme)te' usi)5 $u)ti!) m!'ules.
9r!m t*e SAP 1asy Aess me)u- y!u all t*e BAP/ 16&l!rer by *!!si)5 Tools B$siness
,ramework BAPI Browser.
;si)5 t*e BAP/ 16&l!rer- y!u a) )a+i5ate t! t*e $u)ti!) m!'ule 'is&lay $!r t*e selete' BAP/ i)
t*e 9u)ti!) Buil'er.
Selet t*e BAP/ i) t*e *ierar*y seti!).
/) t*e 'etaile' 'is&lay %i)'!%- *!!se t*e Detail tab.
By '!uble:li(i)5 !) t*e )ame !$ t*e $u)ti!) m!'ule- y!u a) 'is&lay it i) t*e 9u)ti!) Buil'er.
>C? SAP AG BC400 3"
14.33
SAP AG 2001
Characteristics o$ a BAP4 Function (odule
SAP Syste%
0n!er-ace 0n!er-ace
Function group
Source code
Structure o$
BAP4Cna%e
4nter$ace para%eters typed
&ith a 8ictionary structure
that is co%piled $or the BAP4
#o user
dialogs
#o C:A#4#
para%eters
#o
e'ceptions
9rror %essages
through 9VP7-T
para%eter RETURN
,structure or
internal table.
-e%ote
capability
9u)ti!) m!'ules $!r BAP/s must $ul$ill t*e $!ll!%i)5 reBuireme)tsE
Nami)5 !)+e)ti!) API/K,)s#ness/o,-e$t/nameL/Kmet&o4/nameL must be use'
Rem!te a&ability
N! user 'ial!5s- )eit*er sree)s )!r messa5es- all!%e'
/)ter$ae &arameters must be ty&e' %it* a Diti!)ary struture t*at %as reate' $!r t*is BAP/
Strutures must !m&ly %it* t*e )ami)5 !)+e)ti!) API/Kst%)$t)%e/nameL a)' are
*a)5e' !)ly !) a !m&atible basis
N! CHANGING &arameters all!%e'
N! e6e&ti!)s all!%e'. 1rr!rs are re&!rte' t! t*e user t*r!u5* t*e s&eial e6&!rt &arameter
RET+RN%
>C? SAP AG BC400 33
14.34
SAP AG 2001
Calling a BAP4 Function (odule $ro% an ABAP
Progra%
ABAP progra%
CALL FUNCTION 9API/0009 CALL FUNCTION 9API/0009
EXPORTING EXPORTING
000 000
IMPORTING IMPORTING
000 000
%et)%n %et)%n 7 000 7 000
For currency and 5uantity $ields:
Possible con"ersion to
Se'ternal $or%atS
B7-
For currency and 5uantity $ields:
Possible con"ersion to
Se'ternal $or%atS
BAC?
/$ y!u %!ul' li(e t! use a BAP/ i) t*e SAP R/3 System- y!u a) all t*e $u)ti!) m!'ule !)tai)i)5
it.
Pay atte)ti!) t! t*e limitati!)s alrea'y me)ti!)e'.
BAP/ i)ter$aes are reate' a!r'i)5 t! t*e )ee's $!r t*e De6ter)alD all- t*at is- $r!m a )!):R/3
System. 4ua)tities are e6&ete' i) a) e6ter)al $!rmat %it* 4 !r 8 'eimal &laes. 0*e Bua)tities must
be tra)s$erre' t! t*e i)ter$ae i) !)+erte' $!rmat- e+e) i$ t*e !rres&!)'i)5 urre)y *as )!
'eimal &laes.
9!r t*is !)+ersi!) y!u a) use $u)ti!) m!'ules $r!m t*e BAC@ $u)ti!) 5r!u& >'e+el!&me)t
lass 0B*>BAP2?.
>C? SAP AG BC400 34
14.35
SAP AG 2001
Ac5uire in$or%ation on $unction %odules
4nclude $unction %odule calls in your progra%
4nclude ob6ect instances and %ethod calls in your
progra%
4nclude the A2? rid Control $or displaying data
in a $i'ed screen area
Ac5uire in$or%ation on BAP4s
4nclude BAP4 calls in your progra%
Aou are no& able to:
Cross=Progra% (odulari;ation: <nit Su%%ary
>C? SAP AG BC400 35
14.36Cross;Pro*ra) 4o/&%ari5ation E$ercises
1nt: Cross-Program )odular/aton
Topc: *uncton )odules
At t*e !)lusi!) !$ t*ese e6erises- y!u %ill be able t!E
Sear* $!r a $u)ti!) m!'ule
/)sert a $u)ti!) m!'ule all i) a &r!5ram
C*a)5e y!ur &r!5ram =C!""/>>/DYNPRO !r t*e res&eti+e tem&late
as $!ll!%sE
.*e)e+er t*e "ancel !&ti!) is *!se) !) a sree)- a sta)'ar' 'ial!5 t*at
is e)a&sulate' i) a $u)ti!) m!'ule is t! be &r!esse'.
Program: =C!""/>>/DYNPRO
)odel soluton: SAPC!""UDS/DYNPRO/E
Template: SAPC!""UDS/DYNPRO/D
#:# C*a)5e y!ur &r!5ram =C!""/>>/DYNPRO !r !&y t*e tem&late
SAPC!""UDS/DYNPRO/D t! t*e )e% &r!5ram =C!""/>>/DYNPRO/D.
#:" ;si)5 !)e !$ t*e met*!'s !utli)e' 'uri)5 t*e !urse- sear* $!r t*e $u)ti!)
m!'ule t*at e)a&sulates t*e sta)'ar' 'ial!5 t*at is usually tri55ere' %*e) t*e user
*!!ses "ancel.
#:3 9i)' !ut ab!ut t*e $u)ti!) m!'ule i)ter$aes- rea' t*e '!ume)tati!)- a)' test t*e
$u)ti!) m!'ule usi)5 t*e test e)+ir!)me)t.
#:4 /) t*e G;/ status !$ t*e sree)- ati+ate t*e "ancel $u)ti!).
#:5 16te)' t*e USER/COMMAND/"<"" m!'ule t! e+aluate t*e $u)ti!) !'e $!r t*e
"ancel $u)ti!). 0*e) i)sert t*e $u)ti!) m!'ule all usi)5 t*e pattern $u)ti!) !$
t*e ABAP 1'it!r. Reat t! t*e userFs i)&ut t*at t*e $u)ti!) m!'ule su&&lies as
$!ll!%sE
- /$ t*e user %!ul' li(e t! a)el- set t*e )e6t sree) 'y)amially t! 0.
- /$ t*e user '!es )!t %a)t t! a)el- set t*e )e6t sree) 'y)amially t! #00.
#:6 C*a)5e t*e $u)ti!) !'e Buery t! SA;E by usi)5 t*e C!""/UPDATE/OO@
$u)ti!) m!'ule t! sa+e t*e 'ata *a)5e' !) t*e sree). Pass t*e *a)5e' 'ata t!
t*e $u)ti!) m!'ule i) t*e !rret ty&e. /$ t*e *a)5e %as '!)e suess$ully-
>C? SAP AG BC400 36
'is&lay messa5e #48 !$ ty&e S a)' messa5e lass C!""- a)' t*e) retur) t! t*e list.
/$ t*e *a)5e is )!t suess$ul- 'is&lay messa5e #48 !$ ty&e 1.
>C? SAP AG BC400 3A
("ercses
1nt: Cross-Program )odular/aton
Topc: ABAP +b,ects and the A4@ 5rd Control
At t*e !)lusi!) !$ t*ese e6erises- y!u %ill be able t!E
Dis&lay a sim&le list usi)5 a) A37 5ri' !)tr!l
.rite a &r!5ram t*at 'is&lays t*e !)te)ts !$ t*e 'atabase table SPFLI
usi)5 a) A37 5ri' !)tr!l.
Program: =C!""/>>/AL;/GRID
)odel soluton: SAPC!""RUS/AL;/GRID
Template: SAPC!""RUT/AL;/GRID
":# C!&y t*e &r!5ram SAPC!""RUT/AL;/GRID- 5i+i)5 it t*e )ame
=C!""/>>/AL;/GRID. /) t*e tem&late- t*ere is a) i)ter)al table t*at mat*es
t*e 'atabase table SPFLI a)' als! a sree) %it* t*e )umber #00.
":" Be!me $amiliar %it* t*e &r!5ram.
":3 9ill t*e i)ter)al table %it* 'ata re!r's $r!m t*e 'ata table SPFLI usi)5 t*e Array
9et*0
":4 Create a !)tai)er !)tr!l area !) t*e sree) >)ame &r!&!salE CONTAINER/<?.
":5 De$i)e t%! re$ere)e +ariables- !)e $!r t*e CL_G+I_C+STOM_CONTAINER lass
a)' !)e $!r t*e CL_G+I_AL*_GRID lass.
":6 At PROCESS BEFORE O+TP+T !$ sree) #00- all a m!'ule t! reate t*e !bGets
usi)5 t*e CREATE OBEECT ABAP stateme)t. Als!- $ill i) t*e reBuire' &arameters
$!r t*e !)strut!r met*!'s !)er)e'. ;se a Buery t! e)sure t*at t*e !bGet is
5e)erate' !)ly %*e) PROCESS BEFORE O+TP+T ru)s $!r t*e $irst time.
":A .*e) PROCESS BEFORE O+TP+T ru)s $!r t*e $irst time- all t*e
SET_TABLE_FOR_FIRST_DISPLAY met*!'- &ass t*e )ame !$ t*e li)e ty&e !$
t*e i)ter)al table t! t*e I_STR+CT+RE_NAME &arameter- a)' &ass t*e i)ter)al
table t! t*e &arameter IT_O+TTAB.
>C? SAP AG BC400 38
14.37Cross;Pro*ra) 4o/&%ari5ation So%&tions
1nt: Cross-Program )odular/aton
Topc: *uncton )odules
#:" 0*e $u)ti!) m!'ule is alle' OPOPUP/TO/CONFIRM/LOSS/OF/DATAY.
#:3 0*ere are t*e $!ll!%i)5 i)ter$ae &arametersE
ReBuire' im&!rt &arametersE
TEXTLINE< >ma6 A0 *ar.? 9irst li)e !$ t*e 'ial!5 %i)'!%
TITEL >ma6 35 *ar.? 0itle li)e !$ t*e 'ial!5 b!6
O&ti!)al im&!rt &arametersE
TEXTLINED >ma6 A0 *ar.? Se!)' li)e !$ t*e 'ial!5 b!6
START/COLUMN >0y&e SY/C+COL? 9irst !lum) !$ t*e 'ial!5 %i)'!%
START/RO3 >0y& SY/C+ROW?E 9irst li)e !$ t*e 'ial!5 b!6
16&!rt &arametersE
ANS3ER >0y&e C?E ;serFs i)&ut
O=P N user *as !)$irme' t*e &r!essi)5 ste& >Ga N yes?
ONP N user *as a)ele' t*e &r!essi)5 ste&
#:4 0*e sta)'ar' $u)ti!) !'e $!r t*e "ancel $u)ti!) is R3.
#:5
2U1111111111111111111111111111111111111111111111111112
2U Mod-&e +SER_COMMAND_0500 INP+T
2U1111111111111111111111111111111111111111111111111112
MOD+LE -,e_.ommand_0500 INP+T%
CASE o9_.ode%
W0EN BBACKB%
SET SCREEN 0%
3HEN 9R390
14.38 CALL FUNCTION 'POPUP_TO_CONFIRM_LOSS_OF_DATA'
14.39 EXPORTING
te?tl#ne< 7 te?t1""<
t#tel 7 te?t1""D
IMPORTING
ans.e% 7 ans.e%0
CASE ans.e%0
.&en 9N90
LEA;E TO SCREEN <""0
.&en 9R90
LEA;E TO SCREEN "0
ENDCASE0
W0EN BSA*EB%
MO*E/CORRESPONDING ,d$n_)oo9 TO ;a_,)oo9%
CALL FUNCTION 9C!""/UPDATE/OO@9
EXPORTING
>C? SAP AG BC400 38
#v/,ooM 7 .a/s,ooM
EXCEPTIONS
,ooM/not/+o)n4 7 <
)p4ate/s,ooM/%e-e$te4 7 D
,ooM/lo$Me4 7 B
$)%%en$'/$onve%s#on/e%%o% 7 !
OTHERS 7 O0
IF s'1s),%$ 7 "0
MESSAGE s<!VA,$!""C0
SET SCREEN "0
ELSE0
MESSAGE e<!XA,$!""C0
ENDIF0
ENDCASE%
ENDMOD+LE% K +SER_COMMAND_0500 INP+T
>C? SAP AG BC400 40
0olutons
1nt: Cross-Program )odular/aton
Topc: ABAP +b,ects and A4@ 5rd Control
":3 START/OF/SELECTION%
< !"&& "n#ena& #a)&e
SELECT 2 FROM sp+l#
INTO TALE (4t/sp+l#0
< W0ERE %%%
CALL SCREEN 500%
":4 ;si)5 t*e sree) lay!ut $u)ti!)- reate a !)tr!l !)tai)er area >se!)':last i!) i)
t*e t!!lbar?. Call t*e !)tai)er area C+-TA2-(%>D.
":5 9ill i) t*e 'elarati!) &artE
DATA:
$onta#ne%/% TYPE REF TO CL/GUI/CUSTOM/CONTAINER6
(%#4/% TYPE REF TO CL/GUI/AL;/GRID0
":6 t! ":AE
*lo# logc:
PROCESS BEFORE O+TP+T%
MOD+LE STAT+S_0500%
MODULE $%eate/$ont%ol0
<
PROCESS AFTER INP+T%
MOD+LE .op$_o9_.ode%
MOD+LE +SER_COMMAND_0500%
PB+ module n the program:
2U111111111111111111111111111111111111111111111111111111112
2U Mo4)le CREATE/CONTROL OUTPUT
2U111111111111111111111111111111111111111111111111111111112
MODULE $%eate/$ont%ol OUTPUT0
IF $onta#ne%/% IS INITIAL0
CREATE ORECT $onta#ne%/%
EXPORTING $onta#ne%/name 7 9CONTAINER/<90
CREATE ORECT (%#4/%
EXPORTING #/pa%ent 7 $onta#ne%/%0
CALL METHOD (%#4/%1Lset/ta,le/+o%/+#%st/4#spla'
EXPORTING #/st%)$t)%e/name 7 9SPFLI9
CHANGING #t/o)tta, 7 (4t/sp+l#0
ENDIF0
ENDMODULE0 5 CREATE/CONTROL OUTPUT
>C? SAP AG BC400 4#
>C? SAP AG BC400 4"
+)
SAP AG 2001
7rgani;ation o$ de"elop%ent and transport
9nhance%ent o$ standard so$t&are
Contents:
So$t&are 2ogistics and So$t&are Ad6ust%ent
>C? SAP AG BC400 #
15.2
SAP AG 2001
<se the tools and concepts you need $or
organi;ing de"elop%ent
8escribe ho& to a"oid %odi$ications to SAP
ob6ects
At the conclusion o$ this unit0 you &ill be able to:
So$t&are 2ogistics and So$t&are Ad6ust%ent:
<nit 7b6ecti"es
>C? SAP AG BC400 "
15.3
SAP AG 2001
7rgani;ation o$ 8e"elop%ent and Transport
7rgani;ation o$ de"elop%ent and transport
7rgani;ation o$ de"elop%ent and transport
9nhance%ent o$ standard so$t&are
9nhance%ent o$ standard so$t&are
>C? SAP AG BC400 3
15.4
SAP AG 2001
Assigning Transport -outes
89?
8e"elop%ent
syste%
FAS
Test and
translation
syste%
P-8
Production
syste%
SAP
D89?
Custo%er de"elop%ent
Standard ob6ects and
%odi$ications
!!!
Transport layer
!!!
!!!

D89?
!!!
#rea!e e)elo$*en! class
/$ y!u reate a 'e+el!&me)t lass $!r y!ur !%) 'e+el!&me)ts- t*e system aut!matially assi5)s t*e
!rret tra)s&!rt layer. 0*is sets t*e tra)s&!rt r!ute $!r t*e Re&!sit!ry !bGets t*at are assi5)e' t!
t*is 'e+el!&me)t lass.
@!u a) see t*e urre)t system !)$i5urati!) i) t*e 0ra)s&!rt Ma)a5eme)t System by *!!si)5
Tools A!ministration Transports Transport 7ana'ement &ystem?.
>C? SAP AG BC400 4
15.5
SAP AG 2001
Workbench 7rgani;er: -e5uests
Ioint Transport Assign%ent
Tea%:
Pro6ect (anager:
F-A
F-A
BC400=00
BC400=0+
BC400=02
BC400=03
!!!
#han(e re.ues!s "n)ol)"n( user B#400900
#han(eable
,rans$or!able
0,3>9000%1 #ARS8?
0,3>9000%2 #ARS8?
0,3>9000%3 B#400900
Re$or! source
@B#400A00AF/0GB,/0S,
ABAP $ro(ra*
0,3>9000%4 B#400901
0,3>9000%% B#400902
0,3>9000%6 B#400903
0,3>9000%< ...
-e5uest nu%ber
Pro6ect
(anager
Task nu%ber
-epository ob6ects
created or corrected
by e%ployee
<ser
At t*e be5i))i)5 !$ a 'e+el!&me)t &r!Get- t*e pro,ect manager reates a change re.uest. 0*e
&r!Get ma)a5er assi5)s all &r!Get team members t! t*e *a)5e reBuest. 0*e .!r(be)* Or5a)iCer
>.BO? t*e) reates a task $!r ea* &r!Get 'e+el!&er.
9r!m )!% !)- %*e)e+er a) em&l!yee assi5)s a Re&!sit!ry !bGet t! t*is *a)5e reBuest- t*e
Re&!sit!ry !bGet is aut!matially e)tere' i) t*at em&l!yeeIs task. All Re&!sit!ry !bGets t*at a)
em&l!yee %!r(s !) 'uri)5 a 'e+el!&me)t &r!Get are !llete' i) *is !r *er tas( $!l'er. 0*e
Re&!sit!ry !bGets are- t*ere$!re- l!(e' $!r all 'e+el!&ers %*! '! )!t bel!)5 t! t*is &artiular
&r!Get.
;)li(e t*e l!5ial $u)ti!)al 'i+isi!)s t*at se&arate Re&!sit!ry !bGets t*r!u5* t*e res&eti+e
'e+el!&me)t lass- *a)5e reBuests are &r!Get:relate' a)'- t*ere$!re- lmted %it* re5ar' t! t*e tme
schedule i)+!l+e'. 0*us- alt*!u5* a &r!5ram al%ays bel!)5s t! !)ly !)e 'e+el!&me)t lass- it a)
bel!)5 t! 'i$$ere)t *a)5e reBuests at 'i$$ere)t times.
>C? SAP AG BC400 5
15.6
SAP AG 2001
8e"eloperKs Tasks at 9nd o$ 8e"elop%ent Process
Tea%:
Pro6ect (anager:
F-A
F-A
BC400=00
BC400=0+
BC400=02
BC400=03
!!!
Schedule: ! ! ! Thursday Friday
Task is released
Task 5uality control:
H Synta' check
H Acti"ation o$ inacti"e ob6ects
Task docu%entation
.*e) 'e+el!&me)t is $i)is*e'- t*e de$eloper arries !ut a $i)al Buality *e( a)' releases t*e task.
0*e !bGets a)' !bGet l!(s are &asse' $r!m t*e tas( t! t*e *a)5e reBuest. <!%e+er- all em&l!yees
assi5)e' t! t*e tas( a) still ma(e *a)5es t! t*e !bGet beause t*e .!r(be)* Or5a)iCer
aut!matially reates a )e% tas( i$ )eessary.
>C? SAP AG BC400 6
15.7
SAP AG 2001
Pro6ect (anagerKs Tasks at 9nd o$ 8e"elop%ent Process
Schedule: ! ! ! Thursday Friday
-e5uest is released
Tea%:
Pro6ect (anager:
F-A
F-A
BC400=00
BC400=0+
BC400=02
BC400=03
!!!
Schedule: ! ! ! Thursday Friday
Task 5uality control:
H Synta' check
H 4nacti"e ob6ects
H Task consistency
Pro6ect docu%entation
?ersion %anage%ent
.*e) t*e &r!Get is !m&lete- t*e pro,ect manager *e(s t*e !)siste)y !$ t*e reBuest a)'
releases t*e *a)5e reBuest. 0*e l!(s !) t*e !bGets i) t*e reBuest are release'. 0*e 'e+el!&me)t
status !$ e+ery a$$ete' Re&!sit!ry !bGet is st!re' i) t*e +ersi!) ma)a5eme)t.
C!&ies !$ t*e Re&!sit!ry !bGets are t*e) e6&!rte' t! t*e e)tral tra)s&!rt 'iret!ry.
0*e system admnstrator i)itiates t*e im&!rti)5 !$ t*e !bGets i)t! t*e tar5et systemH t*is '!es )!t
*a&&e) aut!matially.
A$ter%ar's- t*e de$eloper *e(s t*e im&!rt l!5s.
>C? SAP AG BC400 A
15.8
SAP AG 2001
7riginals and Copies
Copy Copy
7riginal 7riginal
Copy Copy
Copy Copy
7riginal 7riginal
SAP ob6ect
Subse5uent syste% Subse5uent syste%
SAP ob6ect SAP ob6ect
Custo%er ob6ect Custo%er ob6ect
8e"elop%ent 8e"elop%ent
transport transport
8e"elop%ent syste% 8e"elop%ent syste%
.*e) y!u reate a Re&!sit!ry !bGet- t*e 0ra)s&!rt Or5a)iCer aut!matially )!tes t*e system i)
%*i* y!u reate' it. 0*e !ri5i)al !$ a Re&!sit!ry !bGet is i) a ertai) system.
0*e !ri5i)al +ersi!) !$ a) !bGet a) e6ist i) !)ly !)e system. All !t*er systems !)tai) !&ies !$
t*e !bGet.
0*e i'ea !$ *a+i)5 a) !ri5i)al system is t! e)sure t*at Re&!sit!ry !bGets a) be *a)5e' !)ly i) t*e
'e+el!&me)t system. 0*e i)te5rati!) system is %*ere y!u arry !ut y!ur 'e+el!&me)t %!r( s! all !$
t*e !bGets i) it are !ri5i)als. 0*is mea)s t*ere is !)e e)tral l!ati!) $!r *a)5i)5 all Re&!sit!ry
!bGets.
/$ y!u )!% tra)s&!rt y!ur Re&!sit!ry !bGets i)t! a subseBue)t system- t*ey e6ist t*ere as !&ies.
Alt*!u5* it is &!ssible t! *a)5e !&ies i) e6e&ti!)al ases- y!u s*!ul' al%ays try t! ma(e t*e
*a)5es t! t*e !ri5i)al i) t*e 'e+el!&me)t system a)' tra)s&!rt t*e )e% +ersi!) t! t*e subseBue)t
system $r!m t*ere. 0*is e)sures t*at t*e state !$ !bGets remai)s !)siste)t ar!ss systems.
Ori5i)als are )e+er !+er%ritte) i) tra)s&!rts.
>C? SAP AG BC400 8
15.9
SAP AG 2001
(odi$ied (odi$ied
copy copy
Corrected Corrected
original original
Copy Copy
Copy Copy
Corrected Corrected
original original
SAP ob6ect
Subse5uent syste% Subse5uent syste%
Correction Correction
transport transport
SAP ob6ect SAP ob6ect
Custo%er ob6ect Custo%er ob6ect
Correction Correction
-epair -epair Correction Correction
-epair -epair
transport transport
Corrections and -epairs
8e"elop%ent syste% 8e"elop%ent syste%
A correcton is a *a)5e t! a) !ri5i)al. 0*e system re!r's !rreti!)s i) a reBuest !)tai)i)5 tas(s
!$ ty&e !evelopment3correction.
A repar is a *a)5e t! a !&y >t*at is- a) !bGet is )!t *a)5e' i) its !ri5i)al system?. A!r'i)5ly-
t*is *a)5e is re!r'e' i) a tas( %it* ty&e repair. A modfcaton is a re&air !$ a) SAP !bGet.
0*e *a)5es ma'e t! y!ur !%) !bGets >$!r e6am&le- 'ue t! a) emer5e)y i) t*e &r!'uti!) system?
a) als! be ma'e imme'iately t! t*e !ri5i)als i) t*e 'e+el!&me)t system. 7ou must make the
changes you made to the copes mmedately to the orgnal as #ell a)' tra)s&!rt t*e )e% +ersi!)
t! t*e subseBue)t system.
0*is is )!t &!ssible $!r SAP !bGets beause t*e !ri5i)als are )!t i) a)y !$ y!ur systems.
>C? SAP AG BC400 8
15.10
SAP AG 2001
(odi$ications 8uring <pgrade
(odi$ied (odi$ied
copy copy
Corrected Corrected
original original
Copy Copy
Copy Copy
Corrected Corrected
original original
SAP ob6ect
Subse5uent syste% Subse5uent syste%
Ad6ust%ent Ad6ust%ent
transport transport
SAP ob6ect SAP ob6ect
Custo%er ob6ect Custo%er ob6ect
<pgrade <pgrade
<pgrade <pgrade
(odi$ication (odi$ication
ad6ust%ent ad6ust%ent
8e"elop%ent syste% 8e"elop%ent syste%
A !)$lit !ul' !ur i$ y!u im&!rt a) u&5ra'e- a su&&!rt &a(a5e- !r s!me !t*er tra)s&!rt reBuest
$r!m SAP i)t! y!ur system.
Su* a !)$lit !urs i$ a) SAP !bGet m!'i$ie' by y!u is )e%ly s*i&&e' by SAPE 0*e !bGet )e%ly
tra)s&!rte' by SAP be!mes a) ati+e !bGet i) t*e Re&!sit!ry !$ y!ur system.
/$ y!u %a)t t! sa+e y!ur *a)5es- y!u *a+e t! ma(e a modfcaton ad,ustment $!r t*e
!rres&!)'i)5 !bGets. M!'i$yi)5 a )umber !$ SAP !bGets a) ause a substa)tial 'elay %*e)
&er$!rmi)5 a) u&5ra'e.
0! e)sure t*at t*e 'e+el!&me)t system a)' t*e subseBue)t system are !)siste)t- y!u s*!ul' make
the modfcaton ad,ustment n the de$elopment system only. 0*e !bGets !$ t*e a'Gustme)t are
t*e) tra)s&!rte' t! subseBue)t systems.
>C? SAP AG BC400 #0
15.11
SAP AG 2001
9nhance%ent o$ Standard So$t&are
7rgani;ation o$ de"elop%ent and transport
7rgani;ation o$ de"elop%ent and transport
9nhance%ent o$ standard so$t&are
9nhance%ent o$ standard so$t&are
>C? SAP AG BC400 ##
15.12
SAP AG 2001
7"er"ie&: So$t&are Ad6ust%ent Possibilities
Business Business
applications applications
,SAP ob6ects. ,SAP ob6ects.
Custo%er Custo%er
ob6ects ob6ects
(odi$ication (odi$ication
Custo%er Custo%er
de"elop%ents de"elop%ents
assisted
not assisted
8ictionary ob6ect
ABAP source code
Screen
4nter$ace
using SAP ob6ects
not using SAP
ob6ects
9nhance%ent 9nhance%ent
0*ere are $!ur 'i$$ere)t %ays !$ *a)5i)5 t*e SAP system t! meet y!ur reBuireme)tsE
Custom/ng:
All!%s y!u t! *a)5e system &arameters usi)5 y!ur !%) mai)te)a)e tra)sati!). All &!ssible
*a)5es *a+e bee) t*!u5*t !$ a)' !r5a)iCe'. Cust!miCi)5 is a ma)'at!ry &art !$ setti)5 u& a)
SAP system.
(nhancement concept:
All!%s y!u t! *a)5e SAP Re&!sit!ry !bGets #thout modfcatons.
Customer de$elopments:
All!%s y!u t! reate Re&!sit!ry !bGets i) a!r'a)e %it* t*e ust!mer )ames&ae !)+e)ti!)s.
)odfcaton Assstant:
All!%s y!u t! *a)5e SAP Re&!sit!ry !bGets. M!'i$iati!)s a) lea' t! a !)si'erably 5reater
%!r(l!a' $!r a) u&5ra'e. /$ t*e )e% release *as *a)5es t! t*e same Re&!sit!ry !bGet t*at %as
&re+i!usly m!'i$ie'- y!u *a+e t! a'Gust t*e +ersi!)s ma)ually. 0*e M!'i$iati!) Assista)t
su&&!rts a'Gustme)t !$ +ersi!)s semi:aut!matially. 9!r m!re 'etails- re$er t! t*e !)li)e
'!ume)tati!)E Basis ABAP Workbench "han'in' the &AP &tan!ar! The 7o!ification
Assistant.
>C? SAP AG BC400 #"
15.13
SAP AG 2001
9nhance%ent Concept <sing the Function (odule
9'it as an 9'a%ple
CALL CUSTOMER1FUNCTION 9""E9
000 0
REPORT Ksap/p%o(%am/nameL0 REPORT Ksap/p%o(%am/nameL0
START1OF1SELECTION0 START1OF1SELECTION0
000 000
INCLUDE INCLUDE P? P?KnameL)"<0 KnameL)"<0
000 000
2 e?ten4e4 +)n$t#onal#t' 2 e?ten4e4 +)n$t#onal#t'
000 000
7b6ect in custo%er
na%espace
FUNCTION e?#t/Ksap/p%o(%am/nameL/""E0
INCLUDE P?KnameL)"<0
ENDFUNCTION0
9nhance%ent call
SAP !bGets are usually e)*a)e' as s*!%) ab!+e.
0*e SAP !bGet e)ables y!u t! 5! t! a ust!mer !bGet. Si)e t*is !bGet usually '!es )!t e6ist- y!u
*a+e t! im&leme)t it i) t*e s&ei$ie' ma))er.
Di$$ere)t e)*a)eme)t te*)iBues are im&leme)te' 'i$$ere)tly. De&e)'i)5 !) t*e e)*a)eme)t
te*)iBue- y!u *a+e t! use a 'i$$ere)t mai)te)a)e tra)sati!) t! reate t*e !rres&!)'i)5 !bGets
a)' ati+ate t*e e)*a)eme)t.
0*e !rres&!)'i)5 mai)te)a)e tra)sati!) *as a sear* $u)ti!) $!r $i)'i)5 a suitable e)*a)eme)t.
@!u a) als! $i)' '!ume)tati!) ab!ut t*e !rres&!)'i)5 e)*a)eme)t *ere.
>C? SAP AG BC400 #3
15.14
SAP AG 2001
9nhancing <ser 8ialogs
Flight data 9dit oto Syste% :elp
Continue
First line
Last line
8ac.
Table .ind
8ac.
Custo2er $unction
Airline LH
(enu e'it
Flight number 400
Field e'it
Additional $ield -
Additional $ield /
Screen e'it
Te't and
docu%entation
enhance%ent to
data ele%ent
1)*a)eme)t !$ user 'ial!5s is &!ssible at t*e $!ll!%i)5 le+elsE
Q )enu e"t:
0*e system !)tai)s +ari!us &!i)ts at %*i* y!u a) i)lu'e me)u items t*at all ust!mer
$u)ti!)s.
Q 0creen e"t:
S!me sree)s !)tai) s&eial areas >subsree)s? i) %*i* y!u a) 'is&lay y!ur !%) sree)s.
Q *eld e"t:
@!u a) atta* a''iti!)al *e(s !r !)+ersi!)s t! $iel's !) sree)s.
/) t*e ABAP Diti!)ary- y!u a) als! e)*a)e attributes !$ 'ata eleme)tsE
Q *eld documentaton:
@!u a) re&lae t*e $iel' '!ume)tati!)- %*i* is 'is&laye' %*e) t*e user &resses 9# %it* y!ur
!%) te6ts.
Q *eld label:
@!u a) re&lae t*e s*!rt- me'ium- a)' l!)5 te6t $iel' labels %it* y!ur !%) te6t.
>C? SAP AG BC400 #4
15.15
SAP AG 2001
Further 9nhance%ent 9'a%ples
Append structure:
Additional $ields in standard tables
Prede$ined but not yet e$$ecti"e source code
Business Add 4n ,BAd4.:
7b6ect=oriented 9nhance%ent
/) a''iti!) t! t*e e)*a)eme)t te*)iBues alrea'y me)ti!)e'- !t*er !&ti!)s i)lu'eE
Append structures:
@!u a) reate a)y )umber !$ a&&e)' strutures $!r e+ery sta)'ar' table. .it* t*is $eature- y!u
a) a&&e)' $iel's t! a table %it*!ut *a)5i)5 t*e table itsel$.
Predefned but not yet effect$e source code:
/) s!me sta)'ar' &r!5rams- s&ei$i s!ure !'e areas are !mme)te' !ut. /$ t*e !mme)t
symb!ls >asteris(s? are rem!+e' $r!m t*ese li)es !$ s!ure !'e- t*e li)es %ill be e6eute'. 0*is is
te*)ially a m!'i$iati!)- *!%e+er.
Busness Add 2ns ABAd2sB:
As %it* a $u)ti!) m!'ule e6it- y!u a) 'e$i)e a''iti!)al &r!5ram l!5i $!r a&&r!&riate sta)'ar'
&r!5rams. Busi)ess A'' /)s are !bGet:!rie)te' a)' !$$er a''iti!)al !&ti!)s.
>C? SAP AG BC400 #5
15.16
SAP AG 2001
-egistering 8e"elopers in the SSC-
SAP So$t&are Change -egistration
,SSC-.
SAP So$t&are Change -egistration SAP So$t&are Change -egistration
,SSC-. ,SSC-.
H Aou %ust register de"elopers
using the SSC- procedure
H 9ach de"eloper obtains an
access key
H For e"ery de"eloper0 you need
only apply once $or an access
key
H H Aou %ust register de"elopers Aou %ust register de"elopers
using the SSC- procedure using the SSC- procedure
H H 9ach de"eloper obtains an 9ach de"eloper obtains an
access key access key
H H For e"ery de"eloper0 you need For e"ery de"eloper0 you need
only apply once $or an access only apply once $or an access
key key
H Aou %ust register %odi$ied
SAP ob6ects using the SSC-
procedure
H 9ach ob6ect obtains an access
key
H Aou can only apply $or an
access key $or an ob6ect in
each ->3 -elease
H H Aou %ust register %odi$ied Aou %ust register %odi$ied
SAP ob6ects using the SSC- SAP ob6ects using the SSC-
procedure procedure
H H 9ach ob6ect obtains an access 9ach ob6ect obtains an access
key key
H H Aou can only apply $or an Aou can only apply $or an
access key $or an ob6ect in access key $or an ob6ect in
each ->3 -elease each ->3 -elease
-egister SAP ob6ects to -egister SAP ob6ects to
be changed be changed
-egister de"elopers &ho use -egister de"elopers &ho use
the ABAP Workbench the ABAP Workbench
All users %*! %a)t t! use t*e ABAP .!r(be)* t! reate !r *a)5e a Re&!sit!ry !bGet i) t*e SAP
system >i)lu'i)5 ust!mer 'e+el!&me)ts? must ma(e a sngle reBuest $!r a (ey usi)5 t*e SAP
S!$t%are C*a)5e Re5istrati!) >SSCR? &r!e'ure.
A$ter re5istrati!)- all 'e+el!&ers reei+e a (ey. 0*e (ey is li)(e' t! t*e 'e+el!&erIs user /D a)' t*e
lie)se )umber !$ t*e SAP system. 0*e system &r!m&ts 'e+el!&me)t users $!r t*eir (ey t*e $irst time
t*ey attem&t t! reate !r *a)5e a Re&!sit!ry !bGet.
A''iti!)ally- e+ery SAP Re&!sit!ry !bGet t*at is modfed must be re5istere'. .*e) re5isteri)5
t*ese !bGets- y!u must s&ei$y t*e Re&!sit!ry !bGet )ame- t*e !bGet ty&e- a)' t*e SAP system
lie)se )umber a)' release. 0*e re5istrati!) is +ali' u)til t*e )e6t u&5ra'e.
>C? SAP AG BC400 #6
15.17
SAP AG 2001
<se the tools and concepts you need $or
organi;ing de"elop%ent
8escribe ho& to a"oid %odi$ications to SAP
ob6ects
Aou are no& able to:
So$t&are 2ogistics and So$t&are Ad6ust%ent:
<nit Su%%ary
>C? SAP AG BC400 #A
+*
SAP AG 2001
Appendi'
This section contains supple%entary %aterial
to be used as re$erence!
This %aterial is not part o$ the standard course!
There$ore0 the instructor %ight not co"er this during
the course presentation!
16.2
SAP AG 2001
Progra% Types
Progra% Types
Progra% Types
8ata Types0 8ata 7b6ects0 and State%ents
8ata Types0 8ata 7b6ects0 and State%ents
2ogical 8atabases
2ogical 8atabases
Pre"ie&
Pre"ie&
>C? SAP AG BC400 "
16.3
SAP AG 2001
4nclude: NincludeCna%eO
, Progra% type: 4nclude .
Progra%: Nprogra%Cna%eO
REPORT Kp%o(%am/nameL0
:
INCLUDE K#n$l)4e/nameL0
:
ABAP state%ents
Progra%s o$ S4ncludeS Type
>C? SAP AG BC400 3
16.4
SAP AG 2001
REPORT KnameL0
TYPES:000
DATA: 000
Progra%: Nna%eOT7P
Progra% type: 4nclude
Progra%: Nna%eO
Progra% type: e'ecutable
INCLUDE KnameLTOP0
START1OF1SELECTION0
:
Create progra%
progra% Nna%eO
With T7P=4nclude
-epository Bro&ser:
Create progra%
T7P 4nclude
>C? SAP AG BC400 4
16.5
SAP AG 2001
Standard 4ncludes $or Function roups
The 7b6ect 2ist 9dit oto <tilities 9n"iron%ent Syste% :elp
3"<ect -a.i*ator
The )b9ect List
Display
BC402_F!!_"#I$LIS$ Function group
Class
Local )b9ects
Develop2ent class
progra2
Workbench 9dit oto 9'tras 9n"iron%ent Syste% :elp
3"<ect -a.i*ator
)b9ect na2e
8C+&/#F!DD#:AITLIST
Function 2odules
Fields
08) 2odules
Screens
5*I title
Includes
L8C+&/#F!DD#:AITLISTT)0
L8C+&/#F!DD#:AITLIST)&-
L8C+&/#F!DD#:AITLIST*&-

L8C+&/#F!DD#:AITLIST*&/
L8C+&/#F!DD#:AITLIST*&'
L8C+&/#F!DD#:AITLIST*&+
L8C+&/#F!DD#:AITLIST*&6
L8C+&/#F!DD#:AITLIST*&;
L8C+&/#F!DD#:AITLIST*44
Add <aiting custo2er
:aiting custo2er $ro2 list
Display <aiting list
!ove up <aiting custo2er
%eturn position in list
Change <aiting position
Function %odules Function %odules Function %odules Function %odules Function %odules
PB7 %odules
lobal declarations
4nclude $unction %odules
.*e) y!u %!r( %it* $u)ti!) 5r!u&s a)' m!'ules- y!u a) use t*e ABAP .!r(be)* t! arra)5e t*e
&r!5ram s!ure !'e i) !+er+ie% $!rm a)' struture it %it* ease.
/) t*e Na+i5ati!) $u)ti!)- y!u al%ays bra)* t! t*e !rret !bGet- a)' /)lu'e &r!5rams are 5i+e)
)ames a)' reate'. 0*e res&eti+e all stateme)ts are aut!matially e)tere' at t*e !rret &!siti!).
0*e all stateme)ts must !)tai) !)ly t*e )ame !)+e)ti!) $!r $u)ti!) 5r!u&sE YG
=2em_name3%
0*e system t*e) reates a &r!5ram !$ 9 ty&e- SAPLYG=2em_name3% 0*is !)tai)s !)ly
INCLUDE stateme)ts t*at %ere reate' aut!matially. 0*e /)lu'e &r!5rams are aut!matially 5i+e)
t*e )ame LYG=2em_name32a))e432n-m3%
/) a''iti!)- t*e system i)lu'es t*e /)lu'e &r!5ram- LYG=2em_name3UXX. <ere- t*ere is a all
$!r a) a&&r!&riate /)lu'e &r!5ram- 47KLLremU)ameM1L)umM- $!r ea* $u)ti!) m!'ule.
>C? SAP AG BC400 5
16.6
SAP AG 2001
8ata Types0 8ata 7b6ects0 and State%ents
Progra% Types
Progra% Types
8ata Types0 8ata 7b6ects0 and State%ents
8ata Types0 8ata 7b6ects0 and State%ents
2ogical 8atabases
2ogical 8atabases
Pre"ie&
Pre"ie&
>C? SAP AG BC400 6
16.7
SAP AG 2001
Structures and internal Tables Can be #ested
Struture ty&es a) !)tai) !t*er struture ty&es !r table ty&es.
0able ty&es a) !)tai) struture ty&es a)' table ty&es.
/) t*e (ey%!r' '!ume)tati!) $!r t*e (ey%!r' TYPES- y!u %ill $i)' t*e sy)ta6 $!r 'e$i)i)5 table
ty&es.
>C? SAP AG BC400 A
16.8
SAP AG 2001
TYPE1POOL =!""0
TYPES: P!""/name/t'peADOC TYPE C6
EGIN OF P!""/+l#(&t%e$/t'pe6
000 6
END OF P!""/+l#(&t%e$/t'pe0
REPORT 000 0
TYPE1POOLS P!""0
DATA: name TYPE P!""/name/t'pe6
.a TYPE P!""/+l#(&t%e$/t'pe0
000 0
ABAP
Type roups in the ABAP 8ictionary
/) a''iti!) t! 'elari)5 a 'ata ty&e %it*i) a) ABAP &r!5ram- y!u a) als! 'elare 'ata ty&es i) a
ty&e 5r!u& i) t*e ABAP Diti!)ary.
0*e ty&e 5r!u& )ame i) t*e ABAP Diti!)ary *as a ma6imum !$ $i+e *araters. 0y&e )ames %it*i)
t*e ty&e 5r!u& 2#$ppoo&3 must be5i) %it* 2#$ppoo&3 $!ll!%e' by a) u)'ers!re.
0*e ty&es i) a ty&e 5r!u& must be 'elare' i) ABAP &r!5rams %it* t*e TYPE/POOLS !mma)'.
>C? SAP AG BC400 8
16.9
SAP AG 2001
Type Con"ersion
When are t&o types co%patible@
T&o ele%entary types are co%patible i$ they are identical in
type and length ,and nu%ber o$ deci%al places in the case o$
packed nu%bers.!
T&o structure types are co%patible i$ they ha"e the sa%e
structure and their co%ponents are co%patible!
T&o table types are co%patible i$ their line types are
co%patible and their key de$initions0 key categories0 and table
types are identical!
8ata ob6ects &ith co%patible types can be assigned
&ithout con"ersion!
#on=co%patible types can be con"erted i$ a con"ersion
rule has been de$ined!
/$ t%! 'ata ty&es are )!t !m&atible- but a !)+ersi!) rule e6ists- t*e) t*e system
&er$!rms ty&e !)+ersi!)s $!r +alue assi5)me)ts- alulati!)s- !r !m&aris!)s.
0*e $!ll!%i)5 5ra&*is i)tr!'ue t*e basi $!rms !$ !)+ersi!) rules a)' 5i+e e6am&les
!$ t*e m!st im&!rta)t ases. All t*e !)+ersi!) rules a) be $!u)' i) t*e ABAP '!ume)tati!)
!) t*e MO71 stateme)t.
/$ )! !)+ersi!) rule is 'e$i)e' $!r a stateme)t- t*e systemIs reati!) 'e&e)'s u&!)
t*e &artiular &r!5ram !)te6tE
/) t*e ase !$ statstcal types9 t*e system issues a synta" error.
("ampleE
DATA: 4ate TYPE 4 ;ALUE 9<XXX<DB<96 t#me TYPE t0
FIELD1SYMOLS: K+s/4ateL TYPE 46 K+s/t#meL TYPE t0
ASSIGN: 4ate TO K+s/4ateL6 t#me TO K+s/t#meL0
K+s/t#meL 7 K+s/4ateL0
/) t*e ase !$ dynamc ty&es- t*e system issues a runtme error si)e t*e t*e $iel' symb!ls are
ty&e' !)ly %*e) t*e 'ata !bGets are assi5)e' at ru)time.
("ample >rest as ab!+e?E
!!!
FIELD1SYMOLS: K+s/4ateL TYPE ANY6 K+s/t#meL TYPE ANY!
!!!
>C? SAP AG BC400 8
16.10
SAP AG 2001
2ogical 9'pressions
2 $ompa%#sons +o% all 4atat'pes:
00 K4o,-L ZE8G7[ ZKl#te%alLGK4o,-L[ 00 5eI)al
00 K4o,-L ZNEGKL[ ZKl#te%alLGK4o,-L[ 00 5not eI)al
00 K4o,-L ZGTGL[ ZKl#te%alLGK4o,-L[ 00 5(%eate% t&an
00 K4o,-L ZGEGL7[ ZKl#te%alLGK4o,-L[ 00 5(%eate% o% eI)al
00 K4o,-L ZLTGK[ ZKl#te%alLGK4o,-L[ 00 5less t&an
00 K4o,-L ZLEGK7[ ZKl#te%alLGK4o,-L[ 00 5less o% eI)al
00 K4o,-L ET3EEN ZKl#tLGK4o,-L[ AND ZKl#tLGK4o,-L[ 00
00 K4o,-L IS INITIAL 00
2 nest#n( lo(#$ e?p%ess#ons:
00 Knest/opL A Ke?p%<L Knest/opL Ke?p%DL C Knest/opL 00
2 poss#,le ope%ato%s Knest/opL:
00 AND 00 5all e?p%ess#ons m)st ,e t%)e
00 OR 00 5one o+ t&e e?p%ess#ons m)st ,e t%)e
2 ne(at#on:
00 NOT Ke?p%L 00 5t%)e6 #+ Ke?p%L +alse
/$ y!u *a+e a !m&aris!) !$ non-numerc 'ata !bGets- t*ese are i)ter&rete' 'i$$ere)tly- 'e&e)'i)5
u&!) ty&e.
/$ &!ssibleE !)+ersi!) i) )umbers >*e6a'eimal- $!r e6am&le- as bi)ary )umber?
Date a)' timeE i)ter&rete' as earlier !r laterH $!r e6am&le- #"/3#/#888 L 0#/0#/"000
Ot*er *aratersE le6!5ra&*ial i)ter&retati!) a!r'i)5 t! *arater !'eH a'a&t le)5t* by $illi)5 i)
bla)(s
Re$ere)esE !m&aris!) !$ a''ress a)' 'ata ty&e- !)ly Oi'e)tialO a) be i)ter&rete' suitably
9!r !m&aris!)s !$ stri)5s a)' bits- m!re relati!)al !&erat!rs are a+ailable >see !)li)e
'!ume)tati!) $!r /9?.
/) t*e ase !$ li)(s a)' )e5ati!)s- t*e sta)'ar' rules $!r l!5ial e6&ressi!)s a&&lyE
-+T is m!re &!%er$ul t*a) A-3- A-3 is m!re &!%er$ul t*a) +%.
("ample
-+T fD M f? +% f' M f4 A-3 fN M fO t*ere$!re !rres&!)'s t!
A -+T A fD M f? B B +% A f' M f4 A-3 fN M fO B.
0! *a+e a better !+er+ie% a)' $!r seurity reas!)s- &lae y!ur &artial e6&ressi!)s i) bra(ets- e+e) i$
it is )!t abs!lutely )eessary.
By setti)5 u& y!ur e6&ressi!)s are$ully- y!u a) i)$lue)e t*e ru)time reBuireme)t i) a &!siti+e
%ay.
>C? SAP AG BC400 #0
16.11
SAP AG 2001
7"er"ie&: Ter%ination State%ents
2oops:
87 W:429
S929CT 277P
9"ents 4:
27A8=7F=P-7-A(!
STA-T=7F=S929CT47#!
9T NnodeO T2AT9U!
9#8=7F=S929CT47#!
9"ents 44:
4#4T4A24DAT47#!
AT S929CT47#=SC-99# T7<TP<TU!
T7P=7F=PA9!
9#8=7F=PA9!
AT 24#9=S929CT47#!
AT <S9-=C7((A#8!
(odulari;ation units
8isplay %essage
then
progra% end
and
delete all internal
%odes
MESSAGE a00 EXIT CHEC@
LEA;E
PROGRAM
LEA;E TO
TRANSACTION
Progra% end
#e'trun
2ea"eloop
8isplay
list bu$$erX
9'ecute
e"ent
blocks 44
9nd current
processing block
and proceed
&ith ne't
processing block
ABAP e+e)t bl!(s !r m!'ulariCati!) u)its >subr!uti)es- m!'ules? are alle' processng blocks.
0*e C0ECK &o'"._e1p stateme)t *as t*e $!ll!%i)5 e$$etE
+utsde a loop- y!u a) termi)ate a &r!essi)5 bl!( &rematurely. 0*e bl!( stateme)ts a$ter t*e
C<1CS stateme)t are s(i&&e' i$ t*e l!5ial !)'iti!) is not $ul$ille'. 0*e system t*e) !)ti)ues
%it* t*e $irst stateme)t i) t*e )e6t &r!essi)5 bl!(.
Wthn a loop- it *as t*e e$$et t*at t*e )e6t l!!& is &r!esse'.
0*e E:IT stateme)t reats i) t*ree 'i$$ere)t %aysE
.it*i) ea* l!!&- l!!& &r!essi)5 is !m&lete' t! t*e e)'.
Outsi'e !$ t*e l!!&s- but %it*i) t*e $irst e+e)ts liste' !) t*is sli'e- t*e system 'is&lays t*e list
bu$$er %it* t*e urre)t !)te)t. A$ter%ar's- t*e e+e)ts !$ t*e !t*er 5r!u& are tri55ere' a)' t*!se
e+e)ts liste' be$!re START/OF/SELECTION are i)itiate' at t*e LOAD/OF/PROGRAM e+e)t.
At all !t*er &!i)ts- E:IT *as t*e same e$$et as C0ECK.
;si)5 t*e LEA*E PROGRAM !r LEA*E TO TRANSACTION t!'e stateme)ts- y!u a) termi)ate
t*e urre)t &r!5ram.
A$ter a termi)ati!) messa5e- t*e system termi)ates )!t !)ly t*e urre)t &r!5ram- but als! t*e e)tire
program stack.
>C? SAP AG BC400 ##
16.12
SAP AG 2001
The (9SSA9 State%ent0 (essage Classes0 and
(essages
8e$inition
<se
MESSAGE ID 9Kmessa(e $lassL9 TYPE 9Kmessa(e t'peL9
NUMER 9Kmessa(e n)m,e%L9 0
BC400
(essage short te't
040
04+
002
N%essage classO
(essage class:
(essage
The na%e o$ the airline Y+ is Y2
Airline Y+ is not a"ailable
N%essage nu%berO
Attributes (essages
ID 9K ID 9Kmessa(e $lass messa(e $lassL9 L9
NUMER 9K NUMER 9Kmessa(e n)m,e% messa(e n)m,e%L9 L9
Kmessa(e $lassL
Kmessa(e n)m,e%L
Kmessa(e $lassL
Kmessa(e n)m,e%L
0! tri55er a messa5e 'ial!5 i) a &r!5ram- e)ter t*e MESSAGE stateme)t %it* t*e $!ll!%i)5
a''iti!)sE
ID 9Kmessa(e $lassL9 $!r t*e messa5e lass
NUMER 9Kn)m,e%L\ $!r t*e messa5e )umber
0! 'is&lay t*e messa5e te6t $!r a MESSAGE stateme)t i) a &r!5ramIs s!ure !'e- '!uble:li( t*e
messa5e )umber t! 5! t! t*e ass!iate' messa5e lass te6ts.
Ot*er sy)ta6 +aria)ts are a+ailable $!r t*e MESSAGE stateme)t. 9!r m!re i)$!rmati!)- re$er t! t*e
(ey%!r' '!ume)tati!) $!r t*e MESSAGE stateme)t.
>C? SAP AG BC400 #"
16.13
SAP AG 2001
Sel$=9'planatory (essages or (essages &ith 2ong
Te'ts
(essage class BC400
Sel$=e'planatory
8e$inition
Short te't
Nshort te'tO
Nshort te'tO
#u%ber
000
00+
2ong te't
=s#ort te$t>
8iagnosis
Ltext>
Syste% acti"ities
Ltext>
Procedure
Ltext>
Procedure $or syste% ad%inistrator
Ltext>
2ong te't
(essage class:
#u%ber
2
+
: (essage is sel$=e'planatory
There is a long te't
e'plaining the %essage
/$ a messa5e s*!rt te6t !)tai)s all t*e i)$!rmati!) t*e user )ee's- t*e messa5e is 'esribe' as self-
e"planatory.
("ampleE D0*e &r!5ram *as bee) sa+e'.D
Sel$:e6&la)at!ry messa5es are $la55e' as su* i) t*e messa5e lass.
/$ y!u %a)t t! &r!+i'e m!re 'etaile' i)$!rmati!) $!r t*e user- y!u a) '! s! by st!ri)5 a l!)5 te6t
%it* t*e messa5e. /) t*e 7essa'e 7aintenance sree)- t*e &elf2E1planatory $la5 i)'iates %*et*er
!r )!t a messa5e is i)'ee' sel$:e6&la)at!ry. 0! 'is&lay t*e l!)5 te6t- selet t*e messa5e li)e a)'
*!!se +on' Te1t. 0*e system t*e) 'is&lays t*e mai)te)a)e $!rmats. @!u a) 'is&lay t*e $!rmatte'
te6t by *!!si)5 &creen O$tp$t) @!u usually reate t*e l!)5 te6t $r!m a tem&late- %*i* !)tai)s t*e
*ea'i)5s Dia'nosis, &ystem Activities, Proce!$re, a)' Proce!$re for the &ystem A!ministrator) 0*e
system '!es )!t 'is&lay t*e *ea'i)5 t! t*e user i$ t*ere is )! te6t st!re' u)'er it.
>C? SAP AG BC400 #3
16.14
SAP AG 2001
(essages &ith Placeholders
8e$inition
<se
MESSAGE ID 9Kmessa(e $lassL9 TYPE 9Kmessa(e t'peL9
NUMER KnnnL
3ITH Kva%<L Kva%DL Kva%BL Kva%!L 0 3ITH Kva%<L Kva%DL Kva%BL Kva%!L
U< UD UB U!
BC400
(essage short te't
03/
040
04+
(essage class:
(essage
The na%e o$ the airline Y+ is Y2
Airline Y+ is not a"ailable
Attributes (essages
@!u a) i)lu'e u& t! $!ur &lae*!l'ers i) a messa5e >X#- X"- X3 a)' X4?. @!u a) t*e) assi5)
urre)t &arameters t! t*em i) t*e M1SSAG1 stateme)t usi)5 t*e ./0< a''iti!). @!u a) use
literals- te6t symb!ls- !r +ariables. @!u must i)lu'e a s&ae bet%ee) ea* !)e. 0*e urre)t
&arameters are assi5)e' t! t*e &lae*!l'ers X#- X"- X3- a)' X4 i) !r'er.
/) t*e l!)5 te6t- t*e &lae*!l'ers are 5i+e) t*e )ames X7#X- X7"X- X73X- a)' X74X a)'
re&lae' at ru) time i) !r'er- a!r'i)5 t! t*e same l!5i. 0! i)sert a &lae*!l'er i) t*e l!)5 te6tE
Plae y!ur urs!r i) t*e te6t %*ere y!u %a)t t! i)sert t*e &lae*!l'er.
C*!!se E!itE"omman!EInsert comman! . 0*e system 'is&lays a 'ial!5 b!6. /) &ymbols- e)ter
X7#X >!r X7iX i N "- 3 !r 4- as a&&r!&riate?.
C*!!se Enter t! !)$irm t*e 'ial!5 b!6.
>C? SAP AG BC400 #4
16.15
SAP AG 2001
Creating (essage Classes and (essages
4n the 7b6ect #a"igator:
Create using $or&ard na"igation
MESSAGE ID 9Kmessa(e $lassL9 TYPE 9Kmessa(e t'peL9
NUMER 9Kmessa(e n)m,e%L9 0
(essage class a"ailable@
8ouble=click
8ouble=click
Create %essage class
#o
Create %essage
Aes
Kmessa(e $lassL
Kmessa(e n)m,e%L
8e"elop%ent class
DBC400C+2 Create !!!
(essage class Progra%s
!!!
(essage classes
DBC400C(C+2
!!!
Change
8isplay
DBC400C+2
#ote: (essages can
be translated! They
then appear in the
userKs logon language!
0! reate y!ur !%) messa5e lass- 5i+e it a )ame i) t*e ust!mer )ames&ae- t*at is- a )ame
be5i))i)5 %it* @- Y- !r t*e )ames&ae &re$i6.
0! reate a messa5e- assi5) a t*ree:'i5it )umber a)' a messa5e lass t! it.
@!u a) reate b!t* t*e messa5e lass a)' t*e messa5e itsel$ usi)5 $!r%ar' )a+i5ati!) $r!m t*e
MESSAGE stateme)t.
/) t*e ObGet Na+i5at!r- y!u a) reate a)' e'it a messa5e lass i) a)y !$ t*e $!ll!%i)5 %aysE
9r!m t*e !)te6t me)u bel!)5i)5 t! t*e r!!t )!'e i) t*e !bGet list !$ t*e res&eti+e 'e+el!&me)t
lass
9r!m t*e !)te6t me)u bel!)5i)5 t! t*e 7essa'e class )!'e i) t*e !bGet list !$ t*e a&&r!&riate
'e+el!&me)t lass
9r!m t*e Other obect))) i!)
A 'ial!5 b!6 !)tai)i)5 a tab a&&ears. /) t*e Other tab- e)ter a messa5e lass- !r a messa5e %it*
its messa5e lass- a)' t*e) 'is&lay- reate- !r *a)5e it by *!!si)5 t*e a&&r!&riate i!).
>C? SAP AG BC400 #5
16.16
SAP AG 2001
Colors in 2ists +
Flight $ro% to
AA 00+1 #9W A7-E SA# F-A#C4SC7
2: 0400 F-A#EF<-T #9W A7-E
2: 0402 F-A#EF<-T B9-24#

Creation date: 0+>0+>200+
Created by: W4TT(A##
REPORT sap,$!"")44/e?ample/<a0
INCLUDE KLISTL0
:
3RITE: * .a/sp+l#1$a%%#4 COLOR $ol/Me'6
#$on/4ate AS ICON6
W-4T9 Ndata ob6ectO NoptionO !
Colors>4cons>Sy%bols in 2ists
@!u a) set se+eral list 'is&lay attributes %it*i) a WRITE stateme)t. O)e su* attribute is color-
%*i* a) be a'Guste' usi)5 t*e $!rmatti)5 !&ti!) COLOR 2n3% @!u a) *!!se $r!m se+e)
ba(5r!u)' !l!rs t*at are ati+ate' by eit*er a )umeri +alue !r a symb!li )ame.
0 !lUba(5r!u)'Ba(5r!u)'
# !lU*ea'i)5 <ea'ers
" !lU)!rmal 3ist e)tries
3 !lUt!tal 0!tals
4 !lU(eySey !lum)s
5 !lU&!siti+e P!siti+e t*res*!l' +alue
6 !lU)e5ati+e Ne5ati+e t*res*!l' +alue
A !lU5r!u& C!)tr!l le+els
SAP &r!+i'es 5ui'eli)es $!r reati)5 lists i) !l!r. Please !)sult tra)sati!) LIBS $!r e6am&les.
.it* t*e *el& !$ !)e m!re &arameter !$ t*e WRITE stateme)t AS ICON - y!u a) use i!)s i)
y!ur list. 9!r t*is &ur&!se- y!u must i)lu'e t*e /)lu'e L3/S0M stateme)t i) y!ur &r!5ram.
@!u a) $i)' a) !+er+ie% !$ all a+ailable i!)s i) eit*er t*e (ey%!r' '!ume)tati!) u)'er WRITE-
!r i) t*e WRITE stateme)t struture.
>C? SAP AG BC400 #6
16.17
SAP AG 2001
PO

PAI

CALL SCREEN <""


+00 PO

PAI

Screen a!!r"bu!es
Screen nu%ber +00
#e't screen +00
Screen a!!r"bu!es
Screen nu%ber 200
#e't screen 200
200
0
200
0
8yna%ic Screen Se5uence
@!u a) use t*is te*)iBue t! &r!5ram lusters !$ sree)s %it* !m&liate' li)(s %it*!ut *a+i)5 t!
!)ti)ually retur) t! t*e s!ure !'e a)' all t*em usi)5 CA33 SCR11N.
>C? SAP AG BC400 #A
16.18
SAP AG 2001
9'ceptions $or Function (odules
Function %odule 9dit oto <tilities 9n"iron%ent Syste% :elp
2&nction B&i%/er( 'isp%ay BC402124''17ET12REE1SEATS
Function 2odule BC402_F!!_%&$_F'&&_S&#$S Active
tables Changing 1xport
Function 2odule docu2entation
I2port Attributes
1xception Short text
Freight carrier
Source code 1xceptions
")#S1ATS
overboo.ed )=1%L)AD
RAISE 2e1.ep#"on30
222 .#t& 4e+a)lt messa(e:
MESSAGE 29"nd32n-m3A2"d3C
RAISING 2e1.ep#"on30
no data D8#FAIL*%1
@!u a) *a+e a $u)ti!) m!'ule tri55er a %ase ("ceptons.
9!r t*is &ur&!se- y!u must $irst defne e6e&ti!)s i) t*e i)ter$ae 'e$i)iti!)- t*at is- y!u must
'e$i)e 'isti)5uis*able dentfers $!r y!ur e6e&ti!)s.
/) t*e s!ure !'e- y!u &r!5ram t*e trggerng !$ a) e6e&ti!) u)'er t*e reBuire'
!)'iti!)s. At ru)time- t*e $u)ti!) m!'ule e6euti!) is i)terru&te' i$ a) e6e&ti!) *as
bee) tri55ere'. C*a)5es t! E1po# a)' C(an'"n' &arameters *a+e t*e same e$$et as
%it* subr!uti)e alls. 0*ere are t%! stateme)t +aria)ts. <ere- e6e&ti!) sta)'s $!r
a) e6e&ti!) y!u *a+e 'elare'- t*at is- $!r t*e dentfer. De&e)'i)5 u&!) %*et*er t*e e6e&ti!)
is arrie' !ut %*e) t*e $u)ti!) m!'ule is alle'- t*e stateme)ts a) *a+e 'i$$ere)t e$$ets.
RAISE 2e1.ep#"on3
/$ t*e e6e&ti!) is e6eute' i) t*e alli)5 &r!5ram- !)tr!l is &asse' ba( t! t*e same. Ot*er%ise a
ru)time err!r !urs.
MESSAGE 29"nd32n-m3A2"d3C RAISING 2e1.ep#"on3
/$ t*e e6e&ti!) is liste' i) t*e alli)5 &r!5ram- t*is stateme)t !rres&!)'s t! t*e $irst +aria)t. /$ t*e
e6e&ti!) is )!t e6eute'- t*e system 'is&lays a messa5e n-m !$ messa5e lass "d %it* be*a+i!r
9"nd% 0*ere$!re- a ru)time err!r '!es not !ur i) t*is situati!).
>C? SAP AG BC400 #8
16.19
SAP AG 2001
2ogical 8atabases
Progra% Types
Progra% Types
8ata Types0 8ata 7b6ects0 and State%ents
8ata Types0 8ata 7b6ects0 and State%ents
2ogical 8atabases
2ogical 8atabases
Pre"ie&
Pre"ie&
>C? SAP AG BC400 #8
16.20
SAP AG 2001
SPF24
9'a%ple: 2ogical 8atabase F+S
SF24:T
SB77E
-eading 2ogically 8ependent 8ata
@!u a) use easy:t!:use rea' &r!5rams >l!5ial 'atabases? t! rea' l!5ially !))ete' 'ata. 1a*
l!5ial 'atabase *as a struture !)tai)i)5 a *ierar*y !$ t*!se tables a)' +ie%s t*at are t! be rea'.
@!u a) atta* e6atly one l!5ial 'atabase t! ea* ty&e # &r!5ram. 0*e l!5ial 'atabase t*e)
su&&lies y!ur &r!5ram %it* e)tries $r!m tables a)' +ie%s. 0*is mea)s t*at y!u )ee' t! &r!5ram t*e
'ata &r!essi)5 stateme)ts !)ly.
>C? SAP AG BC400 "0
16.21
SAP AG 2001
Aou can attach a logical database to each type + progra%
using the progra% attributes!
Special e"ent blocks are also a"ailable $or processing
indi"idual records!
Aou can attach a logical database to each type + progra%
using the progra% attributes!
Special e"ent blocks are also a"ailable $or processing
indi"idual records!
2ogical 8atabases
Special data collection progra%s deli"ered by SAP
Pro"ide your progra% &ith data in a hierarchically logical
se5uence
Contain data base accesses that ha"e been opti%i;ed $or
per$or%ance
Supply a dyna%ic selection screen
Contain all necessary authori;ation checks
1a* l!5ial 'atabase is a) e)a&sulate' 'ata !lleti!) &r!5ram $!r $reBue)t 'atabase aess.
Database aess *as bee) !&timiCe' usi)5 O&e) S43.
/$ y!u are %!r(i)5 %it* a l!5ial 'atabase- y!u '! )!t )ee' a seleti!) sree) $!r user e)try- beause
it is reate' aut!matially.
0*e system &er$!rms aut*!riCati!) *e(s a!r'i)5 t! t*e SAP aut*!riCati!) !)e&t.
>C? SAP AG BC400 "#
16.22
SAP AG 2001
Progra%
NODES s+l#(&t0
GET s+l#(&t 000
:
SPF24
SF24:T
SB77E
8ata $ro%
the 28B
Controlling an 28B $ro% Within a Progra%
0*e NODES Kno4eL stateme)t &er$!rms t%! $u)ti!)sE
/t 'e$i)es a 'ata !bGet >a struture? as a table %!r( area t*at *as t*e same struture as t*e 'atabase
table. 0*is struture is t*e) $ille' at ru) time %it* all t*e 'ata re!r's t*at t*e l!5ial 'atabase *as
rea' $r!m t*e 'atabase a)' ma'e a+ailable t! t*e &r!5ram.
/t !)tr!ls t*e e6eutability !$ t*e seleti!) sree). 0*e seleti!) sree) %as 'e$i)e' i) t*e l!5ial
'atabase s*!ul' !)tai) !)ly t*!se (ey i)$!rmati!) i)&ut $iel's t*at t*e &r!5ram )ee's. 0*e
NODES stateme)t all!%s y!u t! e)sure t*at !)ly i)$!rmati!) $r!m rele+a)t tables is a+ailable t!
t*e l!5ial 'atabase.
3!5ial 'atabases rea' a!r'i)5 t! t*eir struture- t*at is- $r!m t!& t! b!tt!m. 0*e depth !$ 'ata
rea' 'e&e)'s !) a &r!5ramIs GET stateme)ts. 0*e 'ee&est G10 stateme)t $r!m t*e strutural +ie% !$
t*e l!5ial 'atabase 'etermi)es t*e le+el.
>C? SAP AG BC400 ""
16.23
SAP AG 2001
Progra%
ABAP
runti%e
syste%
START1OF1SELECTION0
Basic list
GET sp+l#0
GET s+l#(&t0
END1OF1SELECTION0
NODES: SPFLI6
SFLIGHT0
2ogical
database
SPF24
SF24:T
SB77E
9"ent Blocks in 2ogical 8atabases
@!u a) i)lu'e a l!5ial 'atabase i) e+ery e6eutable &r!5ram >ty&e #? usi)5 t*e &r!5ram
attributes.
1a* )!'e i) t*e *ierar*y !$ t*e l!5ial 'atabase als! &r!+i'es y!u %it* a G10 e+e)t bl!( i)
a''iti!) t! t*e !t*er e+e)t bl!(s >G10 SP93/- G10 S93/G<0- a)' G10 SBOOS i) t*e e6am&le i)
t*e 5ra&*i?.
@!u a) &r!5ram i)'i+i'ual re!r' &r!essi)5 usi)5 t*ese G10 e+e)t bl!(s.
At ru) time- t*e e+e)t bl!(s t*at reate lists are &r!esse' i) t*e $!ll!%i)5 !r'erE
S0AR0:O9:S131C0/ON.
G10 SP93/ a)' G10 S93/G<0 are alle' se+eral times i) )este' S131C0 l!5i a!r'i)5 t! t*e
struture !$ t*e l!5ial 'atabase.
1ND:O9:S131C0/ON is alle' a$ter all G10 e+e)ts- a)' imme'iately be$!re t*e list is se)t t! t*e
&rese)tati!) ser+er
>C? SAP AG BC400 "3
16.24
SAP AG 2001
STA-T=7F=S929CT47#
9T SPF24
9T SF24:T
9T SF24:T
9T SPF24 2AT9
9T SPF24
9#8=7F=S929CT47#
82 +*//
2)!0H!+//H
21!0/!+//H
82 +/H4
9T SF24:T
9T SF24:T
9T SPF24 2AT9
2)!0H!+//H
21!0/!+//H
9T SF24:T 2/!0/!+//H
REPORT ,$!""4/lo(#$al/4ata,ase0
NODES: sp+l#6 s+l#(&t0
START1OF1SELECTION0
3RITE: * 9START1OF1SELECTION9
$olo% B0
GET sp+l# FIELDS $a%%#4 $onn#40
3RITE: * 9GET SPFLI9 $olo% <6
sp+l#1$a%%#46
sp+l#1$onn#40
GET s+l#(&t FIELDS +l4ate0
3RITE: * 9GET SFLIGHT9 $olo% D6
s+l#(&t1+l4ate0
GET sp+l# LATE0
3RITE :* 9GET SPFLI LATE90
END1OF1SELECTION0
3RITE: 9END1OF1SELECTION9
$olo% B0
Synta' 9'a%ple: 9"ent Se5uence
9T sp$li
9T s$light
9T sp$li 2AT9!
At ru) time- t*e e+e)t bl!(s t*at reate lists are &r!esse' i) t*e $!ll!%i)5 !r'erE
S0AR0:O9:S131C0/ON.
G10 s&$liE 0*e $irst 'ata re!r' $r!m 'atabase table SP93/ t*at !rres&!)'s t! t*e seleti!)
riteria is &lae' i) %!r( area s&$li a)' t*e e+e)t bl!( is &r!esse'.
G10 s$li5*tE 0*e $irst 'ata re!r' $r!m S93/G<0 t*at !rres&!)'s t! t*e seleti!) riteria as %ell
as t! t*e (ey !$ t*e urre)t SP93/ re!r' are &lae' i) %!r( area s$li5*t a)' t*e e+e)t bl!( is
&r!esse'.
G10 s$li5*tE 0*e )e6t 'ata re!r' $r!m 'atabase table S93/G<0 is &lae' i)t! %!r( area s$li5*t
a)' t*e e+e)t bl!( is &r!esse' a5ai).
G10 s$li5*tE 0*is is alle' a5ai) u)til )! $urt*er !rres&!)'i)5 'ata re!r's are $!u)'.
G10 s&$li 3A01 is alle' be$!re t*e )e6t 'ata re!r' $r!m SP93/ is &lae' i)t! %!r( area s&$li.
G10 s&$liE 0*e l!5ial 'atabase &laes t*e )e6t !rres&!)'i)5 'ata re!r' $r!m SP93/ i) %!r(
area s&$li.
1ND:O9:S131C0/ON is alle' imme'iately be$!re t*e list is 'is&laye'.
>C? SAP AG BC400 "4
16.25
SAP AG 2001
ABAP: ABAP: Progra% attributes Progra% attributes
2ogical 8atabase
Application S
F+S
Type +
NODES :sp+l#6 s+l#(&t0
START1OF1SELECTION0
3RITE: * 9START1OF1SELECTION9
$olo% B0
GET sp+l# FIELDS $a%%#4 $onn#40
3RITE: * 9GET SPFLI9 $olo% <6
sp+l#1$a%%#46
sp+l#1$onn#40
GET s+l#(&t FIELDS +l4ate0
3RITE: * 9GET SFLIGHT9 $olo% D6
s+l#(&t1+l4ate0
GET sp+l# LATE0
3RITE :* 9GET SPFLI LATE90
END1OF1SELECTION0
3RITE: 9END1OF1SELECTION9
$olo% B0
SPF24 SPF24
SF24:T SF24:T
SB77E SB77E
Attributes
Su%%ary
GET sp+l#
GET s+l#(&t
GET sp+l# LATE0
#789S
3!5ial 'atabases are i)lu'e' i) ty&e # &r!5rams as &r!5ram attributes. O)ly !)e l!5ial 'atabase
a) be use' $!r ea* &r!5ram.
@!u a) su&&ly a l!5ial 'atabase %it* t*e i)$!rmati!) re5ar'i)5 %*i* $iel's y!u )ee' $r!m t*e
'atabase usi)5 t*e G10 a''iti!) 9/13DS. /$ t*e l!5ial 'atabase su&&!rts t*is ati!)- it %ill rea'
$r!m t*e 'atabase !)ly t*!se $iel's y!u reBuire.
/$- $!r y!ur list- y!u )ee' 'atabase table 'ata t*at is )!t su&&lie' by y!ur l!5ial 'atabase- y!u a)
&r!5ram a)y a''iti!)al 'atabase aess )ee'e' usi)5 S131C0.
>C? SAP AG BC400 "5
16.26
SAP AG 2001
Pre"ie&
Progra% Types
Progra% Types
8ata Types0 8ata 7b6ects0 and State%ents
8ata Types0 8ata 7b6ects0 and State%ents
2ogical 8atabases
2ogical 8atabases
Pre"ie&
Pre"ie&
>C? SAP AG BC400 "6
16.27
SAP AG 2001
Se5uential
Files
SAP
4nter$aces >
Checks






9'ternal
Ser"er
9'ternal 8ata Trans$er 4
.*e) y!u tra)s$er 'ata $r!m a)!t*er SAP !r e6ter)al system t! y!ur !%) SAP system- it is
im&!rta)t t! e)sure 'ata i)te5rity.
0*us- it is )eessary t! subGet t*is ty&e !$ 'ata tra)s$er t! t*e same *e(s as 'ata tra)s$er i) 'ial!5
m!'e.
Si)e 'ial!5 m!'e *e(s i) tra)sati!)s are !m&re*e)si+e a)'- i) &art- '!)e !) a r!ss:a&&liati!)
basis- it is e6tremely 'i$$iult t! &r!5ram t*em y!ursel$.
0*ere$!re- it is mu* easier t! use t*e !)li)e *e(s &r!+i'e' $!r SAP tra)sati!)s beause t*ese
SAP tra)sati!)s are use' als! $!r t*e 'ata tra)s$er.
0*e te*)iBues use' $!r e6ter)al 'ata tra)s$er are alle' batch-nput processes.
SAP !$$ers sta)'ar'iCe' &r!e'ures $!r e6ter)al 'ata tra)s$er $!r ma)y areas %it*i) R/3. 0*ese
&r!e'ures use t*ese &r!5rammi)5 te*)iBuesE bat* i)&ut- all tra)sati!)- a)' 'iret i)&ut. 0*e
SAP sta)'ar' 'ata tra)s$er &r!e'ures are alle' usi)5 t*e 3ata Transfer Workbench >tra)sati!)
S2DA?. /$ )! SAP 'ata tra)s$er &r!e'ures are a+ailable- tra)s$er a) be &r!5ramme' i)'i+i'ually
usi)5 bat* i)&ut !r all tra)sati!).
>C? SAP AG BC400 "A
16.28
SAP AG 2001
Se5uential
$ile
Fueue $ile
SAP
database
Application $unction
Application $unction
Batch input $unction
Batch input $unction
B8C table
B8C B8C table table
BATC: 4#P<T: BATC: 4#P<T:
Se5uential
$ile
SAP
database
Application $unction
Application $unction
B8C table
B8C B8C table table
CA22 T-A#SACT47#: CA22 T-A#SACT47#:
CA22
T-A#SACT47#
Se5uential
$ile
SAP
database
84-9CT 4#P<T: 84-9CT 4#P<T:
SAP
trans$er
progra%
9'ternal 8ata Trans$er 44
>C? SAP AG BC400 "8
16.29
SAP AG 2001
<pdate process
UPDATE UPDATE INSERT INSERT DELETE DELETE
8ialog process
2og 2og
table table
8929T9 re5!
<P8AT9 re5!
4#S9-T re5!
8atabase process
PB7 PA4 PB7 PA4 PA4 PB7
INSERT
ReI)est
UPDATE
ReI)est
DELETE
ReI)est
C7((4T W7-E C7((4T W7-E
<pdate
A)!t*er %ay !$ bu)'li)5 'atabase *a)5es at t*e e)' !$ a) SAP 3;. is t! use t*e u&'ate te*)iBue.
<ere- y!u '! )!t &ass u&'ates 'iretly t! t*e 'atabase- but e)ter t*em as u&'ate reBuests i) a l!5
table i)stea'.
;si)5 t*e ABAP stateme)t COMMIT WORK- y!u e)' SAP 3;. i) 'ial!5 m!'e. 0*e SAP system
t*e) tri55ers a s&eial %!r( &r!ess alle' a) u&'ate %!r( &r!ess t*at- base' u&!) y!ur l!5 e)tries-
e6eutes t*e atual *a)5es t! t*e 'atabase %it*i) a 'atabase tra)sati!). 0*e SAP 3;. e)'s !)ly
%*e) t*e u&'ate &r!ess *as $i)is*e'.
0*e &r!5ram &art i) t*e 'ial!5 a)' u&'ate &r!ess a) ru) eit*er sy)*r!)!usly !r asy)*r!)!usly.
0*e a'+a)ta5e !$ u&'ate i) !)trast t! bu)'li)5 usi)5 subr!uti)es is t*at y!u a) st!re t*e 'ata $!r
t*e 'atabase *a)5e i) t*e l!5 table at a)y time a)' '! )!t *a+e t! (ee& it i) t*e &r!5ram %!r( area.
/ts 'isa'+a)ta5e lies i) t*e e$$!rt reBuire' $!r a''iti!)al l!55i)5.
;se asy)*r!)!us u&'ate %*e) res&!)se times are im&!rta)t a)' t*e 'atabase u&'ates are
!m&liate' e)!u5* t*at t*ey Gusti$y t*e e6tra %!r( i)+!l+e' i) usi)5 t*e l!5 table.
;se sy)*r!)!us u&'ate %*e)e+er y!u )ee' t*e *a)5e' 'ata imme'iately a)' %*e) t*e 'atabase
u&'ates are !m&liate' e)!u5* t! Gusti$y t*e e6tra %!r( i)+!l+e' i) usi)5 t*e l!5 table.
>C? SAP AG BC400 "8