Unit 4 - Basic ABAP statements, ABAP Structures and ABAP Logical Expressions
Syntaxes & Statements in ABAP
-
Upload
abid-sheik -
Category
Documents
-
view
234 -
download
1
Transcript of Syntaxes & Statements in ABAP
-
8/14/2019 Syntaxes & Statements in ABAP
1/97
A
ADD for single fields
Adds two single fields.
Syntax
ADD TO .
The contents of are added to the contents of and the resultsare stored in . This is equivalent to: = + .
ADD for field sequences
Adds sequences of fields in storage.
Syntax
ADD THEN !NT"# %"&"N% .
ADD THEN !NT"# A''O(D"N% TO %"&"N% .
ADD THEN !NT"# TO .
ADD )(O* TO %"&"N% .
If , ,..., is a sequence of fields with the same distanceto one another and if the" have the same t"#e and length, these fieldsare added and the result is stored in . $ifferent variants allow "outo limit fields to a su%sequence, to include in the sum, and to#erform the o#eration on a sequence of fields that directl" follow oneanother.
ADD+'O((ES,OND"N%
Adds su%fields of structures.
-
8/14/2019 Syntaxes & Statements in ABAP
2/97
Syntax
ADD+'O((ES,OND"N% TO .
All the su%fields of the structures and having the
same name are added and the results are stored in .
A#"ASES
$efines class&s#ecific alias names for an interface com#onent in A'A(o%)ects.
Syntax
A#"ASES )O( .
is defined within a class or interface as s"non"mous with theinterface com#onent .
A,,END
A##ends a line or multi#le lines to the end of an inde ta%le.
Syntax
A((-$ /I-0 2 T 3A00I4-I-4 525-6 I-T 7.
A line or multi#le lines of an internal ta%le area##ended to inde ta%le . If "ou use A00I4-I-4 or I-T525-6, field s"m%ol refers to the a##ended line or therelevant data reference is stored in after the statement.
ASS"%N
Assigns a field to a field s"m%ol.
Syntax
-
8/14/2019 Syntaxes & Statements in ABAP
3/97
ASS"%N /"N'(E*ENT 0 TO /'AST"N% /T,E 2#"3E 0 /DE'"*A#S 00
/(AN%E 0.
$ata o%)ect is assigned to field s"m%ol . now #oints to
the data o%)ect. After the addition I-658-T , the storage areathat is offset times %" a length of starting with isassigned to the field s"m%ol. (ointed %rac9ets are #art of the s"ntafor field s"m%ol names. The 6A0TI-4 addition #ermits "ou to cast datao%)ects when assigning field s"m%ols. The 5A-4 addition defines thestorage area in which either offsetlength accesses or the I-658-Taddition are allowed. In ;nicode #rograms, standard access is onl"allowed within the field limits of , %ut this can %e etended with5A-4. In non&;nicode #rograms, standard access is #ossi%le u# tothe %oundar" of the data segment and can %e limited with 5A-4.
Syntax
ASS"%N +>4 TO /'AST"N% ... 0.
$ereferencing of the data reference in . The data o%)ect towhich the data reference refers is assigned to field s"m%ol .
AT for e5ent 6loc7s
vent 9e"words for defining event %loc9s for screen events.
Syntax
AT SE#E'T"ON+S'(EEN...
AT #"NE+SE#E'T"ON.
AT !SE(+'O**AND.
AT ,)n.
;ser actions on a selection screen or on a list trigger certain events inthe A'A( runtime environment. The event 9e"words define event%loc9s that are called when events occur.
-
8/14/2019 Syntaxes & Statements in ABAP
4/97
AT for grou c8ange
6hange of grou# when #rocessing loo#s of etracts and internal ta%les.
Syntax
AT NE9 .
AT END O) .
AT )"(ST.
AT #AST.
AT .
The statements are used to #rocess grou# levels within a loo# using anetract dataset or an internal ta%le. The" introduce statement %loc9sthat must %e closed with -$AT. The statements %etween AT and-$AT are onl" eecuted if the corres#onding grou# change occurred.
A!THO("T+'HE'3
6hec9s user authori!ation.
Syntax
A!THO("T+'HE'3 O:;E'T "D )"E#D "D )"E#D ...
"D )"E#D .
There is a chec9 if the #rogram user has all the authori!ations definedin authori!ation o%)ect . ,..., are theauthori!ation fields of the authori!ation o%)ect. ,... , ..., are data o%)ects of the #rogram. The value of the data o%)ects ischec9ed against the authori!ation fields.
-
8/14/2019 Syntaxes & Statements in ABAP
5/97
:
:A'3
5elative #osition of the out#ut in a list.
Syntax
:A'3.
(ositions the list out#ut either in the first column of the first linefollowing the #age header of the current #age or in connection with505 in the first column of the first line of a line %loc9.
:(EA3+,O"NT
6alls the $e%ugger.
Syntax
:(EA3+,O"NT.
Interru#ts eecution of the #rogram and goes to de%ugging mode. Is
used as a test hel#. -ormal #rogram #rocessing is interru#ted whenthis statement is reached and the s"stem goes to a de%ugger.
'
'A## '!STO*E(+)!N'T"ON
6alls the customer function modules.
Syntax
'A## '!STO*E(+)!N'T"ON ...
-
8/14/2019 Syntaxes & Statements in ABAP
6/97
0imilar to 6A// 2;-6TI-. The function modules must %e #rogrammedand activated within the customers modification conce#t.
'A## )!N'T"ON
6alls the function modules.
Syntax
6A// 2;-6TI- 3?(5TI-4 ... fi= a i... 73I8(5TI-4 ... fi= a i... 736@A-4I-4 ... fi= a i... 73TA'/0 ... fi= a i... 73?6(TI-0... ei= r i... 7
3$0TI-ATI- 7 3I- ;($AT TA07 30TA5TI-4 -B TA07 3I- 'A64;-$ TA07.
The #rogram calls either a function module in the same 5C 0"stem, orone from an eternal s"stem, de#ending on the variant of thestatement "ou use. Dou can call u#date modules when #rocessingtransactions. Dou can also call functions as"nchronousl". The otheradditions are used to s#ecif" actual #arameters for the #arameterinterface for the function module, , and to handle ece#tions.
'A## D"A#O%
6alls a dialog module.
Syntax
6A// $IA/4 3A-$ 0I( 2I50T 065-7
3?(5TI-4... fi= a i... 73I8(5TI-4... fi= a i... 73;0I-4 ita%7.
6alls the dialog module . A dialog module is an A'A( #rogramwith a sequence of screens. It does not have to %e started using atransaction code, or run in the same 0A( /;B, li9e the calling #rogram.The additions are used to s9i# the initial screen in the sequence and
-
8/14/2019 Syntaxes & Statements in ABAP
7/97
s#ecif" actual #arameters for the #arameter interface of the dialogmodule.
'A## *ETHOD
6alls a method in A'A( %)ects.
Syntax
6A// 8T@$ 3?(5TI-4 ... =.... 73I8(5TI-4 ... =.... 736@A-4I-4 ... =.... 7356II-4 r = h 7
3?6(TI-0... = r i... 7
3(A5A8T5&TA'/ 7 3?6(TI-&TA'/ 7.
36A// 8T@$7E ... F.
6alls a method . The additions are used to s#ecif" actual#arameters for the #arameter interface for the function module and tohandle ece#tions. The last two additions #ass #arameters d"namicall"in a d"namic method call. Alternativel", if the method is calledstaticall", the #arameters can %e s#ecified using #arenthesis notationEas "ou can when s#ecif"ing #arameters in a 6A// 8T@$
statementF. Dou can also use functional methods with this s"nta ino#erand #ositions.
'A## *ETHOD O)
6alls a method in / Automation.
Syntax
'A## *ETHOD O) .
6alls the method, , of the / Automation %)ect, .
'A## S'(EEN
-
8/14/2019 Syntaxes & Statements in ABAP
8/97
6alls a screen sequence.
Syntax
'A## S'(EEN
/STA(T"N% AT 0 /END"N% AT 0.
6alls the sequence of screens that %egins with the screen . Allthe screens in the screen sequence %elong to the current A'A(#rogram. The screen sequence ends when the #rogram reaches thescreen num%ered . The additions let "ou call a single screen in a newwindow.
'A## SE#E'T"ON+S'(EEN
6alls a selection screen.
Syntax
'A## SE#E'T"ON+S'(EEN /STA(T"N% AT 0
/END"N% AT 0.
6alls a selection screen defined in an A'A( #rogram. The selectionscreen is #rocessed in the #rogram in the AT 0/6TI-&065-event. The additions let "ou call a selection screen in a new window.
'A## T(ANSA'T"ON
6all a transaction.
Syntax
'A## T(ANSA'T"ON /AND S3", )"(ST S'(EEN0
/!S"N% 0.
6alls the transaction after having received data from thecalling #rogram. At the end of the transaction that has %een called, thes"stem returns to the statement following the call in the calling re#ort.The additions are used to s9i# the initial screen in the sequence or to#ass a %atch in#ut ta%le to the transaction.
-
8/14/2019 Syntaxes & Statements in ABAP
9/97
'ASE
6onditional %ranch.
Syntax
'ASE .
#ens a 6A0 control structure that ends with an -$6A0 statement.The 6A0 control structure allows "ou to control which statement%loc9s Eintroduced %" B@-F are #rocessed, %ased on the contents ofa data o%)ect.
'AT'H
6atches a class&%ased ece#tion.
'AT'H ... /"NTO 0.
Dou can onl" use this statement in a T5D&-$T5D %loc9, where "oudefine a handler for one or more class&%ased ece#tions. Dou can useI-T to #lace a reference to the ece#tion o%)ect into the referencevaria%le .
'AT'H SSTE*+E'E,T"ONS
6atches a catcha%le runtime error.
Syntax
'AT'H SSTE*+E'E,T"ONS ? ... ? .
Introduces a 6AT6@ area, which ends with an -$6AT6@ statement. Ifa catcha%le runtime error , occurs %etween 6AT6@ and-$6AT6@, the current #rocessing %loc9 is interru#ted. The s"stem)um#s to the a##ro#riate -$6AT6@ statement and fills 0D&0;'56 with.
-
8/14/2019 Syntaxes & Statements in ABAP
10/97
'HE'3
6onditionall" leaves a loo# or #rocessing %loc9.
Syntax
'HE'3 .
If the logical e#ression is true, the s"stem continues withthe net statement. If it is false, #rocessing within the loo# isinterru#ted at the current loo# #ass, and the net loo# #ass is#erformed. therwise the s"stem leaves the current #rocessing %loc9.In con)unction with selection ta%les, and inside 4T events, "ou canuse an etra variant of the 6@6 statement.
'#ASS Declaration
$eclares a class in A'A( %)ects.
Syntax
'#ASS DE)"N"T"ON /,!:#"'0 /"NHE("T"N% )(O* 0 /A:ST(A'T0
/)"NA#0 /'(EATE ,!:#"'2,(OTE'TED2,("&ATE0 /)("ENDS ...0
/DE)E((ED0 /#OAD0.
Introduces the declaration #art of a class, . The declaration#art ends with -$6/A00 and contains the declaration of all thecom#onents of the class. The (;'/I6 addition is generated onl" %" the6lass 'uilder. It defines a glo%al class in the 6lass /i%rar". TheI-@5ITI-4 258 addition lets "ou derive the class, , from a
su#erclass, . The A'0T5A6T addition defines an a%stractclass, which cannot %e instantiated. The 2I-A/ addition defines a classthat cannot have an" su%classes. The 65AT addition s#ecifies whocan instantiate the class. 25I-$0 allows "ou to s#ecif" other classesor interfaces, that can access the #rivate com#onents of theclass and instantiate o%)ects of the class, inde#endentl" of the 65ATaddition. The $255$ addition ma9es the class 9nown to the
-
8/14/2019 Syntaxes & Statements in ABAP
11/97
#rogram %efore it is declared. The /A$ addition loads a classe#licitl" from the 6lass /i%rar".
'#ASS @ "mlementation
Im#lements a class in A'A( %)ects.
Syntax
'#ASS "*,#E*ENTAT"ON.
Introduces the im#lementation #art of a class, . Theim#lementation #art ends with -$6/A00 and contains theim#lementation of all the com#onents of the class.
'#ASS+DATA
$eclares static attri%utes of a class or interface.
Syntax
'#ASS+DATA ...
/i9e $ATA. @owever, the attri%ute is declared as a static attri%ute.0tatic attri%utes are not instance&s#ecific. Their content is shared %" allinstances.
'#ASS+*ETHODS
$eclares static methods of a class or interface.
Syntax
'#ASS+*ETHODS ...
/i9e 8T@$0, ece#t that the method is declared as a staticmethod. A static method can access static attri%utes and can onl"trigger static events.
-
8/14/2019 Syntaxes & Statements in ABAP
12/97
'#ASS+E&ENTS
$eclares static events of a class or interface.
Syntax
'#ASS+E&ENTS ...
/i9e -T0, ece#t that the event is declared as a staticattri%ute. 0tatic events are the onl" t"#e of event that can %e triggeredin a static method.
'#EAN!,
Tidies u# after class&%ased ece#tions.
'#EAN!,.
6an onl" %e used within a T5D&-$T5D %loc9, where it defines acontrol %loc9. If a class&%ased ece#tion is not caught with a 6AT6@statement, the s"stem eecutes the statements %etween 6/A-;( and-$T5D, %efore #assing the ece#tion along the call hierarch".
'#EA(
0ets a varia%le to its initial value.
Syntax
'#EA( .
The varia%le , which can have an" data t"#e, is set to an initialvalue a##ro#riate to its t"#e.
'#OSE DATASET
-
8/14/2019 Syntaxes & Statements in ABAP
13/97
6loses a file.
Syntax
'#OSE DATASET .
6loses a file o#ened with (- $ATA0T on the a##lication server.
'#OSE '!(SO(
6loses a data%ase cursor.
Syntax
'#OSE '!(SO( .
6loses a cursor o#ened with (- 6;505.
'O##E'T
Aggregates lines and then adds them to an internal ta%le.
Syntax
6//6T I-T 3A00I4-I-4 525-6 I-T 7.
The s"stem chec9s whether there is alread" a ta%le entr" that matchesthe 9e". If there is no corres#onding entr" alread" in the ta%le, the6//6T statement has the same effect as I-05T. If an entr" with thesame 9e" alread" eists, the 6//6T statement does not a##end anew line, %ut adds the contents of the numeric fields in the wor9 area to the contents of the fields in the eisting entr". If "ou use
A00I4-I-4 or I-T 525-6, field s"m%ol refers to theinserted line or the relevant data reference is stored in afterthe statement.
'O**"T
-
8/14/2019 Syntaxes & Statements in ABAP
14/97
6loses a 0A( /;B.
Syntax
'O**"T 9O(3 /AND 9A"T0
Brites all the data%ase changes and releases all the data%ase loc9s.Triggers u#dating. The A-$ BAIT addition forces the #rogram to waituntil the s"stem has finished u#dating the data%ase. therwise,u#dating is as"nchronous.
'O**!N"'AT"ON
na%les two #rograms to communicate with each other.
Syntax
'O**!N"'AT"ON "N"T DEST"NAT"ON "D /additions0.
'O**!N"'AT"ON A##O'ATE "D /additions0.
'O**!N"'AT"ON A''E,T "D /additions0.
'O**!N"'AT"ON SEND "D :!))E( /additions0.
'O**!N"'AT"ON (E'E"&E "D /additions0.
'O**!N"'AT"ON DEA##O'ATE "D /additions0.
The statement initiali!es, creates, and acce#ts communication%etween two #rogramsG lets these two #rograms send and receivedataG and then closes the connection.
'O*,!TE
(erforms numeric o#erations.
Syntax
'O*,!TE ? .
-
8/14/2019 Syntaxes & Statements in ABAP
15/97
The result of the mathematical o#eration s#ecified in isassigned to the field . The 9e"word 68(;T is o#tional.
'ON'ATENATE
6oncatenates EchainsF several strings to a string.
Syntax
'ON'ATENATE ... "NTO / SE,A(ATED : 0/"N :TE *ODE2"N 'HA(A'TE( *ODE0.
This statement concatenates the strings to and assignsthe result to . The addition 0(A5AT$ 'D allows "ou to
s#ecif" a character field which is #laced in its defined length%etween the individual fields. In ;nicode #rograms, "ou must s#ecif"whether the statement is a character or %"te o#eration, using the I-'DT 8$ or I- 6@A5A6T5 8$ EdefaultF additions.
'ONDENSE
5emoves s#aces from a string
Syntax
'ONDENSE /NO+%A,S0.
This statement removes an" leading %lan9s from the field andre#laces other sequences of %lan9s %" eactl" one %lan9. If theaddition -&4A(0 is s#ecified, all %lan9s are removed.
'ONSTANTS$eclares constant data o%)ects.
Syntax
'ONSTANTS ... &A#!E / 2 "S "N"T"A#0...
-
8/14/2019 Syntaxes & Statements in ABAP
16/97
The s"nta is similar to $ATA, ece#t that the A/; addition isrequired, and that internal ta%les and dee# structures cannot %edeclared as constants The start value s#ecified in the A/; additioncannot %e changed during the eecution of the #rogram.
'ONT"N!E
nds a loo# #ass.
Syntax
'ONT"N!E.
nl" #ossi%le within loo#s. This statement terminates the current loo#
#ass and starts the net
'ONTETS
$eclares a contet.
Syntax
6-T?T0 .
4enerates an im#licit data t"#e 6-T?TH, which "ou can use tocreate contet instances
'ONT(O#S
$efines a control.
Syntax
'ONT(O#S T,E .
$efines an A'A( runtime o%)ect . This dis#la"s data in a#articular format on a screen, de#ending on the t"#e
-
8/14/2019 Syntaxes & Statements in ABAP
17/97
'ON&E(T fBr Dates
6onverts a data into an inverted date form.
Syntax
'ON&E(T DATE "NTO "N&E(TED+DATE .
'ON&E(T "N&E(TED+DATE "NTO DATE .
If and are date fields in the internal form DDDD88$$, thenines com#lement of is #laced in field and vice versa. Ininverted date format, the most recent date has the smaller numericalvalue
'ON&E(T for Timestams
6onverts a timestam# into the correct date and time for the currenttime !one
Syntax
'ON&E(T T"*E STA*, T"*E CONE "NTO DATE T"*E .
'ON&E(T DATE T"*E "NTO T"*E STA*, T"*ECONE .
As long as has t"#e (EF or (E11F with J decimal #laced, and has t"#e 6EKF, the time stam# will %e converted to thecorrect date and time for the time !one .
'ON&E(T for Text
6onverts a tet into a format that can %e sorted al#ha%eticall".
Syntax
'ON&E(T TET "NTO SO(TA:#E 'ODE .
-
8/14/2019 Syntaxes & Statements in ABAP
18/97
must have t"#e 6 and must have t"#e ?. The string isthen converted so that the relative order of the characters allows themto %e sorted al#ha%eticall" in the current tet environment
'(EATE DATA
6reates a d"namic data o%)ect.
Syntax
65AT $ATA TD( .
65AT $ATA TD( TD(/I 2 .
If is a data reference varia%le, a data o%)ect of the s#ecifiedt"#e is created. The reference in #oints to this o%)ect. Dou canomit the TD( declaration in full"&t"#ed reference varia%les.
'(EATE O:;E'T in A:A, O6ects
Instantiates an o%)ect in A'A( %)ects.
Syntax
'(EATE O:;E'T /T,E 0 /E,O(T"N% ... ?.... 0.
must %e a reference varia%le, defined with reference to a class.
65AT 'L6T then creates an o%)ect of that class, to which thereference in then #oints The reference in #oints to thiso%)ect. If is a t"#ed class reference varia%le with reference to asu%class of , or if is an interface reference varia%le,whose interface is im#lemented in the class , "ou can s#ecif"the class of the instantiated o%)ect e#licitl" in a TD( addition, toesta%lish the d"namic t"#e of the reference varia%les. The ?(5TI-4
-
8/14/2019 Syntaxes & Statements in ABAP
19/97
addition s#ecifies the non&o#tional I8(5TI-4 #arameters of theinstance constructor of the class of the instantiated o%)ect.
'(EATE O:;E'T in O#E Automation
Instantiates an eternal o%)ect in / Automation.
Syntax
'(EATE O:;E'T .
If is a class assigned to an automation server, an initial o%)ect of this class is created
D
DATA it8 (eference to 3non Data Tyes
$eclares varia%les with a #reviousl"&declared data t"#e
Syntax
$ATA ... 3TD( or thesame data t"#e as another data o%)ect . The data t"#e
-
8/14/2019 Syntaxes & Statements in ABAP
20/97
$ATA 3EF7 TD( .
$eclares the varia%le as a data reference varia%le for a datao%)ect.
Syntax
$ATA: '4I- 2 , ...
-
8/14/2019 Syntaxes & Statements in ABAP
21/97
...,...
-$ 2 .
6om%ines the varia%les to form the structure . The
individual varia%les within a structure are addressed in the #rogramwith a h"#hen %etween the structure name and com#onent name asfollows: &.
Syntax
$ATA TD(/I 2 .
The varia%le is declared as an internal ta%le with the ta%le 9ind, line t"#e .
$eclares the varia%le as a 5A-40 ta%le. A 5A-40 ta%le has thesame data t"#e as a selection ta%le, %ut is not lin9ed to in#ut fields ona selection screen.
DATA statement for S8ared Data Areas
$eclares shared data areas in a #rogram.
Syntax
DATAF :E%"N O) 'O**ON ,A(T ... END O) 'O**ON ,A(T.
The varia%les are assigned to a data area , which can %edefined in more than one #rogram. These data areas use the samememor" addresses for all #rograms that are loaded into the sameinternal session.
DE)"NE
-
8/14/2019 Syntaxes & Statements in ABAP
22/97
$efines a macro.
Syntax
DE)"NE .
Introduces the definition of the macro . ach macro mustconsist of com#lete A'A( statement and %e concluded with the -$&2&$2I-ITI- statement.
DE#ETE for )iles
$eletes files on the a##lication server
Syntax
DE#ETE DATASET .
$eletes the file from the file s"stem of the a##lication server.
DE#ETE for Data6ase Ta6le Entries
$eletes entries from data%ase ta%les.
Syntax
DE#ETE )(O* 9HE(E .
All of the lines in the data%ase ta%le that satisf" the conditions in theB@5 clause are deleted.
Syntax
$/T 258 .
$/T 258 TA'/ .
This deletes the line that has the same #rimar" 9e" as the wor9 area, or deletes all the lines in the data%ase that have the same#rimar" 9e" as a line in the internal ta%le . The wor9 area
-
8/14/2019 Syntaxes & Statements in ABAP
23/97
or the lines of the internal ta%le must have at least the samelength as the wor9 area of the data%ase ta%le.
DE#ETE for 'luster Data6ases
$eletes data clusters from cluster data%ase ta%les.
Syntax
$/T 258 $ATA'A0 EF I$ from thecluster data%ase ta%le .
DE#ETE for t8e 'ross+Transaction Alication:uffer
$eletes data clusters from the cross&transaction a##lication %uffer.
Syntax
$/T 258 0@A5$ ';225 EF I$ stored in the cross&transaction a##lication %uffer for the ta%le.
DE#ETE for #ines from an "nternal Ta6le
$eletes lines from internal ta%les of an" t"#e.
Syntax
$/T TA'/ 258 .
$/T TA'/ BIT@ TA'/ D = ... = .
-
8/14/2019 Syntaxes & Statements in ABAP
24/97
$eletes using the ta%le 9e". All lines with the same 9e" are deleted.The 9e" values are ta9en either from a com#ati%le wor9 area ors#ecified e#licitl".
Syntax
$/T B@5 .
$eletes using conditions. $eletes all ta%le entries that satisf" thelogical e#ression . The logical condition can consist of morethan one com#arison. In each com#arison, the first o#erand must %e acom#onent of the line structure.
Syntax
$/T A$LA6-T $;(/I6AT -T5I0 258 368(A5I-4... 7.
$eletes ad)acent du#licate entries, either %" com#aring the 9e" fieldsor the com#arison fields s#ecified e#licitl" in the 68(A5I-4addition.
DE#ETE for #ines from "ndex Ta6les
$eletes entries from inde ta%les.
Syntax
$/T 3I-$? 7.
If "ou use the I-$? addition, the line with inde is deleted fromthe ta%le . Bithout the I-$? addition, "ou can onl" use thea%ove statement within a /(. In this case, "ou delete the currentline.
Syntax
$/T 3258 7 3T 7 3B@5 7.
The s"stem deletes all of the lines of whose inde lies %etween and and who meet the conditions s#ecified in theB@5 clause. If "ou do not s#ecif" a 258 addition, the s"stemdeletes lines from the first line onwards. If "ou do not s#ecif" a Taddition, the s"stem deletes lines u# to the last line. The logical
-
8/14/2019 Syntaxes & Statements in ABAP
25/97
condition can consist of more than one com#arison. In eachcom#arison, the first o#erand must %e a com#onent of the linestructure.
DE*AND
5etrieves values from a contet instance.
Syntax
$8A-$ = ... = 258 6-T?T 3800A40 I-T 7.
2ills the fields with the values from the contet instance
. Dou can handle these messages in "our #rograms %" using the800A40 addition.
DES'(":E D"STAN'E
4ets the distance %etween two fields.
Syntax
DES'(":E D"STAN'E :ET9EEN AND "NTO /"N:TE2'HA(A'TE( *ODE0.
Brites the num%er of %"tes %etween data o%)ects and intothe varia%le . The length of the first field in memor" is alwa"sincluded. In ;nicode #rograms, "ou must s#ecif" either the I- 'DT8$ or I- 6@A5A6T5 8$ addition. In non&;nicode #rograms, thedistance is returned in %"tes.
DES'(":E )"E#D
$escri%es the attri%utes of a field.
Syntax
-
8/14/2019 Syntaxes & Statements in ABAP
26/97
$065I' 2I/$ 3/-4T@ 3I- 'DT6@A5A6T5 8$773TD( 368(--T0 77
3;T(;T&/-4T@ 7 3$6I8A/0 7 3$IT 8A0 7 3@/(&I$ 7.
The attri%utes of the data o%)ect s#ecified %" the #arameters ofthe statement are written to the varia%les following the #arameters.Dou can use an" num%er of the additions in the same statement. In;nicode #rograms, "ou must s#ecif" either the I- 'DT 8$ or I-6@A5A6T5 8$ addition for /-4T@. In non&;nicode #rograms, thelength is returned in %"tes.
DES'(":E #"ST
$escri%es the attri%utes of a list.
Syntax
DES'(":E #"ST N!*:E( O) #"NES /"NDE 0.
DES'(":E #"ST N!*:E( O) ,A%ES /"NDE 0.
DES'(":E #"ST #"NE ,A%E /"NDE 0.
DES'(":E #"ST ,A%E /"NDE 0...
$e#ending on the variant of the statement that "ou use, writes thenum%er of lines, num%er of #ages, a line of a list on a given #age, orvarious attri%utes of a #age to varia%les.
DES'(":E TA:#E
$escri%es the attri%utes of an internal ta%le.
Syntax
DES'(":E TA:#E /#"NES 0 /O''!(S0 /3"ND 0.
$e#ending on the additions "ou use, writes the num%er of linesoccu#ied, the value s#ecified for the I-ITIA/ 0IM of the ta%le, or theta%le t"#e into a corres#onding varia%le.
-
8/14/2019 Syntaxes & Statements in ABAP
27/97
D"&"DE
$ivides one field %" another.
Syntax
D"&"DE : .
$ivides the content of %" , and #laces the result in . Thisis equivalent to: n=nm.
D"&"DE+'O((ES,OND"N%
$ivides matching com#onents of structures.
Syntax
D"&"DE+'O((ES,OND"N% : .
All the identicall"&named su%fields of the structures and are divided and the results are stored these su%fields of.
DO
Introduces a loo#.
Syntax
$ 3 TI807 3A5DI-4 258 -?T 7.
Introduces a statement %loc9 that ends with -$$. If "ou omit theTI80 addition, the statement %loc9 is re#eated until it reaches atermination statement such as ?IT or 6@6. ;se the TI80 additionto restrict the num%er of loo# #asses to . The A5DI-4 additionallows "ou to #rocess fields the same distance a#art in memor".
-
8/14/2019 Syntaxes & Statements in ABAP
28/97
E
ED"TO(+'A##
/oads an A'A( #rogram or internal ta%le into a tet editor.
Syntax
ED"TO(+'A## )O( ...
ED"TO(+'A## )O( (E,O(T ...
/oads the internal ta%le or the #rogram into a teteditor, where "ou can edit it using standard editor functions.
E#SE
Introduces a statement %loc9 in an I2 control structure.
Syntax
E#SE.
If the logical e#ression in an I2 statement is false, /0 introduces thestatement %loc9 to %e eecuted instead.
E#SE")
Introduces a statement %loc9 in an I2 control structure.
Syntax
E#SE") .
If the logical e#ression in an I2 statement is false and istrue, /0 introduces the statement %loc9 to %e eecuted instead.
-
8/14/2019 Syntaxes & Statements in ABAP
29/97
END+O)+DE)"N"T"ON
6loses a macro definition.
Syntax
END+O)+DE)"N"T"ON.
This statement concludes a macro definition introduced with$2I-ITI-.
END+O)+,A%E
vent 9e"words for defining event %loc9s for list events.
Syntax
END+O)+,A%E.
Bhenever the #age footer is reached while a list is %eing created, theruntime environment triggers the -$&2&(A4 event, and thecorres#onding event %loc9 is eecuted.
END+O)+SE#E'T"ON
vent 9e"words for defining event %loc9s for re#orting events.
Syntax
END+O)+SE#E'T"ON.
nce a logical data%ase has read all of the required lines and #assedthem to the eecuta%le #rogram, the runtime environment triggers the
-$&2&0/6TI- event, and the corres#onding event %loc9 iseecuted.
ENDAT
-
8/14/2019 Syntaxes & Statements in ABAP
30/97
6loses a statement %loc9 in control level #rocessing.
Syntax
ENDAT.
This statement concludes a control level #rocessing %loc9 introducedwith AT.
END'ASE
6loses a 6A0 control structure.
Syntax
END'ASE.
This statement concludes a control structure introduced with 6A0.
END'AT'H
6loses a 6AT6@ area.
Syntax
-$6AT6@.
This statement concludes an ece#tion handling %loc9 introduced with6AT6@ 0D0T8&?6(TI-0.
END'#ASS
6loses a class definition.
Syntax
-$6/A00.
-
8/14/2019 Syntaxes & Statements in ABAP
31/97
This statement concludes a class declaration or im#lementationintroduced with 6/A00.
ENDDO
6loses a $ loo#.
Syntax
ENDDO.
This statement concludes a loo# introduced with $.
ENDEE'
6loses a -ative 0N/ statement.
Syntax
ENDEE'.
This statement ends a -ative 0N/ statement introduced with ?6
0N/.
END)O(*
6loses a su%routine.
Syntax
END)O(*.
This statement concludes a su%routine definition introduced with258.
END)!N'T"ON
-
8/14/2019 Syntaxes & Statements in ABAP
32/97
6loses a function module.
Syntax
END)!N'T"ON.
This statement concludes a function module introduced with2;-6TI-.
END")
6loses an I2 control structure.
Syntax
END").
This statement concludes a control structure introduced with I2.
END"NTE()A'E
6loses a interface definition.
Syntax
END"NTE()A'E.
This statement concludes an interface definition introduced withI-T52A6.
END#OO,
6loses a /(.
Syntax
END#OO,.
This statement concludes a loo# introduced with /(.
-
8/14/2019 Syntaxes & Statements in ABAP
33/97
END*ETHOD
6loses a method.
Syntax
END*ETHOD.
This statement concludes a method im#lementation introduced with8T@$.
END*OD!#E
6loses a dialog module.
Syntax
END*OD!#E.
This statement concludes a dialog module introduced with 8$;/.
ENDON
6loses a conditional statement %loc9.
Syntax
ENDON.
This statement ends a conditional statement %loc9 introduced with -6@A-4.
END,(O&"DE
6loses a (5I$ loo#.
Syntax
-
8/14/2019 Syntaxes & Statements in ABAP
34/97
END,(O&"DE.
This statement concludes a loo# introduced with (5I$.
ENDSE#E'T
6loses a 0/6T loo#.
Syntax
ENDSE#E'T.
This statement concludes a loo# introduced with 0/6T.
ENDT(
6loses a T5D area.
Syntax
-$T5D.
This statement concludes a control structure introduced with T5D.
END9H"#E
6loses a B@I/ loo#.
Syntax
END9H"#E.
This statement concludes a loo# introduced with B@I/.
E&ENTS
-
8/14/2019 Syntaxes & Statements in ABAP
35/97
$efines events in classes or interfaces.
Syntax
-T0 ?(5TI-4.. A/;EF TD( t"#e 3(TI-A/7...
The event can %e declared in the declaration #art of a class orwithin an interface definition, and ma" have ?(5TI-4 #arametersthat are #assed to the event handler. The #arameters are alwa"s#assed %" value.
EE' S#
Introduces a -ative 0N/ statement.
Syntax
EE' S# /,E()O(*"N% 0.
'etween ?6 0N/ and the -$?6 statement, "ou can include adata%ase&s#ecific -ative 0N/ statement. The (5258I-4 additionallows "ou to #ass a multi#le&line selection line %" line to a su%routine.
E"T
/eaves a loo# or #rocessing %loc9.
Syntax
E"T.
Bithin a loo#: The entire loo# is terminated, and #rocessing continueswith the first statement following the loo#. utside a loo#: Terminates
the current #rocessing %loc9. In a re#orting event: Lum#s directl" to theout#ut list.
E"T )(O* STE,+#OO,
nds a ste# loo#.
-
8/14/2019 Syntaxes & Statements in ABAP
36/97
Syntax
E"T )(O* STE,+#OO,.
Terminates ste# loo# #rocessing. A ste# loo# is ais a wa" of dis#la"ing
a ta%le on a screen.
E"T )(O* S#
nds -ative 0N/ #rocessing.
Syntax
E"T )(O* S#.
This statement ma" occur within a su%routine called using the(5258I-4 addition in the ?6 0N/ statement. The entiresu%routine is #rocessed, %ut no more su%sequent lines of the selectionare #rocessed.
E,O(T
#orts data clusters.
Syntax
?(5T... 3258 7... EFT 885D
$ATA'A0 EF I$EF.
The data o%)ects or , or the data o%)ects in the internal ta%le are stored as a data cluster in the crossrogram A'A( memor"
of the current internal session, in a cluster data%ase ta%le , orin the cross&transaction a##lication %uffer of the ta%le .
ET(A'T
6reates an etract dataset and adds lines to it.
-
8/14/2019 Syntaxes & Statements in ABAP
37/97
Syntax
ET(A'T .
Bith the first ?T5A6T statement of a #rogram, the s"stem creates the
etract dataset and adds the first etract record. In each su%sequent?T5A6T statement, the new etract record is added to the dataset.ach etract record contains eactl" those fields that are contained inthe field grou# , #lus the fields of the field grou# @A$5 Eif oneeistsF.
)
)ET'H
;ses a cursor to read entries from a data%ase ta%le.
Syntax
)ET'H NET '!(SO( "NTO .
If the cursor is lin9ed with a selection in a data%ase ta%le, 2T6@writes the net line of the selection into the flat target area .
)"E#D+%(O!,S
$eclares a field grou# for an etract dataset.
Syntax
)"E#D+%(O!,S .
This statement defines a field grou# . 2ield grou#s define the linestructure of an etract dataset. Dou can also define a s#ecial fieldgrou# called @A$5: Bhen filling the etract dataset, the s"stemautomaticall" #refies an" other field grou#s with this field grou#.
-
8/14/2019 Syntaxes & Statements in ABAP
38/97
)"E#D+S*:O#S
$eclares field s"m%ols.
Syntax
2I/$&0D8'/0 3 addition allows "ou to s#ecif" the t"#e of a field s"m%ol. The0T5;6T;5 addition forces a structured 5ieof the data o%)ects that"ou assign to the field s"m%ol.
)"ND
0earches for #atterns.
Syntax
2I-$ I- 306TI- 220T /-4T@ 27 3I4-5I-4 6A050(6TI-4 6A07 3I- 'DT 8$I- 6@A5A6T5 8$7 38AT6@ 220T 7 38AT6@ /-4T@ 7.
The s"stem searches the field for the #attern . The06TI- 220T /-4T@ 2 addition tells the s"stem tosearch onl" from the #osition in the length . I4-5I-46A0 or 50(6TI-4 6A0 EdefaultF s#ecifies whether the search is to%e case&sensitive. In ;nicode #rograms, "ou must s#ecif" whether thestatement is a character or %"te o#eration, using the I- 'DT 8$ orI- 6@A5A6T5 8$ EdefaultF additions. The 8AT6@ 220T and8AT6@ /-4T@ additions set the offset of the first occurrence andlength of the search string in the fields and .
)O(*$efines a su%routine.
Syntax
258 3;0I-4 ... 3A/;E73F7 3TD( /I 7... 736@A-4I-4... 3A/;E73F7 3TD( /I 7... 7.
-
8/14/2019 Syntaxes & Statements in ABAP
39/97
Introduces a su%routine . The ;0I-4 and 6@A-4I-4 additionsdefine the su%routineOs arameter interface. The su%routine endwith -$258.
)O(*AT
0ets formatting o#tions for list out#ut.
Syntax
258AT... 3-227...
The formatting o#tions Esuch as colorF set in the 258ATstatement, a##l" to all su%sequent out#ut until the" are turned off
using the 22 o#tion.
)(EE
5elease s#ace in memor".
Syntax
)(EE .
)(EE *E*O( "DIJ.
)(EE O:;E'T .
This statement deletes an internal ta%le, a data cluster in A'A(memor", or an eternal o%)ect in / Automation, de#ending on thevariant of the statement used.
)!N'T"ON
$efines a function module.
Syntax
)!N'T"ON .
-
8/14/2019 Syntaxes & Statements in ABAP
40/97
Introduces the function module . This statement is not enteredin the A'A( ditor, %ut is automaticall" generated %" the 2unction'uilder in the A'A( Bor9%ench. The function module definition endswith the -$2;-6TI- statement
)!N'T"ON+,OO#
Introduces a function grou#.
Syntax
)!N'T"ON+,OO#.
The first statement in a function grou#. This statement is not entered
in the A'A( ditor, %ut is automaticall" generated %" the 2unction'uilder in the A'A( Bor9%ench. A function grou# is an A'A( #rogramthat contains function modules.
%
%ET
vent 9e"word for defining event %loc9s for re#orting events.
Syntax
4T 32I/$0 ...7.
nl" occurs in eecuta%le #rograms. Bhen the logical data%ase has#assed a line of the node to the #rogram, the runtimeenvironment triggers the 4T event, and the corres#onding event%loc9 is eecuted. Dou can use the 2I/$0 o#tion to s#ecif" e#licitl"the columns of a node that the logical data%ase should read.
%ET :"T
5eads an individual %it.
-
8/14/2019 Syntaxes & Statements in ABAP
41/97
Syntax
%ET :"T O) "NTO .
5eads the %it at #osition of the headecimal field into the
field .
%ET '!(SO(
4ets the cursor #osition on a screen or in an interactive list event.
Syntax
4T 6;505 2I/$ 3220T 7 3/I- 7
3A/; 7 3/-4T@ 7.
4T 6;505 /I- 3220T 7 3A/; 7 3/-4T@7.
At a user action on a list or screen, the statement writes the #osition,value, and dis#la"ed length of a field or line into the corres#ondingvaria%les.
%ET DATASET
Syntax
%ET DATASET /,OS"T"ONS 0/ATT(":!TE 0.
4ets the attri%utes of a file o#ened using (- $ATA0T. The(0ITI-0 additions writes the current readwrite #osition to the field. The ATT5I';T addition writes the attri%utes to a structure,
, of the t"#e $0THATT5I';T0.
%ET #O'A#E #AN%!A%E
4ets the current tet environment.
-
8/14/2019 Syntaxes & Statements in ABAP
42/97
Syntax
%ET #O'A#E #AN%!A%E 'O!NT *OD")"E( .
5eturns the current language, countr" I$ and an" modifier into the
corres#onding varia%les
%ET ,A(A*ETE(
4ets an 0(A4(A #arameters
Syntax
%ET ,A(A*ETE( "D )"E#D .
Brites the value of the 0(A4(A #arameter from the user&s#ecific 0A( memor" into the varia%le .
%ET ,)+STAT!S
4ets the current 4;I status.
Syntax
%ET ,)+STAT!S /,(O%(A* 0 /E'#!D"N% 0.
5eturns the name of the current 4;I status Ethe same as 0D&(2DFinto the varia%le . The (545A8 addition writes the name of theA'A( #rogram to which the status %elongs into the varia%le .The ?6/;$I-4 addition returns a list of all currentl" inactive functioncodes into the internal ta%le .
%ET ,(O,E(T
4ets a #ro#ert" of an / Automation o%)ect.
Syntax
%ET ,(O,E(T O) ? .
-
8/14/2019 Syntaxes & Statements in ABAP
43/97
Brites the #ro#ert" of an eternal / Automation o%)ect to thevaria%le .
%ET (E)E(EN'E
4ets a data reference.
Syntax
4T 525-6 2 I-T .
Brites a data reference to an eisting data o%)ect to the datareference varia%le .
%ET (!N T"*E )"E#D
8easures the runtime in microseconds.
Syntax
%ET (!N T"*E )"E#D .
The first time the statement is eecuted, the varia%le is set to!ero. In each su%sequent call, the runtime since the first call is writtento .
%ET T"*E
0"nchroni!es the time.
Syntax
%ET T"*E /)"E#D 0.
5efreshes the s"stem fields 0D&;MIT, 0D&$AT;8, 0D&TI8/, 0D&$AT/,and 0D&M-/. The 2I/$ addition fills the varia%le with thecurrent time.
-
8/14/2019 Syntaxes & Statements in ABAP
44/97
%ET T"*E STA*, )"E#D
5eturns a time stam#.
Syntax
%ET T"*E STA*, )"E#D .
5eturns the short or long form of the current date and time, de#endingon whether the varia%le has the t"#e (EF or (E11F. The long formreturns the time correct to seven decimal #laces.
H
H"DE
0tores information a%out list lines.
Syntax
H"DE .
Bhile the list is %eing created, this statement stores the contents of
the field and the current line num%er in the internal @I$ areaBhen the cursor is #ositioned on a line in an interactive list event, thestored value is returned to the field .
"
")
6onditional %ranch.
Introduces a new %ranch.
Syntax
-
8/14/2019 Syntaxes & Statements in ABAP
45/97
") .
#ens an I2 control structure that ends with an -$I2 statement. Thes"stem evaluates the logical e#ression , and #rocessesdifferent statement %loc9s de#ending on the result.
"*,O(T
Im#orts data clusters.
Syntax
I8(5T... 3T 7... EF258 885D
$ATA'A0 EF I$EF.
The data o%)ects or , or the data o%)ects in the internal ta%le are read from data clusters, either in the crossrogram A'A(memor" of the current internal sessionG in a cluster data%ase ta%leG or in the cross&transaction a##lication %uffer of the ta%le and written to the varia%les and .
"*,O(T D"(E'TO(
6reates the director" of a data cluster from a cluster data%ase.
Syntax
I8(5T $I56T5D I-T 258 $ATA'A0 EF
Id
-
8/14/2019 Syntaxes & Statements in ABAP
46/97
Inserts an include #rogram in another #rogram.
Syntax
"N'#!DE .
@as the same effect as co#"ing the source code of the include #rogram into the #rogram. Include #rograms are not loaded at runtime,%ut are e#anded when the #rogram is generated. Include #rogramsmust have the #rogram t"#e I.
"N'#!DE T,E2ST(!'T!(E
Includes a structure within another.
Syntax
"N'#!DE T,E 2ST(!'T!(E /AS /(ENA*"N%9"TH S!))" 00.
Bithin a structure declared using TD(0$ATA '4I- 2, co#ies astructured datat"#e , or a structure alread" availa%le as adata o%)ect, as #art of the structure declaration. The A0 addition lets"ou address the individual com#onents using the name . The5-A8I-4 addition lets "ou a##end a suffi, , to , so
that "ou can co#" the same structure several times.
"N"T"A#"CAT"ON
vent 9e"words for defining event %loc9s for re#orting events.
Syntax
"N"T"A#"CAT"ON.
nl" occurs in eecuta%le #rograms. The A'A( runtime environmenttriggers the I-ITIA/IMATI- event %efore the selection screen is#rocessed, at which #oint the corres#onding event %loc9 is #rocessed.
-
8/14/2019 Syntaxes & Statements in ABAP
47/97
-
8/14/2019 Syntaxes & Statements in ABAP
48/97
inserted line or the relevant data reference is stored in afterthe statement.
"NSE(T for "ndex Ta6les
Inserts entries in inde ta%les.
Syntax
I-05T /I-0 2 3258 7 3T 7I-T 3I-$? 7
3A00I4-I-4 525-6 I-T 7.
Inserts a line or a set of lines from the internal ta%le into the internal ta%le %efore the line with the inde . If is an inde ta%le, "ou can use the 258 and T additions torestrict the lines inserted. If "ou omit the I-$? addition, "ou can onl"use the statement within a /(. A new line containing values isinserted %efore the current line. If "ou use A00I4-I-4 or I-T525-6, field s"m%ol refers to the inserted line or therelevant data reference is stored in after the statement.
"NSE(T for ,rograms
Inserts A'A( #rograms into the #rogram li%rar".
Syntax
I-05T 5(5T 258 .
The lines of the internal ta%le are added to the #rogram li%rar"
as the #rogram .
"NTE()A'E
$eclares a interface in A'A( %)ects.
-
8/14/2019 Syntaxes & Statements in ABAP
49/97
Syntax
"NTE()A'E /DE)E((ED0 /#OAD0.
Introduces an interface . The definition ends with-$I-T52A6 and contains the declaration of all the com#onents ofthe interface. The $255$ addition ma9es the interface 9nown tothe #rogram %efore it is defined. The /A$ addition loads an interfacee#licitl" from the 6lass /i%rar".
"NTE()A'ES
Im#lementation or nesting of an interface in A'A( %)ects.
Syntax
"NTE()A'ES /A:ST(A'T2)"NA# *ETHODS 2 A##
*ETHODS A:ST(A'T2)"NA# 0/DATA &A#!ES ? ? ...0
.
;sed in a class declaration: This statement adds the com#onents of the
interface to the eisting class definition. ;sed in an interface definition:2orms a com#ound interface. ;se the additions to characteri!emethods in interfaces as a%stract or final. Their attri%utes can %e filledwith initial values.
#
#EA&E for Screens
/eaves a screen.
Syntax
#EA&E S'(EEN.
-
8/14/2019 Syntaxes & Statements in ABAP
50/97
0to#s #rocessing the current screen and calls the su%sequent screen.The net screen can either %e defined staticall" in the screen attri%utesor set d"namicall" using the 0T 065- statement.
Syntax
#EA&E TO S'(EEN .
0to#s #rocessing the current screen and calls the d"namicall"&definedsu%sequent screen P.
#EA&E for #ists During Screen ,rocessing
0witches %etween screen and list #rocessing.
Syntax
#EA&E TO #"ST+,(O'ESS"N% /AND (ET!(N TO S'(EEN 0.
Allows "ou to create and dis#la" a list while #rocessing a series ofscreens. The addition allows "ou to s#ecif" the net screen Eto which"ou return after the list has %een dis#la"edF. If "ou do not use theaddition, screen #rocessing resumes with the (' of the currentscreen
Syntax
#EA&E #"ST+,(O'ESS"N%.
Allows "ou to switch %ac9 e#licitl" from list #rocessing to screen#rocessing.
#EA&E for ,rograms
/eaves an A'A( #rogram.
Syntax
#EA&E /,(O%(A*0.
-
8/14/2019 Syntaxes & Statements in ABAP
51/97
0to#s #rocessing the current #rogram and returns to the #oint fromwhich it was called.
Syntax
#EA&E TO T(ANSA'T"ON /AND S3", )"(ST S'(EEN0.
This statement ends #rocessing of the current #rogram and starts anew transaction, . The addition allows "ou to s9i# the initialscreen of the transaction.
#OAD+O)+,(O%(A*
vent 9e"words for defining event %loc9s for a #rogram constructor.
Syntax
#OAD+O)+,(O%(A*.
Bhen an A'A( #rogram is loaded in an internal session, the runtimeenvironment triggers the /A$&2&(545A8 event, and thecorres#onding event %loc9 is eecuted.
#O'A#
(rotects glo%al data against changes.
Syntax
#O'A# .
nl" occurs in su%routines. Bhen the su%routine starts, the value of is stored tem#oraril", and restored to the varia%le at the end
of the su%routine.
#OO, T8roug8 Extracts
Introduces a loo# through an etract dataset.
-
8/14/2019 Syntaxes & Statements in ABAP
52/97
Syntax
#OO,.
/oo#s through an etract dataset. The loo# ends with an -$/(
statement. Bhen the /( statement is eecuted, the s"stem sto#screating the etract dataset of the #rogram, and starts a loo# throughthe entries in the dataset. ne record from the etract dataset is readin each loo# #ass. The values of the etracted fields are #laced in thecorres#onding out#ut fields of the field grou# within the loo#.
#OO, TH(O!%H internal ta6les
0tarts a loo# through an etract dataset.
Syntax
/( AT I-T B@5 .
/( AT A00I4-I-4 B@5 .
/( AT 525-6 I-T B@5 .
/( AT T5A-0(5TI-4 - 2I/$0 B@5 .
/oo# through an" Internal Ta%le The loo# ends with an -$/(statement. If the logical e#ression is true, each loo# #asseither assigns the current line content to the wor9 area G assignsthe current line to a field s"m%ol G creates a reference to thecurrent line %" G or does not assign the line content at all. Thefirst o#erand in each #art of must %e a com#onent of theinternal ta%le. (ointed %rac9ets are #art of the s"nta for field s"m%olnames.
Bith inde ta%les, "ou can use the additions 258 and T to restrict the lines that are read %" s#ecif"ing an inde range.
#OO, T8roug8 Screen )ields
0tarts a loo# through the ta%le 065-.
-
8/14/2019 Syntaxes & Statements in ABAP
53/97
Syntax
#OO, AT S'(EEN...
0imilar to a loo# through an internal ta%le. The s"stem ta%le 065-
contains the names and attri%utes of all of the fields on the currentscreen.
*
*ESSA%E
$is#la"s a message.
Syntax
*ESSA%E /9"TH ... 0 /(A"S"N% 0.
*ESSA%E "D T,E N!*:E( .
*ESSA%E IJ.
$is#la"s the message of message class as message
t"#e . The message t"#e s#ecifies how the message is dis#la"ed,and how the #rogram reacts. The BIT@ addition allows "ou to fill#laceholders in the message tet. The 5AI0I-4 addition in functionmodules and methods allows "ou to terminate the #rocedure andtrigger the ece#tion .
*ESSA%E T,E
This variant dis#la" a string, , directl" as a message of the t"#e.
*ETHOD
Introduces the im#lementation of a method in a class.
Syntax
-
8/14/2019 Syntaxes & Statements in ABAP
54/97
*ETHOD .
nl" occurs in the im#lementation #art of classes. Introduces astatement %loc9 that ends with -$8T@$. Dou do not have tos#ecif" an" interface #arameters, since these are defined in the
method declaration.
*ETHODS
$eclares methods in classes and interfaces.
Syntax
8T@$0 325 -T 2 7
I8(5TI-4... 3A/;E73F7 TD( 3(TI-A/7...?(5TI-4... 3A/;E73F7 TD( 3(TI-A/7...
6@A-4I-4 ... 3A/;E73F7 TD( 3(TI-A/7...5T;5-I-4 A/;EF?6(TI-0 ... ...3A'0T5A6T7
32I-A/7 35$2I-ITI-7.
Dou declare a method in the definition #art of a class or in thedefinition of an interface: The I8(5TI-4, ?(5TI-4, 6@A-4I-4,
5T;5-I-4, and ?6(TI-0 additions define the #arameter interfaceand ece#tions of the method. The A'0T5A6T addition defines ana%stract class, which cannot %e im#lemented in the same class. Thefunction of a non&a%stract method must %e im#lemented using8T@$. The 2I-A/ addition #revents "ou from redefining the methodin su%classes. The 5$2I-ITI- addition redefines a method of asu#erclass. The 25 -T addition declares an event handler methodfor the event of a class or interface.
*OD") for Data6ase Ta6les
Inserts or changes lines in data%ase ta%les.
Syntax
8$I2D 258 .
-
8/14/2019 Syntaxes & Statements in ABAP
55/97
8$I2D 258 TA'/ .
Bor9s li9e I-05T for data%ase ta%les, if there is not "et a line in theta%le with the same #rimar" 9e". Bor9s li9e ;($AT if a line alread"eists with the same #rimar" 9e".
*OD") for any "nternal Ta6le
6hanges the content of lines in internal ta%les of an" t"#e.
Syntax
8$I2D TA'/ 258 3T5A-0(5TI-4 ...73A00I4-I-4 525-6 I-T 7.
6o#ies the wor9 area into the line of the internal ta%le with thesame ta%le 9e" as . If "ou use A00I4-I-4 or I-T 525-6,field s"m%ol refers to the modified line or the relevant datareference is stored in after the statement. Dou can use theT5A-0(5TI-4 addition to s#ecif" the eact com#onents that "ouwant to change.
8$I2D 258 T5A-0(5TI-4 ... B@5
.
6o#ies the wor9 area into the line of the internal ta%le for whichthe logical e#ression is true. In each com#arison of the logicale#ression, the first o#erand must %e a com#onent of the linestructure.
*OD") for "ndex Ta6les
6hanges the content of lines in inde ta%les.
Syntax
8$I2D 258 3I-$? 7 3T5A-0(5TI-4 ...7
3A00I4-I-4 525-6 I-T 7.
-
8/14/2019 Syntaxes & Statements in ABAP
56/97
6o#ies the wor9 area into the line of the internal ta%le with theinde . If "ou omit the I-$? addition, "ou can onl" use thestatement within a /(. In this case, "ou change the current loo# lineIf "ou use A00I4-I-4 or I-T 525-6, field s"m%ol refers tothe modified line or the relevant data reference is stored in
after the statement.
*OD") for #ists
6hanges a list line.
Syntax
8$I2D /I- 3I-$? 7 32 6;55-T (A42 (A4 7
6;55-T /I- /I- 258AT ...
2I/$ A/; 3258 7 3258 7...2I/$ 258AT .
6hanges either line on the current or s#ecified list Eor #ageF, orthe last line to %e chosen. The eact nature of the change is s#ecifiedin the additions
*OD") S'(EEN
6hanges the 065- ta%le.
Syntax
*OD") S'(EEN...
/i9e changing an internal ta%le. The s"stem ta%le 065- contains thenames and attri%utes of all of the fields on the current screen.
*OD!#E
Introduces a dialog module.
Syntax
-
8/14/2019 Syntaxes & Statements in ABAP
57/97
*OD!#E O!T,!T 2/"N,!T0.
Introduces the dialog module . The ;T(;T and I-(;Tadditions designate the module as a (' or (AI module res#ectivel".ach dialog module ends with -$8$;/.
*O&E
Assigns values.
Syntax
*O&E TO .
Assigns the contents of the data o%)ect to the varia%le , withautomatic t"#e conversion if necessar". quivalent to = .
*O&E+'O((ES,OND"N%
Assigns values %etween identicall"&named com#onents of structures.
Syntax
*O&E+'O((ES,OND"N% TO .
8oves the contents of the com#onents of structure to thecom#onents of that haveidentical names.
*!#T",#
8ulti#lies two single fields.
Syntax
*!#T",# : .
8ulti#lies the content of %" , and stores the result in .This is equivalent to: m=mPn.
-
8/14/2019 Syntaxes & Statements in ABAP
58/97
*!#T",#+'O((ES,OND"N%
8ulti#lies com#onents of structures.
Syntax
*!#T",#+'O((ES,OND"N% : .
All the identicall"&named su%fields of the structures and are multi#lied and the results are stored these su%fields of.
N
NE9+#"NE
Inserts a line %rea9 in a list.
Syntax
NE9+#"NE /NO+S'(O##"N%2S'(O##"N%0.
(ositions the list dis#la" after the #age header. The -&065//I-4
addition #revents the new line from scrolling hori!ontall". 065//I-4resets the -&065//I-4 addition.
NE9+,A%E
Inserts a #age %rea9 in a list.
Syntax
NE9+,A%E /NO+T"T#E29"TH+T"T#E0 /NO+HEAD"N%29"TH+HEAD"N%0 /#"NE+'O!NT0 /#"NE+S"CE0 /,("NT ON2O))0.
-
8/14/2019 Syntaxes & Statements in ABAP
59/97
4enerates a new #age and #ositions the list out#ut after the #ageheader. The additions control how the #age header is dis#la"ed, thelength and width of the #age, and the #rint out#ut.
NODES
$eclares an interface wor9 area.
Syntax
NODES .
$eclares a varia%le with the same data t"#e and the same name as adata t"#e from the A'A( $ictionar". 0tructures in main #rograms and
su%routines declared using -$0 use a common data area. Thisstatement is used in con)unction with logical data%ases.
O
ON 'HAN%E
Introduces a new %ranch.
Syntax
ON 'HAN%E O) /O( O( ...0.
#ens an - control structure, which ends with -$-. The statement%loc9 is eecuted whenever the contents of the field or one of theother fields has changed since the statement was last eecuted.
O,EN '!(SO(
#ens a data%ase cursor.
Syntax
-
8/14/2019 Syntaxes & Statements in ABAP
60/97
(- 6;505 3BIT@ @/$7 25 0/6T 258 3B@5 7
345;( 'D 73@AI-4 7
35$5 'D 7.
#ens a cursor with t"#e 6;505 for a 0/6T statement. Doucan use all the clauses of the 0/6T statement a#art from the I-Tclause. The I-T clause is set in the 2T6@ statement. If "ou use theBIT@ @/$ addition, the cursor is not closed when a data%ase commitoccurs.
O,EN DATASET
#ens a file.
Syntax
O,EN DATASET /)O( "N,!T2O!T,!T2A,,END"N%2!,DATE0
/"N :"NA( *ODE 2"N TET *ODE /EN'OD"N% IDE)A!#T2!T)+L2NON+!N"'ODEJ0 2"N #E%A' :"NA( *ODE /I:"%2#"TT#EJ END"AN0 /'ODE
,A%E 0 2"N #E%A' TET *ODE /I:"%2#"TT#EJ END"AN0 /'ODE,A%E 00 /(E,#A'E*ENT 'HA(A'TE( 0 /"%NO("N% 'ON&E(S"ON E((O(S0 /AT ,OS"T"ON 0 /T,E 0 /*ESSA%E 0 /)"#TE( 0.
#ens a file on the a##lication server. The additions after 25s#ecif" how the file is read or written. The 8$ additions s#ecifieshow content is inter#reted Eas characters or in %inar" formF. The-6$I-4 addition s#ecifies the character re#resentation in the file.The /4A6D 8$ allows "ou to read files that were written %efore5elease K.1. 5(/A68-T 6@A5A6T50 and 6-50I- 5550are used to handle errors during character set conversion. AT (0ITI-s#ecifies the #osition in the file. 800A4 s#ecifies where s"stem
-
8/14/2019 Syntaxes & Statements in ABAP
61/97
messages are stored. 2I/T5 lets "ou s#ecif" o#erating s"stemcommands.
O&E(#A
verla"s one string with another:
Syntax
O&E(#A 9"TH /ON# 0.
This statement overla"s all #ositions in field containing letterswhich occur in with the contents of . remainsunchanged. If "ou omit -/D , all #ositions of containing
s#aces are overwritten.
,
,A'3
6onverts t"#e 6 varia%les to t"#e (.
Syntax
,A'3 TO .
(ac9s the string and #laces it in the field . This can %ereversed with the ;-(A6 statement.
,A(A*ETE(S$eclares #arameters for a selection screen.
Syntax
,A(A*ETE(S /IJ0 /T,E 2#"3E 0/DE'"*A#S 0
-
8/14/2019 Syntaxes & Statements in ABAP
62/97
/DE)A!#T 0 /*E*O( "D 0 /#O9E( 'ASE0 /O:#"%ATO(0 /&A#!E 'HE'30
/AS 'HE'3:O0 /(AD"O:!TTON %(O!, 0 /NO+D"S,#A0 /*OD") "D 0.
$eclares a varia%le , as in the $ATA statement. 2or , an in#utfield a##ears on the corres#onding selection screen. The additionsallow "ou to define default values, acce#t lowercase in#ut, define thefield as required, chec9 values, define a chec9%o or radio %utton,#revent the field from %eing dis#la"ed on the selection screen, ormodif" the field
,E()O(*
6alls a su%routine.
Syntax
(5258 EF 3I2 2;-$7
EF3I- (545A8 EF73I2 2;-$7 3;0I-4 ... ... 7
36@A-4I-4... ... 73- 688IT7.
6alls an internal or eternal su%routine or the su%routinewhose name occurs in the field. The eternal #rogram is or the name contained in . The I2 2;-$ addition#revents a runtime error from occurring if the su%routine does noteist. The ;0I-4 and 6@A-4I-4 additions fill the su%routineOs#arameter interface. The - 688IT addition dela"s the eecution ofthe su%routine until the net 688IT B5 statement.
,OS"T"ON
A%solute #osition of the dis#la" in a list.
-
8/14/2019 Syntaxes & Statements in ABAP
63/97
Syntax
,OS"T"ON .
(ositions the list dis#la" in the column .
,("NT+'ONT(O# for ,rint )ormat
0#ecifies the #rint format.
Syntax
(5I-T&6-T5/ 3/I- 7 3(0ITI- 7.
0ets the #rint format starting either at the current list #osition or atline and column .
,("NT+'ONT(O# for "ndex #ines
6reates inde lines in the s#ool file.
Syntax
,("NT+'ONT(O# "NDE+#"NE .
Brites the contents of field into an inde line after finishing thecurrent #rint line. The inde line is not #rinted. $uring o#ticalarchiving, the s#ool s"stem divides the list into a data file and adescri#tion file containing the inde lines.
,("&ATE
$efines the #rivate section of a class.
Syntax
,("&ATE SE'T"ON.
-
8/14/2019 Syntaxes & Statements in ABAP
64/97
Introduces the declaration of all of the com#onents of a class that areonl" visi%le in the class itself.
,(O%(A*
Introduces a #rogram.
Syntax
,(O%(A* ...
The first statement in some A'A( #rograms. quivalent to: 5(5T.
,(OTE'TED
$efines the #rotected section of a class.
Syntax
,(OTE'TED SE'T"ON.
Introduces the declaration of all of the com#onents of a class that are
onl" visi%le in the class and its su%classes.
,(O&"DE
/oo#s through internal ta%les at given intervals.
Syntax
,(O&"DE ... )(O*
... )(O* ... )(O* ... :ET9EEN AND .
The contents of the s#ecified fields of the internal ta%les Q are #laced in their header lines. The #rocessing %loc9%etween (5I$ and -$(5I$ is then eecuted for each interval.
-
8/14/2019 Syntaxes & Statements in ABAP
65/97
,!:#"'
$efines the #u%lic section of a class.
Syntax
,!:#"' SE'T"ON.
Introduces the declaration of all of the com#onents of a class that arevisi%le in the class, its su%classes, and all users.
,!T
Triggers a 4T event.
Syntax
,!T .
nl" occurs in logical data%ases. $irects the #rogram flow according tothe structure of the logical data%ase.
(
(A"SE for 'lass+:ased Excetions
5aises an ece#tion.
Syntax
(A"SE E'E,T"ON T,E 2 .
Terminates #rocessing and raises an ece#tion of the ece#tion class. If the reference varia%le #oints to an o%)ect of anece#tion class, can %e s#ecified instead of TD(.
-
8/14/2019 Syntaxes & Statements in ABAP
66/97
(A"SE for Excetions of )unction *odules and*et8ods
5aises ece#tions.
Syntax
(A"SE .
nl" occurs in function modules and methods. Terminates #rocessingand raises an ece#tion defined in the interface.
(A"SE for E5ents
Triggers events in A'A( %)ects.
Syntax
(A"SE E&ENT .
nl" occurs in methods. Triggers the event and calls allregistered handler methods.
(AN%ES
$eclares a 5A-40 ta%le.
Syntax
(AN%ES )O( .
$eclares a 5A-40 ta%le for the field . A 5A-40 ta%le has thesame data t"#e as a selection ta%le, %ut is not lin9ed to in#ut fields ona selection screen.
(EAD for )iles
5eads a file.
-
8/14/2019 Syntaxes & Statements in ABAP
67/97
Syntax
5A$ $ATA0T I-T 38A?I8;8 /-4T@ 73A6T;A/ /-4T@ 7.
5eads the contents of the file on the a##lication server to thevaria%le . The amount of data can %e s#ecified using 8A?I8;8/-4T@. The num%er of %"tes transferred can %e written to using A6T;A/ /-4T@.
(EAD for any "nternal Ta6le
5eads a line of an internal ta%le.
Syntax
5A$ TA'/ 258 BIT@ TA'/ D = ... =
BIT@ D = BIT@ D = ... =
I-T 368(A5I-4 ... A// 2I/$07 3T5A-0(5TI-4 ... A// 2I/$0- 2I/$07 A00I4-I-4 525-6 I-T .
This statement reads either the line of the internal ta%le with the same9e" as s#ecified in the wor9 area , the line with the 9e" s#ecifiedin the TA'/ D addition, the line that corres#onds full" to , or theone corres#onding to the freel"&defined 9e" in the D addition. Thecontents of the line are either written to the wor9 area , or theline is assigned to the field s"m%ol . If "ou assign the line to awor9 area, "ou can com#are field contents and s#ecif" the fields that"ou want to trans#ort.
(EAD for "ndex Ta6les
5eads a line of an internal ta%le.
Syntax
-
8/14/2019 Syntaxes & Statements in ABAP
68/97
5A$ TA'/ I-$? I-T ... A00I4-I-4
525-6 I-T .
The line with inde J is read. The result is s#ecified as with an" internal
ta%le.
(EAD for #ists
5eads the contents of a line from a list.
Syntax
5A$ /I- 3I-$? 7 32 6;55-T (A42 (A4 7
6;55-T /I- 32I/$ A/; 3I-T 7... 3I-T 77.
5eads either the line on the current or s#ecified list or #age, orthe last line to have %een selected %" the user. The addition s#ecifiesthe fields that "ou want to read, and the target fields into which the"should %e #laced. The entire line is alwa"s #laced in the s"stem field0D&/I0/, and the @I$ area is filled for the line.
(EAD for ,rograms
5eads A'A( #rograms into the #rogram li%rar".
Syntax
5A$ 5(5T I-T .
6o#ies the lines of the #rogram into the internal ta%le .
(E'E"&E
5eceives results from an as"nchronous function module call.
Syntax
-
8/14/2019 Syntaxes & Statements in ABAP
69/97
(E'E"&E (ES!#TS )(O* )!N'T"ON /3EE,"N% TAS30 /"*,O(T"N% ... fi? a i... 0
/TA:#ES ... fi? a i... 0/E'E,T"ONS... ei? r i... 0
ccurs in s#ecial su%routines to receive I8(5TI-4 and TA'/0#arameters from function modules called using the 0TA5TI-4 -BTA0 addition
(E)(ESH
Initiali!es an internal ta%le.
Syntax
(E)(ESH .
5esets the internal ta%le to its initial value, that is, deletes allof its lines.
(E)(ESH 'ONT(O#
Initiali!es a control.
Syntax
(E)(ESH 'ONT(O# )(O* S'(EEN .
The control defined in the 6-T5/0 statement is reset withthe initial values s#ecified for screen .
(E;E'T/eaves an 4T #rocessing %loc9.
Syntax
(E;E'T /0.
-
8/14/2019 Syntaxes & Statements in ABAP
70/97
Terminates the #rocessing of the current line of the node of the logicaldata%ase. If "ou use the o#tional , the logical data%ase readsthe net line of the node .
(E,#A'E 6y ,attern
5e#laces strings in fields with other strings using a #attern.
Syntax
(E,#A'E / )"(ST O''!(EN'E O) 2 A## O''!(EN'ES O) 0
"N / SE'T"ON O))SET #EN%TH O) 0 9"TH
/"%NO("N% 'ASE2(ES,E'T"N% 'ASE0 /"N :TE *ODE2"N 'HA(A'TE( *ODE0 /(E,#A'E*ENT 'O!NT 0 /(E,#A'E*ENT O))SET 0 /(E,#A'E*ENT #EN%TH 0.
In the string , the search #attern is re#laced %" thecontent of . '" default, the first occurrence of isre#laced. A// 66;5-60 s#ecifies that all occurrences %e re#laced.In the fields and , trailing s#aces in 6 fields are ignored,%ut included in . The 06TI- 220T /-4T@ 2
addition tells the s"stem to search and re#lace onl" from the #osition in the length . I4-5I-4 6A0 or 50(6TI-4 6A0EdefaultF s#ecifies whether the search is to %e case&sensitive. In;nicode #rograms, "ou must s#ecif" whether the statement is acharacter or %"te o#eration, using the I- 'DT 8$ or I- 6@A5A6T58$ EdefaultF additions. The 5(/A68-T additions write thenum%er of re#lacements, the offset of the last re#lacement, and thelength of the last re#laced string to the fields , , and.
(E,#A'E 6y ,osition
5e#laces strings in fields with other strings %" #osition.
Syntax
-
8/14/2019 Syntaxes & Statements in ABAP
71/97
(E,#A'E 9"TH "NTO /#EN%TH 0. /"N :TE *ODE2"N 'HA(A'TE( *ODE0.
A'A( searches the field for the first occurrence of the first characters in the #attern and re#laces them with the string
. In ;nicode #rograms, "ou must s#ecif" whether the statementis a character or %"te o#eration, using the I- 'DT 8$ or I-6@A5A6T5 8$ EdefaultF additions.
(E,O(T
Introduces a #rogram.
Syntax
(E,O(T /*ESSA%E+"D 0 /NO STANDA(D ,A%E HEAD"N%0 /#"NE+S"CE 0 /#"NE+'O!NT IJ0 /DE)"N"N% DATA:ASE 0.
The first statement in eecuta%le A'A( #rograms. can %e an"name "ou choose. The addition 800A4&I$ s#ecifies a message classto %e used in the #rogram. The $2I-I-4 $ATA'A0 addition definesthe #rogram as the data%ase #rogram of the logical data%ase .
The other additions are formatting s#ecifications for the default list ofthe #rogram.
(ESE(&E
Inserts a conditional #age %rea9 in a list.
Syntax
(ESE(&E #"NES.
ecutes a #age %rea9 on the current #age if less than lines arefree %etween the current line and the #age footer.
-
8/14/2019 Syntaxes & Statements in ABAP
72/97
(ET!(N
/eaves a #rocessing %loc9.
Syntax
(ET!(N.
/eaves the current #rocessing %loc9. In a re#orting event: Lum#sdirectl" to the out#ut list.
(O##:A'3
;ndoes the changes in a 0A( /;B.
Syntax
(O##:A'3 9O(3.
5//'A6 B5 alwa"s undoes all changes %ac9 to the start of thedata%ase /;B. The u#date modules are not called, and the log entr" isdeleted from ta%le '/4.
S
S'(O##
0crolls through lists
Syntax
065// /I0T 25BA5$'A6BA5$ 3I-$? 7.
065// /I0T T 2I50T (A4/A0T (A4(A4 3I-$? 7 3/I- 7.
065// /I0T /2T5I4@T 3'D (/A607 3I-$? 7.
065// /I0T T 6/;8- 3I-$? 7.
-
8/14/2019 Syntaxes & Statements in ABAP
73/97
(ositions the current list or the list level in accordance with theadditions s#ecified. Dou can scroll %" window, #age, columns, or to theleft& or right&hand edge of the list.
SEA('H
0earches for strings.
Syntax
SEA('H 2 )O( /A::(E&"ATED0 /STA(T"N% AT 0 /END"N% AT 0 /AND *A(30
/"N :TE *ODE2"N 'HA(A'TE( *ODE0.
0earches the field or ta%le for the string in the field .The result is stored in 0D&2$(0. The additions let "ou hideintermediate characters, search from and to a #articular #osition, andconvert the found string into u##ercase. In ;nicode #rograms, "oumust s#ecif" whether the statement is a character or %"te o#eration,using the I- 'DT 8$ or I- 6@A5A6T5 8$ EdefaultF additions.
SE#E'T
5eads data from the data%ase.
Syntax
0/6T I-T
258 3B@5 7
345;( 'D 73@AI-4 7 35$5 'D 7.
The 0/6T statement consists of a series of clauses, each of whichfulfils a certain tas9:
SE#E'T clause
-
8/14/2019 Syntaxes & Statements in ABAP
74/97
$efines the structure of the selection.
Syntax
0/6T 30I-4/73$I0TI-6T7
P 3A0 7... E 3$I0TI-6T7 F 3A0 7...
The selection can %e one line, 0I-4/, or several lines. Dou caneliminate du#licate lines using the $I0TI-6T addition. To select theentire line, use P, otherwise, "ou can s#ecif" individual columns .2or individual columns, "ou can use aggregate functions , andassign alternative column names .
"NTO clause
$efines the target area into which the selection from the 0/6T
clause is written.
Syntax
... I-T 36550(-$I-4 2I/$0 27 I-TA((-$I-4 36550(-$I-4 2I/$0 27 TA'/ 3(A6A4 0IM 7 I-T E, ,...F
The target area can %e a flat wor9 area , an internal ta%le, or a list of fields . If "ou use the 6550(-$I-4 2I/$0
addition, data is onl" selected if there is an identicall"&named field inthe target area. If "ou use A((-$I-4 instead of I-T, the data isa##ended to an internal ta%le instead of overwriting the eistingcontents. (A6A4 0IM allows "ou to overwrite or etend the internalta%le in a series of #ac9ages.The data t"#e of the target area must %ea##ro#riate for the selection in the 0/6T clause.
)(O* clause
The 258 clause determines the data%ase ta%les from which the datas#ecified in the 0/6T clause is read.
Syntax
... 258 3 3I--57/2T 3;T57 LI-7 3A0 73- 7
36/I-T 0(6I2I$73'D(A00I-4 ';2257
3;( T 5B07
-
8/14/2019 Syntaxes & Statements in ABAP
75/97
Dou can read %oth single fields and grou#s of fields. Dou lin9 severalta%les using inner and outer )oins to lin9 ta%les with conditions, where is a single ta%le or itself a )oin condition. Thenames of data%ase ta%les ma" %e s#ecified staticall" or d"namicall",and "ou can use alias names. Dou can %"#ass automatic client
handling with the 6/I-T 0(6I2I$ addition, and 0A( %uffering with'D(A00I-4 ';225. Dou can also restrict the num%er of lines readfrom the ta%le using the ;( T 5B0 addition.
9HE(E clause
5estricts the num%er of lines selected.
Syntax
... 325 A// -T5I0 I- 7 B@5
The condition ma" contain one or more com#arisons, tests for%elonging to intervals, value list chec9s, su%queries, selection ta%lequeries or null value chec9s, all lin9ed with A-$, 5, and -T. If "ouuse the 25 A// -T5I0 addition, the condition is chec9edfor each line of the internal ta%le as long as contains afield of the internal ta%le as an o#erand. 2or each line of the internalta%le, the s"stem selects the lines from the data%ase ta%le that satisf"the condition. The result set is the union of the individual selectionsresulting from each line.
%(O!, : clause
4rou#s lines in the selection.
Syntax
... 45;( 'D
4rou#s lines with the same contents in the s#ecified columns. ;sesaggregate functions for all other columns in each grou#. All columns ofthe 0/6T clause that are not listed in the 45;( 'D clause must %e
included in aggregate functions.
HA&"N% clause
5estricts the num%er of line grou#s selected.
Syntax
-
8/14/2019 Syntaxes & Statements in ABAP
76/97
... @AI-4
/i9e the B@5 clause, %ut can onl" %e used in con)unction with a45;( 'D clause. The @AI-4 clause uses conditions to restrict thenum%er of grou#s selected.
O(DE( : clause
0orts the lines of the selection.
Syntax
... 5$5 'D (5I8A5D D ... 3A06-$I-4$06-$I-47...
0orts the selection in ascending or descending order according to the#rimar" 9e" or the contents of the fields listed.
SE#E'T+O,T"ONS
$eclares selection criteria for a selection screen.
Syntax
SE#E'T+O,T"ONS )O( /DE)A!#T /to 0 /O,T"ON 0 S"%N 0
/*E*O( "D 0 /#O9E( 'ASE0 /O:#"%ATO(0 /NO+D"S,#A0 /*OD") "D 0 /NO+ETENS"ON0 /NO "NTE(&A#S0 /NO DATA:ASE SE#E'T"ON0.
$eclares a selection ta%le for the field . 2or , #lacesin#ut fields on the corres#onding selection screen. The additions allow"ou to set a default value, acce#t in#ut in lowercase, define a requiredfield, su##ress or modif" the dis#la" on the selection screen, restrictthe selection ta%le to a line or a selection to a single field, or #reventin#ut from %eing #assed to a logical data%ase.
-
8/14/2019 Syntaxes & Statements in ABAP
77/97
SE#E'T"ON+S'(EEN for Selection Screen)ormatting
2ormats selection screens
Syntax
0/6TI-&065- 0I( 37.
0/6TI-&065- ;/I- 3377 38$I2 I$ 7.
0/6TI-&065- '4I- 2 /I-....0/6TI-&065- -$ 2 /I-.
0/6TI-&065- '4I- 2 '/6 3BIT@ 25A8 3TIT/ 77
3- I-T5A/07....0/6TI-&065- -$ 2 '/6 .
0/6TI-&065- 2;-6TI- D .
0/6TI- 065- (;0@';TT- 37 ;05&688A-$ 38$I2 I$
-
8/14/2019 Syntaxes & Statements in ABAP
78/97
0/6TI-&065- '4I- 2 3TIT/ 7 3A0 BI-$B7....0/6TI-&065- -$ 2 .
$efines a selection screen with screen num%er . All
(A5A8T50, 0/6T&(TI-0, and 0/6TI-&065- statementsthat occur %etween these two statements define the in#ut fields andthe formatting of this selection screen. The TIT/ additionallows "ou to define a title for a selection screen. Dou can use the A0BI-$B addition to call a selection screen as a modal dialog %o.
SE#E'T"ON+S'(EEN for Selection Screen&ersions
$efines selection screen versions.
Syntax
0/6TI-&065- '4I- 2 50I- .
nl" occurs in logical data%ases. @ides fields that otherwise a##ear onthe standard selection screen.
SE#E'T"ON+S'(EEN for #ogical Data6ases
(rovides s#ecial functions.
Syntax
0/6TI-&065- $D-A8I6 0/6TI-0 2I/$ 0/6TI- 25 -$TA'/ .
nl" occurs in logical data%ases. $eclares a node as acce#tingd"namic selections or field selections.
-
8/14/2019 Syntaxes & Statements in ABAP
79/97
SET :"T
0ets individual %its.
Syntax
0T 'IT 2 3T 7.
This statement sets the %it at #osition of the headecimal field to 1 Eor to the value of field F. The field must contain thevalue or 1.
SET :#AN3 #"NES
Allows %lan9 lines in lists.
Syntax
0T '/A- /I-0 -22.
(revents %lan9 lines created in B5IT statements from %eingsu##ressed in list out#ut.
SET 'O!NT(
0ets out#ut 2ormats
Syntax
0T 6;-T5D .
0ets the out#ut formats for numeric and date fields for the countr"with the I$ .
SET '!(SO(
0ets the cursor on the screen.
-
8/14/2019 Syntaxes & Statements in ABAP
80/97
Syntax
0T 6;505 2I/$ 3220T 7 3/I- 7.
0T 6;505 /I- 3220T 7.
0T 6;505 .
0ets the cursor either to a #articular #osition in a field, line, or columnof a line.
SET DATASET
Syntax
SET DATASET /,OS"T"ONS 2 END+O))"#E0/ATT(":!TE 0.
6hanges the attri%utes of a file o#ened using (- $ATA0T. The(0ITI-0 addition sets the current readwrite #osition to the value inthe field or to the end of the file. The ATT5I';T addition#asses the attri%utes to the file in a structure, , of the t"#e$0THATT5I';T0.
SET ETENDED 'HE'3
Affects the etended #rogram chec9.
Syntax
0T ?T-$$ 6@6 -22.
0witches the etended #rogram chec9 E0/I-F on or off, su##ressing thecorres#onding messages.
SET HAND#E(
5egisters event handlers in A'A( %)ects.
-
8/14/2019 Syntaxes & Statements in ABAP
81/97
Syntax
0T @A-$/5... ... 325 25 A// I-0TA-607.
If "ou do not use the 25 addition, the handler is set for all static
events. ;se the 25 addition to register handlers for instance events.
SET HO#D DATA
0ets a screen attri%ute.
Syntax
0T @/$ $ATA -22.
0ets the screen attri%ute R@old dataR from the #rogram.
SET #AN%!A%E
0ets the dis#la" language.
Syntax
0T /A-4;A4 .
All tet s"m%ols are refreshed with the contents of the tet #ool inlanguage .
SET #E)T S'(O## :O!NDA(
0ets the left %oundar" for hori!ontal scrolling.
Syntax
0T /2T 065//&';-$A5D 36/;8- 7.
0ets the current out#ut #osition or the #osition as the left&handedge of the scrolla%le area on the current list #age.
-
8/14/2019 Syntaxes & Statements in ABAP
82/97
SET #O'A#E #AN%!A%E
0ets the current tet environment.
Syntax
0T /6A/ /A-4;A4 36;-T5D 7 38$I2I5 7.
0ets the tet environment for al#ha%etical sorting according to thelanguage , countr" , and an" further modifier .
SET *A(%"N
0ets the margin of a #rint #age.
0T 8A54I- 3
-
8/14/2019 Syntaxes & Statements in ABAP
83/97
Syntax
0T (2&0TAT;0 3?6/;$I-4 73I88$IAT/D7 32 (545A8 7.
0ets the 4;I status for the su%sequent screens. The?6/;$I-4 addition allows "ou to deactivate functions d"namicall".The I88$IAT/D addition sets the 4;I status of the list currentl"dis#la"ed. The 2 (545A8 addition allows "ou to use a 4;I statusfrom another #rogram.
SET ,(O,E(T
0ets a #ro#ert" of an / Automation o%)ect.
Syntax
%ET ,(O,E(T O) ? .
0ets the #ro#ert" of an eternal / Automation o%)ect to .
SET (!N T"*E ANA#CE(
6ontrols runtime anal"sis.
Syntax
0T 5;- TI8 A-A/DM5 -22.
The runtime anal"sis onl" measures the runtime of the statements inthe %loc9 %etween 0T 5;- TI8 A-A/DM5 - and 22.
SET (!N T"*E '#O'3
6ontrols runtime anal"sis.
Syntax
0T 5;- TI8 6/6 50/;TI- @I4@/B.
-
8/14/2019 Syntaxes & Statements in ABAP
84/97
0ets the accurac" of the runtime to low accurac" with longmeasurement interval or high accurac" with shorter measurementinterval.
SET S'(EEN
0ets the net screen.
Syntax
0T 065- .
Tem#oraril" overwrites the staticall"&defined net screen with . is #rocessed after the current screen.
SET T"T#E:A(
0ets the screen title.
Syntax
0T TIT/'A5 32 (545A8 7 3BIT@ ... 7.
0ets the title for the su%sequent screens. The 2 (545A8addition allows "ou to use a title from another #rogram. The BIT@addition fills an" #laceholders in the title.
SET !,DATE TAS3 #O'A#
0witches on local u#date.
Syntax
0T ;($AT TA0 /6A/.
;#dates are #rocessed in the current wor9 #rocess.
-
8/14/2019 Syntaxes & Statements in ABAP
85/97
SET !SE(+'O**AND
Triggers a list event.
Syntax
0T ;05&688A-$ .
Triggers a list event with the function code and calls thecorres#onding event %loc9.
SH")T
0hifts strings.
Syntax
0@I2T 3'D (/A607 3/2T5I4@T6I56;/A573I- 'DT 8$I- 6@A5A6T5 8$7.
0hifts the field %" one or #laces. The additions allow "ou tos#ecif" the direction, and how the em#t" s#aces are dealt with. In;nicode #rograms, "ou must s#ecif" whether the statement is acharacter or %"te o#eration, using the I- 'DT 8$ or I- 6@A5A6T5
8$ EdefaultF additions.
S3", for :lan7 #ines
4enerates %lan9 lines in the dis#la" list.
Syntax
S3", /0.
The s"stem writes %lan9 lines into the current list, starting at thecurrent line. If no value is s#ecified for , one %lan9 line is out#ut.
S3", for ,ositioning
-
8/14/2019 Syntaxes & Statements in ABAP
86/97
A%solute #osition of the dis#la" in a list.
Syntax
S3", TO #"NE .
(ositions the list dis#la" in the line .
SO(T for Extracts
0orts an etract dataset.
Syntax
05T 3A06-$I-4$06-$I-47 3A0 T?T7 30TA'/7 ... 'D 3A06-$I-4$06-$I-47 3A0 T?T7...
nds the creation of the etract dataset of a #rogram and, at the sametime, sorts its records. Bithout the 'D o#tion, the s"stem sorts thedataset %" the 9e" s#ecified in the @A$5 field grou#. Dou can definea different sort 9e" %" using the 'D addition. The other additionss#ecif" whether "ou want to sort in ascending or descending order,and whether strings should %e sorted al#ha%eticall".
SO(T for "nternal Ta6les
0orts internal ta%les.
Syntax
05T 3A06-$I-4$06-$I-47 3A0 T?T7 30TA'/7 ... 'D 3A06-$I-4$06-$I-47 3A0 T?T7...
0orts the internal ta%le . If "ou omit the 'D addition, the ta%le issorted %" its 9e". Dou can define a different sort 9e" %" using the 'Daddition. The other additions s#ecif" whether "ou want to sort inascending or descending order, and whether strings should %e sortedal#ha%eticall".
-
8/14/2019 Syntaxes & Statements in ABAP
87/97
S,#"T
0#lits a string.
Syntax
S,#"T AT "NTO ... "NTO TA:#E /"N :TE *ODE2"N 'HA(A'TE( *ODE0.
This statement searches the character field for delimiter strings and the #arts %efore and after the delimiters are #laced in thetarget fields ...> Q , or into a new line of the internal ta%le. In ;nicode #rograms, "ou must s#ecif" whether the statementis a character or %"te o#eration, using the I- 'DT 8$ or I-6@A5A6T5 8$ EdefaultF additions.
STA(T+O)+SE#E'T"ON
vent 9e"words for defining event %loc9s for re#orting events.
Syntax
STA(T+O)+SE#E'T"ON.
After the selection screen has %een #rocessed, the runtimeenvironment triggers the /A$&2&(545A8 event, and thecorres#onding event %loc9 is eecuted.
STAT"'S
$efines static varia%les.
Syntax
STAT"'S ...
/i9e $ATA. 5etains the value of a local varia%le %e"ond the runtime ofthe #rocedure in which it occurs.
-
8/14/2019 Syntaxes & Statements in ABAP
88/97
STO,
/eaves a re#orting event.
Syntax
STO,.
nl" occurs in event %loc9s for re#orting events. /eaves the event%loc9 and goes to the -$&2&0/6TI- %loc9.
S!:*"T
6alls an eecuta%le #rogram of t"#e 1.
Syntax
0;'8IT 3A-$ 5T;5-7 3IA 0/6TI-&065-7 3;0I-4 0/6TI-&0T 7 3BIT@ 7 3BIT@ 25 0/6TI-0 7 3BIT@ 0/6TI-&TA'/ 7 3/I-&0IM 7 3/I-&6;-T 7.
6alls the #rogram . If "ou omit the A-$ 5T;5- addition, thecurrent #rogram is terminated. therwise, the data from the current#rogram is retained, and #rocessing returns to the calling #rogramwhen has finished running. The other additions control theselection screen and set attri%utes of the default list in the called#rogram.
S!:T(A'T for single fields
0u%tracts two single fields.
Syntax
S!:T(A'T )(O* .
-
8/14/2019 Syntaxes & Statements in ABAP
89/97
The contents of are su%tracted from the contents of and theresults are stored in . This is equivalent to: = & .
S!:T(A'T+'O((ES,OND"N%
0u%tracts com#onents of structures.
Syntax
S!:T(A'T+'O((ES,OND"N% )(O* .
All the su%fields of the structures and having thesame name are su%tracted and the results are stored in .
S!*
6alculates sums of grou#s.
Syntax
0;8.
nl" occurs in loo#s through internal ta%les. 6alculates the sums of thenumeric fields in all lines of the current control level and writes theresults to the corres#onding fields in the wor9 area.
S!,,#
2ills contet instances with values.
Syntax
0;((/D = T 6-T?T .
2ills the 9e" fields
-
8/14/2019 Syntaxes & Statements in ABAP
90/97
S!,,(ESS D"A#O%
(revents the current screen from %eing dis#la"ed.
Syntax
S!,,(ESS D"A#O%.
6an onl" occur in a (' dialog module. The screen is not dis#la"ed,%ut its flow logic is still #rocessed.
T
TA:#ES
$eclares an interface wor9 area.
Syntax
TA:#ES .
$eclares a structure with the same data t"#e and the same name as adata%ase ta%le, a view, or a structure from the A'A( $ictionar".
0tructures in main #rograms and su%routines declared using TA'/0use a common data area.
TO,+O)+,A%E
vent 9e"words for defining event %loc9s for list events.
Syntax
TO,+O)+,A%E /D!("N% #"NE+SE#E'T"ON0.
Bhenever a new #age %egins while a standard list is %eing created, theruntime environment triggers the T(&2&(A4 event and thecorres#onding event %loc9 is eecuted. The addition $;5I-4 /I-&0/6TI- has the same function, %ut for detail lists.
-
8/14/2019 Syntaxes & Statements in ABAP
91/97
T(ANS)E(
Brites to a file.
Syntax
T5A-025 T 3/-4T@ 7.
Brites the field to the file on the a##lication server. Doucan s#ecif" the length of the data "ou want to transfer using the/-4T@ addition.
T(ANS#ATE
6onverts characters to strings.
Syntax
T5A-0/AT T ;((5/B5 6A0 ;0I-4 .
The characters of the string are converted into u##er& or
lowercase, or according to a su%stitution rule s#ecified in .
T(
Introduces a T5D %loc9.
Syntax
T5D.
6lass&%ased ece#tions can %e handled using the 6AT6@ statement,within the %loc9 ended with -$T5D.
T,E+,OO#
-
8/14/2019 Syntaxes & Statements in ABAP
92/97
Introduces a t"#e grou#.
Syntax
T,E+,OO# .
The first statement in a t"#e grou#. This statement is not entered inthe A'A( ditor, %ut is automaticall" generated %" the $ictionar" inthe A'A( Bor9%ench. A t"#e grou# is an A'A( #rogram that containst"#e definitions and constant declarations that can %e used in several#rograms.
T,E+,OO#S
$eclares the t"#es and constants of a t"#e grou# to a #rogram.
Syntax
T,E+,OO#S .
This statement allows "ou to use all the data t"#es and constantsdefined in the t"#e grou# in "our #rogram.
T,ES for Single )ield Tyes
$efines a single field t"#e.
Syntax
TD(0 3EF7 3TD(
-
8/14/2019 Syntaxes & Statements in ABAP
93/97
$efines the internal data t"#e in the #rogram with reference tothe class or the interface .
Syntax
TD(0 TD( 52 T $ATA7.
$efines the local data t"#e in the #rogram as an internal ta%lewith the access t"#e , the line t"#e .
$efines the internal data t"#e as a 5A-40 ta%le. A 5A-40 ta%lehas the same data t"#e as a selection ta%le, %ut is not lin9ed to in#utfields on a selection screen.
-
8/14/2019 Syntaxes & Statements in ABAP
94/97
!
!#"NE
(laces hori!ontal lines in the dis#la" list.
Syntax
;/I- 3AT 37373EF77.
Bithout additions, creates a new line on the current list and fills it witha hori!ontal line. The additions allow "ou to insert a line %rea9 and
s#ecif" the starting #osition and length of the line.
!N,A'3
6onverts t"#e ( varia%les to t"#e 6.
Syntax
!N,A'3 TO .
;n#ac9s the #ac9ed field and #laces it in the string withleading !eros. This can %e reversed with the (A6 statement.
!,DATE
6hanges entries in data%ase ta%les.
Syntax
;($AT 0T = = + = & 3B@5 7.
The value in the column is set to the value , increases it %", or decreases it %" for all lines selected. The B@5 clause
-
8/14/2019 Syntaxes & Statements in ABAP
95/