Top Banner

of 34

ABAP Statement Overview a-Z

Jun 03, 2018

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 8/12/2019 ABAP Statement Overview a-Z

    1/34

    ABAP Statement OverviewThe following is an alphabetical classification of the most important generally-released ABAP statements.

    ABCDEFG!"#$%P&'T()

    AADD for Single Fields

    Adds two single fields.SyntaxADD TO .

    The contents of *n+ are added to the contents of *m+. The res,lt is placed in *m+. E,ialent of*m+ / *m+ 0 *n+.ADD for Sequences of Fields

    Adds se,ences of fields.Syntax

    ADD THEN UNTIL GIVING .ADD THEN UNTIL ACCORDING TO GIVING .ADD THEN UNTIL TO .ADD FROM TO GIVING .

    !f *n1+2 *n3+2...2 *n4+ is a se,ence of fields with a ,niform gap between each2 the same type2 and thesame length2 the fields are added together and the res,lt placed in *m+. The ariants allow yo, to restrictthe fields to a partial se,ence2 to incl,de *m+ in the s,m2 or to perform the operation for a se,ence ofconsec,tie fields.ADD-CORRSPO!D"!#

    Adds components of str,ct,res.Syntax

    ADD-CORRESPONDING .Adds together all of the components of str,ct,res *str,c1+ and *str,c3+ that hae identical names2 andplaces the res,lts in the corresponding components of *str,c3+.A$"ASSDefines class-specific alias names for an interface component in ABAP %b5ects.Syntax

    ALIASES FOR

  • 8/12/2019 ABAP Statement Overview a-Z

    2/34

    AT NE .AT END OF .AT FIRST.AT LAST.AT .

    These statements are ,sed in control leel processing with e7tract datasets or internal tables. Eachintrod,ces a statement bloc8 that yo, m,st concl,de with the E$DAT statement. The statementsbetween AT and E$DAT are e7ec,ted wheneer the corresponding control leel change occ,rs.A'%(OR"%)-C(C*Chec8s the a,thori4ation of a ,ser.Syntax

    AUTHORIT/-CHEC0 OECT ID FIELD ID FIELD ...ID FIELD .The statement chec8s whether the ,ser has all of the a,thori4ations defined in the a,thori4ation ob5ect*ob5ect+. *name1+2...2 *name19+ are the a,thori4ation fields in the ob5ect2 and *f1+2... 2*f19+ are dataob5ects in the program. The al,e of each data ob5ect is chec8ed against the corresponding a,thori4ationfield.

    BBAC*&elatie positioning for o,tp,t in a list.SyntaxAC0.Positions the list o,tp,t either in the first col,mn of the first line after the page header on the c,rrent page2or in the first col,mn of the first line of a line bloc8 if yo, hae preio,sly ,sed the &E'E&:E statement.BRA*-PO"!%'tarts the ABAP Deb,gger.SyntaxREA0-POINT.!nterr,pts program e7ec,tion and starts the Deb,gger. This allows yo, to test yo,r programs by haltingthem at any point.

    CCA$$ C'S%O+R-F'!C%"O!Calls a c,stomer f,nction mod,le.SyntaxCALL CUSTOMER-FUNCTION

  • 8/12/2019 ABAP Statement Overview a-Z

    3/34

    CA$$ D"A$O#Calls a dialog mod,le.SyntaxCA"" D!A"%G *dialog+ ;A$D '>!P F!&'T 'C&EE$=;E

  • 8/12/2019 ABAP Statement Overview a-Z

    4/34

    %pens a CA'E control str,ct,re that m,st concl,de with the E$DCA'E statement. This allows yo, tobranch to ario,s statement bloc8s @introd,ced with the )E$ statement2 depending on the contents ofthe data ob5ect *f+.CA%C(Catches r,ntime errors.SyntaxCATCH S/STEM-E5CEPTIONS : ... : .!ntrod,ces a CATC area2 which concl,des with an E$DCATC statement. !f a catchable r,ntime error *e7#e)%+ occ,rs within this bloc82 the c,rrent bloc8 terminates immediately2 and the program 5,mpsdirectly to the corresponding E$DCATC statement2 filling '?-'(B&C with *rc i+.C(C*Conditional termination of a loop pass or a processing bloc8.SyntaxCHEC0 .!f the logical e7pression *loge7p+ is tr,e2 the program contin,es at the ne7t statement. !f2 howeer2*loge7p+ is false2 the c,rrent loop pass terminates and the ne7t begins. !f the program is not c,rrentlyprocessing a loop2 the c,rrent processing bloc8 terminates. There are special forms of the CEC>statement for ,se with selection tables and in GET eent bloc8s.C$ASS - DeclarationDeclares a class in ABAP %b5ects.

    SyntaxCLASS DEFINITION 4PULIC64INHERITING FROM

  • 8/12/2019 ABAP Statement Overview a-Z

    5/34

    C$AR&esets a ariable to its initial al,e.SyntaxCLEAR .&esets the ariable *f+2 which may be of any data type2 to the initial al,e defined for that type.C$OS DA%AS%Closes a file.SyntaxCLOSE DATASET .Closes a file *dsn+ on the application serer preio,sly opened with the %PE$ DATA'ET statement.C$OS C'RSORCloses a database c,rsor.SyntaxCLOSE CURSOR .Closes a c,rsor opened ,sing the %PE$ C(&'%& statement.CO$$C%!nserts lines into an internal table in s,mmari4ed form.SyntaxCOLLECT INTO .The statement first chec8s whether the internal table contains an entry with the same 8ey. !f not2 it acts

    li8e !$'E&T. !f there is already a table entry with the same 8ey2 C%""ECT does not insert a new line.!nstead2 it adds the al,es from the n,meric fields of the wor8 area *line+ to the al,es in thecorresponding fields of the e7isting table entry.CO++"%Concl,des an 'AP "().SyntaxCOMMIT OR0 4AND AIT6.

    All database ,pdates are written firmly to the database2 and all loc8s are released. Triggers the database,pdate. The A$D )A!T addition allows yo, to pa,se the program ,ntil the ,pdate is complete. !f yo, omitit2 the database is ,pdated asynchrono,sly.CO++'!"CA%"O!

    Allows comm,nication between programs.Syntax

    COMMUNICATION INIT DESTINATION ID 4A99%%(ns6.COMMUNICATION ALLOCATE ID 4A99%%(ns6.COMMUNICATION ACCEPT ID 4A99%%(ns6.COMMUNICATION SEND ID UFFER 4A99%%(ns6.COMMUNICATION RECEIVE ID 4A99%%(ns6.COMMUNICATION DEALLOCATE ID 4A99%%(ns6.These statements allow yo, to initiali4e2 start2 and accept program-to-program comm,nication2 send andreceie data between partner programs2 and then terminate the connection.CO+P'%Performs n,meric operations.SyntaxCOMPUTE : .The res,lt of the mathematical e7pression in *e7pression+ is assigned to the res,lt field *n+. TheC%#P(TE 8eyword is optional.CO!CA%!A%Combines a series of strings into a single string.SyntaxCONCATENATE ... INTO 4 SEPARATED / 6.The strings *c1+ to *cn+ are concatenated2 and the res,lt placed in *c+. The 'EPA&ATED B? additionallows yo, to specify a string *s+ to be placed between the strings.CO!D!S&emoes spaces from a string.Syntax

  • 8/12/2019 ABAP Statement Overview a-Z

    6/34

  • 8/12/2019 ABAP Statement Overview a-Z

    7/34

    CREATE OECT .!f *class+ is a class assigned to an a,tomation serer2 an initial ob5ect *ob5+ of this class is created.

    DDA%A wit4 Reference to Declared Data %yesDeclares ariables with a preio,sly-declared data type.Syntax

    DATA *f+... ;T?PE *type+"!>E *ob5+=... ;:A"(E *al+=.Declares a ariable *f+ with the f,lly-defined data type *type+ or the same data type as another dataob5ect *ob5+. The data type *type+ can be D2 F2 !2 T2 a type defined locally in the program ,sing theT?PE' statement2 or a type from the ABAP Dictionary. The data ob5ect *ob5+ is a data ob5ect or line of aninternal table that has already been defined. The :A"(E addition allows yo, to specify a starting al,e.DA%A wit4 Reference to #eneric Data %yesDeclares ariables by completing the description of a generic type.SyntaxDATA *f+;@*length+= T?PE *type+ ;DEC!#A"' *d+=... ;:A"(E *al+=.DATA *f+ T?PE *itab+.The data type *type+ can be C2 $2 P2 or E *tab8ind+ %F *linetype+ )!T *8ey+.Declares the ariable *f+ as an internal table with the table type *tab8ind+2 line type *line8ind+2 and 8ey*8ey+.DA%A for S4ared Data AreasDeclares shared data areas in a program.SyntaxDATA? EGIN OF COMMON PART @

    *f i+...END OF COMMON PART.The ariables *fi+ are assigned to a data area *c+2 which can be defined in more than one program.These data areas ,se the same memory addresses for all programs that are loaded into the sameinternal session.DF"!Defines a macro.SyntaxDEFINE .

  • 8/12/2019 ABAP Statement Overview a-Z

    8/34

    !ntrod,ces the definition of the macro *macro+. Each macro m,st consist of complete ABAP statementand be concl,ded with the E$D-%F-DEF!$!T!%$ statement.D$% for FilesDeletes files on the application serer.SyntaxDELETE DATASET .Deletes the file *dsn+ from the file system of the application serer.D$% for Data1ase %a1le ntriesDeletes entries from database tables.SyntaxDELETE FROM HERE .Deletes all of the lines from the database table *dbtab+ that satisfy the )E&E condition.SyntaxDE"ETE *dbtab+ F&%# *wa+.DE"ETE *dbtab+ F&%# TAB"E *itab+.Deletes the lines with the same primary 8ey as the wor8 area *wa+2 or all of the lines from the databasetable with the same primary 8ey as one of the lines in the internal table *itab+. The wor8 area *wa+ or thelines of the internal table *itab+ m,st be at least as long as the primary 8ey of the database table andhae the same alignment.D$% for Cluster Data1ase %a1les

    Deletes data cl,sters from cl,ster database tables.SyntaxDE"ETE F&%# DATABA'E *dbtab+@*ar+ !D *8ey+.Deletes the entire data cl,ster from the area *ar+ with the name *8ey+ from the cl,ster database table*dbtab+.D$% for t4e Cross-%ransaction Alication BufferDeletes data cl,sters from the cross-transaction application b,ffer.SyntaxDE"ETE F&%# 'A&ED B(FFE& *dbtab+@*ar+ !D *8ey+.Deletes the data cl,ster for the area *ar+ with the name *8ey+ stored in the cross-transaction applicationb,ffer for the table *dbtab+.D$% for $ines from an "nternal %a1leDeletes lines from internal tables of any type.

    SyntaxDE"ETE TAB"E *itab+ F&%# *wa+.DE"ETE TAB"E *itab+ )!T TAB"E >E? *81+ / *f 1+... *8 n+ / *f n+.Deletion ,sing the table 8eyH All lines with the same 8ey are deleted. The 8ey al,es are ta8en either froma compatible wor8 area *wa+ or specified e7plicitly.SyntaxDE"ETE *itab+ )E&E *cond+.Deletion ,sing a conditionH Deletes all table entries that satisfy the logical e7pression *cond+. The logicalcondition may consist of more than one e7pression. oweer2 the first operand in each e7pression m,stbe a component of the line str,ct,re.SyntaxDE"ETE ADACE$T D(P"!CATE E$T&!E' F&%# *itab+ ;C%#PA&!$G... =.Deletes ad5acent d,plicate entries2 either by comparing the 8ey fields or the comparison fields specified

    e7plicitly in the C%#PA&!$G addition.D$% for $ines from "ndex %a1lesDeletes lines from inde7 tables.SyntaxDE"ETE *itab+ ;!$DE< *id7+=.!f yo, ,se the !$DE< option2 deletes the line with the inde7 *id7+ from the table *itab+. !f yo, do not ,sethe !$DE< option2 the statement can only be ,sed within a "%%P I E$D"%%P constr,ction. !n thiscase2 it deletes the c,rrent line.SyntaxDE"ETE *itab+ ;F&%# *n1+= ;T% *n 3+= ;)E&E *cond+=.

  • 8/12/2019 ABAP Statement Overview a-Z

    9/34

    Deletes all rows from *itab+ with inde7 between *n 1+ and *n 2+ an which satisfy the )E&E condition.!f yo, do not ,se the F&%# addition2 the system deletes lines starting at the beginning of the table. !f yo,do not ,se the T% addition2 the system deletes lines to the end of the table. The logical e7pression*cond+ can consist of more than one e7pression. oweer2 the first operand in each e7pression m,st bea component of the line str,ct,re of the internal table.D+A!D

    &etriees al,es from a conte7t instance.SyntaxDE#A$D *al1+ / *f 1+... *al n+ / *f n+ F&%# C%$TE *m+= ;E"P-!D *h+=.The attrib,tes of the data ob5ect *f+ named in the additions to the statement are placed in thecorresponding ariables. ?o, can ,se any n,mber of additions in a single statement.DSCR"B $"S%Describes the attrib,tes of a list.SyntaxDESCRIE LIST NUMER OF LINES 4INDE5 6.DESCRIE LIST NUMER OF PAGES 4INDE5 6.DESCRIE LIST LINE PAGE 4INDE5 6.DESCRIE LIST PAGE 4INDE5 6...

    Depending on the ariant of the statement that yo, ,se2 writes the n,mber of lines2 n,mber of pages2 aline of a list on a gien page2 or ario,s attrib,tes of a page to ariables.DSCR"B %AB$Describes the attrib,tes of an internal table.SyntaxDESCRIE TALE 4LINES 6 4OCCURS6 40IND 6.Depending on the additions yo, ,se2 writes the n,mber of lines occ,pied2 the al,e specified for the!$!T!A" '!KE of the table2 or the table type into a corresponding ariable.D"."DDiides one field by another.SyntaxDIVIDE / .Diides the content of *n+ by *m+2 and places the res,lt in *n+. The e,ialent of n / n L m.

    D"."D-CORRSPO!D"!#Diides matching components of str,ct,res.SyntaxDIVIDE-CORRESPONDING .Diides all matching components of the str,ct,res *str,c1+ and *str,c3+ and places the res,lts into thecorresponding components of *str,c1+.DO!ntrod,ces a loop.SyntaxD% ;*n+ T!#E'= ;:A&?!$G *f+ F&%# *f1+ $E

  • 8/12/2019 ABAP Statement Overview a-Z

    10/34

    !ntrod,ces a statement bloc8 that m,st concl,de with E$DD%. !f yo, omit the T!#E' addition2 thestatement bloc8 is repeated ,ntil a termination statement s,ch as CEC> or E

  • 8/12/2019 ABAP Statement Overview a-Z

    11/34

    The statement concl,des an e7ception handling area introd,ced with CATC.!DC$ASSConcl,des a class definition.SyntaxE$DC"A''.This statement concl,des a class declaration or implementation introd,ced with C"A''.!DDOConcl,des a D% loop.SyntaxENDDO.This statement concl,des a loop introd,ced with D%.!D/CConcl,des a $atie 'M" statement.SyntaxENDE5EC.This statement concl,des a $atie 'M" statement introd,ced with E

  • 8/12/2019 ABAP Statement Overview a-Z

    12/34

    !DPRO."DConcl,des a P&%:!DE loop.SyntaxENDPROVIDE.This statement concl,des a loop introd,ced with P&%:!DE.!DS$C%Concl,des a 'E"ECT loop.SyntaxENDSELECT.This statement concl,des a loop introd,ced with 'E"ECT.!D6("$Concl,des a )!"E loop.SyntaxENDHILE.This statement concl,des a loop introd,ced with )!"E..!%SDefines eents in classes or interfaces.SyntaxE:E$T' *et+ E

  • 8/12/2019 ABAP Statement Overview a-Z

    13/34

    The data ob5ects *fi+ or *g i+2 or the data ob5ects in the internal table *itab+ are stored as a data cl,sterin the cross-program ABAP memory of the c,rrent internal session2 in a cl,ster database table *dbtab+2or in the cross-transaction application b,ffer of the table *dbtab+./%RAC%Creates an e7tract dataset and adds lines to it.SyntaxE5TRACT .The first E

  • 8/12/2019 ABAP Statement Overview a-Z

    14/34

    FUNCTION

  • 8/12/2019 ABAP Statement Overview a-Z

    15/34

  • 8/12/2019 ABAP Statement Overview a-Z

    16/34

    The statement creates a directory of the data ob5ects in a data cl,ster of the cl,ster database *dbtab+and writes it to the internal table *itab+.!n the third ariant2 the table *itab+ contains a directory of the ob5ects stored ,sing E

  • 8/12/2019 ABAP Statement Overview a-Z

    17/34

    The lines of the internal table *itab+ are added to the program library as the program *prog+."!%RFACDefines an interface in ABAP %b5ects.SyntaxINTERFACE 4DEFERRED64LOAD6.!ntrod,ces the definition of the interface *interface+. The definition concl,des with E$D!$TE&FACE2 andcontains the declaration of all of the components in the interface. ?o, can ,se the DEFE&&ED addition todeclare the interface before yo, act,ally define it. The "%AD addition loads the interface definitione7plicitly from the class library."!%RFACS!mplements interfaces in a class.SyntaxINTERFACES .(sed in a class declarationH This statement adds the components of the interface to the e7isting classdefinition.(sed in an interface definitionH Forms a compo,nd interface.

    $$A. for Screens

    "eaes a screen.SyntaxLEAVE SCREEN.Terminates the c,rrent screen and calls the ne7t screen. The ne7t screen can either be defined staticallyin the screen attrib,tes or set dynamically ,sing the 'ET 'C&EE$ statement.SyntaxLEAVE TO SCREEN .Terminates the c,rrent screen and calls the dynamically-defined ne7t screen *scr+.$A. for $ists During Screen Processing'witches between screen and list processing.SyntaxLEAVE TO LIST-PROCESSING 4AND RETURN TO SCREEN 6.This statement allows yo, to create and display a list while processing a series of screens. The additionallows yo, to specify the ne7t screen @to which yo, ret,rn after the list has been displayed. !f yo, do not

    ,se the addition2 screen processing res,mes with the PB% of the c,rrent screen.SyntaxLEAVE LIST-PROCESSING.

    Allows yo, to switch bac8 e7plicitly from list processing to screen processing.$A. for ProgramsTerminates an ABAP program.SyntaxLEAVE 4PROGRAM6.Terminates the c,rrent program and ret,rns to the point from which it was called.SyntaxLEAVE TO TRANSACTION 4AND S0IP FIRST SCREEN6.Terminates the c,rrent program and starts a new transaction *tcod+. The addition allows yo, to s8ip theinitial screen of the transaction.

    $OCA$Protects global data against changes.SyntaxLOCAL .%nly occ,rs in s,bro,tines. )hen the s,bro,tine starts2 the al,e of *f+ is stored temporarily2 andrestored to the ariable *f+ at the end of the s,bro,tine.$OOP %4roug4 xtracts'tarts a loop thro,gh an e7tract dataset.SyntaxLOOP.

  • 8/12/2019 ABAP Statement Overview a-Z

    18/34

    "oops thro,gh an e7tract dataset. The loop is concl,ded with E$D"%%P. )hen the "%%P statement ise7ec,ted2 the system finishes creating the e7tract dataset2 and loops thro,gh all of its entries. %ne entryis read in each loop pass. The al,es of the e7tracted data are placed in the o,tp,t fields of the fieldgro,p within the loop.$OOP %4roug4 "nternal %a1les'tarts a loop thro,gh an internal table.Syntax"%%P AT *itab+ !$T% *wa+ )E&E *loge7p+."%%P AT *itab+ A''!G$!$G *F'+ )E&E *loge7p+."%%P AT *itab+ T&A$'P%&T!$G $% F!E"D' )E&E *loge7p+."oops thro,gh an internal table. The loop is concl,ded with E$D"%%P. !f the logical e7pression *loge7p+is tr,e2 the c,rrent line contents are either placed in the wor8 area *wa+2 assigned to the field symbol*F'+2 or not assigned at all. The first operand in each part of *loge7p+ m,st be a component of theinternal table. The pointed brac8ets in the field symbol name are part of its synta7.)ith inde7 tables2 yo, can ,se the additions F&%# *n+ and T% *n+ to restrict the lines that are read byspecifying an inde7 range.$OOP %4roug4 Screen Fields'tarts a loop thro,gh the special table 'C&EE$.SyntaxLOOP AT SCREEN...

    'imilar to a loop thro,gh an internal table. The system table 'C&EE$ contains the names and attrib,tesof all of the fields on the c,rrent screen.

    ++SSA#%,tp,ts a message.Syntax

    MESSAGE 4ITH ... 6 4RAISING 6.MESSAGE ID T/PE NUMER .MESSAGE .

    %,tp,ts the message *nnn+ of message class *mid+ as message type *7+. The message typedetermines how the message is displayed2 and how the program reacts. The )!T addition allows yo, tofill placeholders in the message te7t. The &A!'!$G addition in f,nction mod,les and methods allows yo,to terminate the proced,re and trigger the e7ception *e7ception+.

    +%(OD!ntrod,ces the implementation of a method in a class.Syntax

    METHOD .%nly occ,rs in the implementation part of classes. This statement begins a statement bloc8 that m,st beconcl,ded with E$D#ET%D. ?o, do not hae to specify any interface parameters2 since these aredefined in the method declaration.+%(ODSDeclares methods in classes and interfaces.Syntax#ET%D' *meth+!#P%&T!$G... ;:A"(E@=*ii+;= T?PE *t+ ;%PT!%$A"=...E

  • 8/12/2019 ABAP Statement Overview a-Z

    19/34

    #%D!F? *dbtab+ F&%# TAB"E *itab+.)or8s li8e !$'E&T for database tables if there is not yet a line in the table with the same primary 8ey.)or8s li8e (PDATE if a line already e7ists with the same primary 8ey.+OD"F) for All "nternal %a1lesChanges the contents of lines in any type of internal table.Syntax#%D!F? TAB"E *itab+ F&%# *wa+ ;T&A$'P%&T!$G *f1+ *f 3+...=.Copies the wor8 area *wa+ into the line of the internal table with the same table 8ey as *wa+. ?o, can,se the T&A$'P%&T!$G addition to specify the e7act components that yo, want to change.#%D!F? *itab+ F&%# *wa+ T&A$'P%&T!$G *f1+ *f 3+... )E&E *loge7p+.Copies the wor8 area *wa+ into the lines of the internal table for which the logical e7pression is tr,e. Thefirst operand in each comparison of the logical e7pression m,st be a component of the line str,ct,re.+OD"F) for "ndex %a1lesChanges the contents of lines in inde7 tables.Syntax#%D!F? *itab+ F&%# *wa+ ;!$DE< *id7+= ;T&A$'P%&T!$G *f1+ *f 3+...=.Copies the wor8 area *wa+ into the line of the internal table with inde7 *id7+. !f yo, omit the !$DE statement.POS"%"O!

    Absol,te positioning of the o,tp,t on a list.SyntaxPOSITION .

  • 8/12/2019 ABAP Statement Overview a-Z

    22/34

  • 8/12/2019 ABAP Statement Overview a-Z

    23/34

    %nly occ,rs in f,nction mod,les and methods. Terminates the proced,re and triggers the e7ception*e7cept+.RA"S for ventsTriggers an eent in ABAP %b5ects.SyntaxRAISE EVENT .%nly occ,rs in methods. The eent *et+ is triggered2 and this calls all of the handler methods registeredfor it.RA!#SDeclares a &A$GE' table.SyntaxRANGES FOR .Declares a &A$GE' table for the field *f+. &A$GE' tables hae the same data type as a selection table2b,t they do not hae inp,t fields on a selection screen.RAD for Files&eads a file.Syntax&EAD DATA'ET *dsn+ !$T% *f+ ;"E$GT *len+=.&eads the contents of the file *dsn+ on the application serer to the ariable *f+. The n,mber of bytestransferred can be written to *len+.

    RAD for any "nternal %a1le&eads a line from any internal table.Syntax&EAD TAB"E *itab+ F&%# *wa+)!T TAB"E >E? *81+ / *f1+... *8n+ / *fn+)!T >E? / *f+)!T >E? *81+ / *f1+... *8n+ / *fn+!$T% *wa+ ;C%#PA&!$G *f1+ *f3+... A"" F!E"D'=;T&A$'P%&T!$G *f1+ *f3+... A"" F!E"D'$% F!E"D'=A''!G$!$G *F'+.This statement reads either the line of the internal table with the same 8ey as specified in the wor8 area*wa+2 the line with the 8ey specified in the TAB"E >E? addition2 the line that corresponds f,lly to *f+2 orthe one corresponding to the freely-defined 8ey in the >E? addition. The contents of the line are either

    written to the wor8 area *wa+2 or the line is assigned to the field symbol *F'+. !f yo, assign the line to awor8 area2 yo, can compare field contents and specify the fields that yo, want to transport.RAD for "ndex %a1les&eads a line of an inde7 table.Syntax&EAD TAB"E *itab+ !$DE< *id7+ !$T% *wa+... A''!G$!$G *F'+.&eads the line with the inde7 *id7+. The res,lt is aailable as described aboe.RAD for $ists&eads the contents of a line from a list.Syntax&EAD "!$E *n+ ;!$DE< *id7+= ;%F C(&&E$T PAGE%F PAGE *p+=C(&&E$T "!$E;F!E"D :A"(E *f1+ ;!$T% *g1+=... *fn+ ;!$T% *gn+==.

    &eads either the line *n+ on the c,rrent or specified list or page2 or the last line to hae been selected bythe ,ser. The addition specifies the fields that yo, want to read2 and the target fields into which theysho,ld be placed. The entire line is always placed in the system field '?-"!'E"2 and the !DE area isfilled for the line.RAD for Programs&eads ABAP programs from the program library.Syntax&EAD &EP%&T *prog+ !$T% *itab+.Copies the lines of the program *prog+ into the internal table *itab+.RC".

  • 8/12/2019 ABAP Statement Overview a-Z

    24/34

    &eceies res,lts from an asynchrono,s f,nction mod,le call.SyntaxRECEIVE RESULTS FROM FUNCTION LINES.E7ec,tes a page brea8 on the c,rrent page if less than *n+ lines are free between the c,rrent line andthe page footer.RO$$BAC*(ndoes the changes in a 'AP "().SyntaxROLLAC0 OR0.(ndoes all changes within a database "() to the beginning of the "(). The registered ,pdate mod,lesare not e7ec,ted2 and the record entry is deleted from table :B"%G.

    S

  • 8/12/2019 ABAP Statement Overview a-Z

    25/34

    SCRO$$'crolls in a list.Syntax'C&%"" "!'T F%&)A&DBAC>)A&D ;!$DE< *id7+=.'C&%"" "!'T T% F!&'T PAGE"A'T PAGEPAGE *pag+;!$DE< *id7+= ;"!$E *lin+=.'C&%"" "!'T "EFT&!GT ;B? *n+ P"ACE'= ;!$DE< *id7+=.'C&%"" "!'T T% C%"(#$ *col+ ;!$DE< *id7+=.Positions the c,rrent list or the list leel *id7+ in accordance with the additions specified. ?o, can scrollby window2 page2 col,mns2 or to the left- or right-hand edge of the list.SARC('earches for a string.SyntaxSEARCH * FOR 4AREVIATED64STARTING AT 64ENDING AT 64AND MAR06.'earches the field *f+ or the table *itab+ for the string in field *g+. The res,lt is placed in the system field'?-FDP%'. The additions allow yo, to hide intermediate characters2 search from and to a partic,larposition2 and conert the fo,nd string into ,ppercase.

    S$C%&eads data from the database.Syntax'E"ECT *res,lt+!$T% *target+F&%# *so,rce+;)E&E *condition+=;G&%(P B? *fields+=;A:!$G *cond+=;%&DE& B? *fields+=.The 'E"ECT statement consists of a series of cla,ses2 each of which f,lfils a certain tas8HS$C% clauseDefines the str,ct,re of the selection.

    Syntax'E"ECT ;'!$G"E=;D!'T!$CT=N *si+ ;A' *a i+=... *agg+@ ;D!'T!$CT= *s 5+ ;A' *a 5+=...The selection can be a single line '!$G"E or a series of lines. ?o, can eliminate d,plicate lines ,sing theD!'T!$CT addition. To select the entire line2 ,se N2 otherwise2 yo, can specify indiid,al col,mns *s i+.For indiid,al col,mns2 yo, can ,se aggregate f,nctions *agg+2 and assign alternatie col,mn names *a

    i+."!%O clauseDefines the target area into which the selection from the 'E"ECT cla,se is to be placed.Syntax... !$T% ;C%&&E'P%$D!$G F!E"D' %F= *wa+ !$T%APPE$D!$G ;C%&&E'P%$D!$G F!E"D' %F= TAB"E *itab+;PAC>AGE '!KE *n+=

    !$T% @*f1+2 *f 3+2...The target area can be a flat wor8 area *wa+2 an internal table *itab+2 or a list of fields *fi+. !f yo, ,se theC%&&E'P%$D!$G F!E"D' addition2 data is only selected if there is an identically-named field in thetarget area. !f yo, ,se APPE$D!$G instead of !$T%2 the data is appended to an internal table instead ofoerwriting the e7isting contents. PAC>AGE '!KE allows yo, to oerwrite or e7tend the internal table in aseries of pac8ages. The data type of the target area m,st be appropriate for the selection in the 'E"ECTcla,se.FRO+ clause'pecifies the database tables from which the data in the selection in the 'E"ECT cla,se is to be read.Syntax

  • 8/12/2019 ABAP Statement Overview a-Z

    26/34

    ... F&%# ;*tab+ ;!$$E&="EFT ;%(TE&= %!$= *dbtab+ ;A' *alias+=;%$ *cond+=;C"!E$T 'PEC!F!ED=;B?PA''!$G B(FFE&=;(P T% *n+ &%)'=?o, can read a single table *dbtab+ or more than one table2 ,sing inner and o,ter 5oins to lin8 tables withconditions *cond+2 where *tab+ is a single table or itself a 5oin condition. ?o, can specify indiid,aldatabase tables either statically or dynamically2 and yo, can replace their names with an alternatie*alias+. ?o, can bypass a,tomatic client handling with the C"!E$T 'PEC!F!ED addition2 and 'APb,ffering with B?PA''!$G B(FFE&. ?o, can also restrict the n,mber of lines read from the table ,singthe (P T% *n+ &%)' addition.6(R clause&estricts the n,mber of lines selected.Syntax... ;F%& A"" E$T&!E' !$ *itab+= )E&E *cond+The condition *cond+ may contain one or more comparisons2 tests for belonging to interals2 al,e listchec8s2 s,b,eries2 selection table ,eries or n,ll al,e chec8s2 all lin8ed with A$D2 %&2 and $%T. !f yo,,se the F%& A"" E$T&!E' addition2 the condition *cond+ is chec8ed for each line of the internal table*itab+ as long as *cond+ contains a field of the internal table as an operand. For each line of the internaltable2 the lines from the database table meeting the condition are selected. The res,lt set is the ,nion of

    the indiid,al selections res,lting from each line.#RO'P B) clauseGro,ps lines in the selectionSyntax... G&%(P B? *s1+ *s 3+Gro,ps lines with the same contents in the specified col,mns. (ses aggregate f,nctions for all othercol,mns in each gro,p. All col,mns listed in the 'E"ECT cla,se that do not appear in the G&%(P B?addition m,st be specified in aggregate e7pressions.(A."!# clause&estricts the n,mber of line gro,ps.Syntax... A:!$G *cond+"i8e the )E&E cla,se2 b,t can only be ,sed in con5,nction with a G&%(P B? cla,se. Applies

    conditions to aggregate e7pressions to red,ce the n,mber of gro,ps selected.ORDR B) clause'orts the lines in the selection.Syntax... %&DE& B? P&!#A&? >E? ... *s i+ ;A'CE$D!$GDE'CE$D!$G=...'orts the selection in ascending or descending order according to the primary 8ey or the contents of thefields listed.S$C%-OP%"O!SDeclares selection criteria for a selection screen.SyntaxSELECT-OPTIONS FOR 4DEFAULT 4( 6 4OPTION 6 SIGN 64MEMOR/ ID 6

    4LOER CASE64OLIGATOR/64NO-DISPLA/64MODIF ID 64NO-E5TENSION64NO INTERVALS64NO DATAASE SELECTION6.Declares a selection table *sel+ for the field *f+2 and also places inp,t fields on the correspondingselection screen. The additions allow yo, to set a defa,lt al,e2 accept inp,t in lowercase2 define a

  • 8/12/2019 ABAP Statement Overview a-Z

    27/34

    re,ired field2 s,ppress or modify the display on the selection screen2 restrict the selection table to a lineor a selection to a single field2 or preent inp,t from being passed to a logical database.S$C%"O!-SCR! for Selection Screen FormattingFormats a selection screen.Syntax'E"ECT!%$-'C&EE$ '>!P ;*n+=.'E"ECT!%$-'C&EE$ ("!$E ;;L=*pos@len+= ;#%D!F !D *8ey+=.'E"ECT!%$-'C&EE$ C%##E$T ;L=*pos@len+ *comm+ ;F%& F!E"D *f+=;#%D!F !D *8ey+=.'E"ECT!%$-'C&EE$ BEG!$ %F "!$E....'E"ECT!%$-'C&EE$ E$D %F "!$E.'E"ECT!%$-'C&EE$ BEG!$ %F B"%C> *bloc8+;)!T F&A#E ;T!T"E *title+==;$% !$TE&:A"'=....'E"ECT!%$-'C&EE$ E$D %F B"%C> *bloc8+.'E"ECT!%$-'C&EE$ F($CT!%$ >E? *i+.'E"ECT!%$ 'C&EE$ P('B(TT%$ ;L=*pos@len+ *p,sh+('E&-C%##A$D *,com+ ;#%D!F !D *8ey+=.

    Allows yo, to insert blan8 lines2 lines and comments2 gro,p inp,t fields together in lines and bloc8s2 andcreate p,shb,ttons.S$C%"O!-SCR! for Defining Selection ScreensDefines selection screens.Syntax'E"ECT!%$-'C&EE$ BEG!$ %F *n,mb+ ;T!T"E *tit+= ;A' )!$D%)=....'E"ECT!%$-'C&EE$ E$D %F *n,mb+.Defines a selection screen with the screen n,mber *n,mb+. All PA&A#ETE&'2 'E"ECT-%PT!%$'2 and'E"ECT!%$-'C&EE$ statements within the 'E"ECT!%$-'C&EE$ BEG!$ %F I E$D %F bloc8 belongto the selection screen *n,mb+. The T!T"E addition allows yo, to define a title for the selection screen.The A' )!$D%) addition allows yo, to define the selection screen as a modal dialog bo7.S$C%"O!-SCR! for Selection Screen .ersions

    Defines selection screen ersions.Syntax'E"ECT!%$-'C&EE$ BEG!$ %F :E&'!%$ *dynnr+...'E"ECT!%$-'C&EE$ E

  • 8/12/2019 ABAP Statement Overview a-Z

    28/34

    Syntax'ET B"A$> "!$E' %$%FF.Preents blan8 lines created in )&!TE statements from being s,ppressed in list o,tp,t.S% CO'!%R)'ets the o,tp,t formatSyntax'ET C%($T&? *c+.'ets the o,tp,t formats for n,meric and date fields for the co,ntry with the !D *c+.S% C'RSOR'ets the c,rsor on the screen.Syntax'ET C(&'%& F!E"D *f+ ;%FF'ET *off+=;"!$E *lin+=.'ET C(&'%& "!$E *lin+ ;%FF'ET *off+=.'ET C(&'%& *col+ *line+.'ets the c,rsor either to a partic,lar position in a field2 line2 or col,mn of a line.S% /%!DD C(C*

    Affects the e7tended program chec8.Syntax'ET E %$%FF.

    'witches the e7tended program chec8 @'"!$ on or off2 s,ppressing the corresponding messages.S% (A!D$R&egisters eent handlers in ABAP %b5ects.Syntax'ET A$D"E&... *hi+... ;F%& *ref+F%& A"" !$'TA$CE'=.!f yo, do not ,se the F%& addition2 the handler is set for all static eents. (se the F%& addition toregister handlers for instance eents.S% (O$D DA%A'ets a screen attrib,te.Syntax'ET %"D DATA %$%FF.'ets the screen attrib,te Oold dataO from the program.S% $A!#'A#

    'ets the display lang,age.Syntax'ET "A$G(AGE *lg+.

    All te7t symbols are refreshed with the contents of the te7t pool in lang,age *lg+.S% $F% SCRO$$ BO'!DAR)'ets the left-hand bo,ndary for hori4ontal scrolling.Syntax'ET "EFT 'C&%""-B%($DA&? ;C%"(#$ *col+=.'ets the c,rrent o,tp,t position or the position *col+ as the left-hand edge of the scrollable area on thec,rrent list page.S% $OCA$ $A!#'A#'ets the te7t enironment.Syntax

    'ET "%CA"E "A$G(AGE *lg+ ;C%($T&? *c+= ;#%D!F!E& *m+=.'ets the te7t enironment for alphabetical sorting according to the lang,age *lg+2 co,ntry *c+2 and anyf,rther modifier *m+.S% +AR#"!'ets the margin of a print page.'ET #A&G!$ *7+ ;*y+=.'ends the c,rrent list page to the spool system with a margin of *7+ col,mns from the left-hand edge and*y+ rows from the top edge of the page.S% PARA+%R'ets a 'PALGPA parameter.

  • 8/12/2019 ABAP Statement Overview a-Z

    29/34

    SyntaxSET PARAMETER ID FIELD .Copies the al,e of the field *f+ into the 'PALGPA parameter *pid+ in the ,ser-specific 'AP memory.S% PF-S%A%'S'ets the G(! stat,s.Syntax'ET PF-'TAT(' *stat+ ;E

  • 8/12/2019 ABAP Statement Overview a-Z

    30/34

    S*"P for Blan& $inesCreates blan8 lines on the o,tp,t list.SyntaxS0IP 46.Creates *n+ blan8 lines after the c,rrent line in a list. !f yo, omit *n+2 inserts one line.S*"P for Positioning

    Absol,te positioning for o,tp,t on a list.SyntaxS0IP TO LINE .Positions the list o,tp,t in line *lin+.SOR% for xtracts'orts an e7tract dataset.Syntax'%&T ;A'CE$D!$GDE'CE$D!$G= ;A' TE

  • 8/12/2019 ABAP Statement Overview a-Z

    31/34

    ;)!T F&EE 'E"ECT!%$' *freesel+=;)!T 'E"ECT!%$-TAB"E *rspar+=;"!$E-'!KE *width+=;"!$E-C%($T *length+=.Calls the program *rep+. !f yo, omit the A$D &ET(&$ addition2 the c,rrent program is terminated2otherwise2 the data from the c,rrent program is retained2 and processing ret,rns to the calling programwhen *rep+ has finished r,nning. The other additions control the selection screen and set attrib,tes of thedefa,lt list in the called program.S'B%RAC% for Single Fields',btracts two single fields.SyntaxSUTRACT FROM .The contents of *n+ are s,btracted from the contents of *m+ and the res,lt placed in *m+. E,ialent ofm / m - n.S'B%RAC%-CORRSPO!D"!#',btracts components of str,ct,res.SyntaxSUTRACT-CORRESPONDING .',btracts the contents of the components of *str,c1+ from identically-named components in *str,c3+and places the res,lts in the components of *str,c3+.

    S'+Calc,lates s,ms of gro,ps.Syntax'(#.Can only be ,sed in loops thro,gh internal tables. Calc,lates the s,ms of the n,meric fields in all lines ofthe c,rrent control leel and writes the res,lts to the corresponding fields in the wor8 area.S'PP$)Fills conte7t instances with al,es.Syntax'(PP"? *8ey1+ / *f 1+... *8ey n+ / *f n+ T% C%$TE

  • 8/12/2019 ABAP Statement Overview a-Z

    32/34

    )rites the field *f+ to the file *dsn+ on the application serer. The "E$GT addition specifies the length*len+ of the data yo, want to transfer.%RA!S$A%Conerts characters in strings.SyntaxT&A$'"ATE *c+ T% (PPE&"%)E& CA'E('!$G *r+.The characters of the string *c+ are conerted into ,pper- or lowercase2 or according to a s,bstit,tion r,lespecified in *r+.%)P-POO$!ntrod,ces a type gro,p.SyntaxT/PE-POOL .The first statement in a type gro,p. ?o, do not hae to enter this statement in the ABAP Editor - instead2it is a,tomatically inserted in the type gro,p by the ABAP Dictionary. A type gro,p is an ABAP programcontaining type definitions and constant declarations that can then be ,sed in seeral different programs.%)P-POO$SDeclares the types and constants of a type gro,p to a program.SyntaxT/PE-POOLS .

    After this statement2 yo, can ,se all of the data types and constants defined in the type gro,p *tpool+ inyo,r program.%)PS for Simle Field %yesDefines a simple field type.SyntaxT?PE' *t+;@*length+= ;T?PE *type+"!>E *ob5+= ;DEC!#A"' *dec+=.Defines the internal data type *t+ in the program with length *len+2 reference to the ABAP Dictionary type*type+ or a data ob5ect *ob5+2 and2 where appropriate2 with *dec+ decimal places.SyntaxT?PE' *t+ T?PE &EF T% *class+*interface+.Defines the internal data type *t+ in the program with reference to the class *class+ or the interface*interface+.%)PS for Aggregate %yes

    Defines aggregated types.SyntaxT?PE'H BEG!$ %F *str,ct,re+2...*ti+...2...E$D %F *str,ct,re+.Combines the data types *ti+ to form the str,ct,re *str,ct,re+. ?o, can address the indiid,alcomponents of a str,ct,re in a program ,sing a hyphen between the str,ct,re name and the componentname as followsH *str,ct,re+-*t i+.SyntaxT?PE' *t+ T?PE"!>E *tab8ind+ %F *linetype+ ;)!T *8ey+=.Defines the local data type *t+ in the program as an internal table with the access type *tab8ind+2 the line

    type *linetype+2 and the 8ey *8ey+.''$"!Places a hori4ontal line on the o,tp,t list.Syntax("!$E ;AT ;L=;*pos+=;@*len+==.)itho,t additions2 generates a new line on the c,rrent list and fills it with a hori4ontal line. The additionsallow yo, to insert a line brea8 and specify the starting position and length of the line.'!PAC*

  • 8/12/2019 ABAP Statement Overview a-Z

    33/34

    Conerts ariables from type P to type C.SyntaxUNPAC0 TO .(npac8s the pac8ed field *f+ and places it in the string *g+ with leading 4eros. The opposite of PAC>.'PDA%#odifies lines in database tables.Syntax(PDATE *dbtab+ 'ET *si+ / *f+*si+ / *s i+ 0 *f+*si+ / *s i+ - *f+ ;)E&E *cond+=.'ets the al,e in *si+ to *f+2 increases it by *f+2 or decreases it by *f+ for all selected lines. The )E&Eaddition determines the lines that are ,pdated. !f yo, omit the )E&E addition2 all lines are ,pdated.Syntax(PDATE *dbtab+ F&%# *wa+.(PDATE *dbtab+ F&%# TAB"E *itab+.%erwrites the line with the same primary 8ey as *wa+ with the contents of *wa+2 or all lines with thesame primary 8ey as a line in the internal table *itab+ with the corresponding line of itab. The wor8 area*wa+ or the lines of the table *itab+ m,st hae at least the same length and the same alignment as theline str,ct,re of the database table.

    66(!!ntrod,ces a statement bloc8 in a CA'E control str,ct,re.Syntax)E$ *f1+ ;%& *f 3+ %&...= %TE&'.The statement bloc8 after a )E$ statement is e7ec,ted if the contents of the field *f+ in the CA'Estatement are the same as those of one of the fields*f %+. Processing then res,mes after the E$DCA'E statement. The )E$ %TE&' statement bloc8 ise7ec,ted if the contents of *f+ do not correspond to any of the fields *f%+.6("$!ntrod,ces a loop.Syntax)!"E *loge7p+;:A&? *f+ F&%# *f1+ $E

    INDO STARTING AT 4ENDING AT 6.Can only be ,sed in list processing. The c,rrent detail list is displayed as a modal dialog bo7. The top left-hand corner of the window is positioned at col,mn *71+ and line *y1+. The bottom right-hand corner ispositioned at col,mn *73+ and line *y3+ @if specified.6R"%Creates list o,tp,t.Syntax

    RITE 4AT 4646466 4AS CHEC0O5*S/MOL*ICON*LINE64UIC0INFO 6.46The contents of the field *f+ are formatted according to their data type and displayed on the list. Theadditions before the field allow yo, to specify a line brea82 the starting position2 and the length of the field.The additions after the field allow yo, to display chec8bo7es2 symbols2 icons2 and lines. The *format+addition can contain ario,s other formatting options. The M(!C>!$F% addition allows yo, to assign a,ic8info *g+ to the field.6R"% %O

  • 8/12/2019 ABAP Statement Overview a-Z

    34/34

    Assigns strings.Syntax

    RITE TO 46.Conerts the contents of the data ob5ect *f1+ to type C and assigns the res,lting string to the ariable*f3+. ?o, can ,se the same formatting options aailable in the )&!TE statement.