Upload
oswaldo-rondon
View
115
Download
13
Embed Size (px)
Citation preview
ABAP151:
ABAP Objects for Java Developers
Horst Keller, SAP AG
Björn Mielenhausen, SAP AG
ABAP Special Features
Summary
Motivation
Similarities Between Java and ABAP
© SAP AG 2004, SAP TechEd / ABAP151 / 4
Learning Objectives
As a result of this workshop, you will be able to:
Write a program in ABAP as you would in Java
Find information on all ABAP statements
Understand the components of an ABAP program
Understand the types of ABAP programs
Understand the role of ABAP repository objects
Make use of the ABAP Workbench
ABAP Special Features
Summary
Motivation
Similarities Between Java and ABAP
© SAP AG 2004, SAP TechEd / ABAP151 / 6
Motivation
What‘s in the box?© Wiley Publishing, Inc., 2004, ISBN 0-7645-6883-3
© SAP AG 2004, SAP TechEd / ABAP151 / 7
Motivation
A little bit about ABAP ...
... and a lot of of J-words
© SAP AG 2004, SAP TechEd / ABAP151 / 8
Motivation
Why should any Java developer care about ABAP?
© SAP AG 2004, SAP TechEd / ABAP151 / 9
Motivation
That‘s why!
© SAP AG 2004, SAP TechEd / ABAP151 / 10
Motivation
ABAP Java
rewrite code
reuse code
Some ABAP knowledge is required!
Millions of linesof coding
Millions ofdevelopers
ABAP Special Features
Summary
Motivation
Similarities Between Java and ABAP
© SAP AG 2004, SAP TechEd / ABAP151 / 12
Similarities Between Java and ABAP
Like Java,
ABAP is a programming language
ABAP is object-oriented
ABAP runs on a virtual machine
ABAP is the foundation for a whole technology
© SAP AG 2004, SAP TechEd / ABAP151 / 13
Similarities – Typical Java Development Tool
© SAP AG 2004, SAP TechEd / ABAP151 / 14
Similarities – ABAP Development Tool
© SAP AG 2004, SAP TechEd / ABAP151 / 15
Similarities - Classes
class Account {
private int amount;
public Account(String id) {...
}
public void deposit(int amount) {...
}...
}
Java
CLASS account DEFINITION.PUBLIC SECTION.METHODS: constructor IMPORTING id TYPE string,deposit IMPORTING amount TYPE i,
PRIVATE SECTION.DATA:amount TYPE i.
ENDCLASS.
CLASS account IMPLEMENTATION.METHOD constructor....
ENDMETHOD.METHOD deposit....
ENDMETHOD....
ENDCLASS.ABAP
Syntactical differences aside, ABAP supports classes as Java does
In ABAP, the declaration and implementation of a class are split intoseparate parts
© SAP AG 2004, SAP TechEd / ABAP151 / 16
Similarities – Attributes and Methods
private int amount;
Java
PRIVATE SECTION.DATA:amount TYPE i
ABAP
Syntactical differences aside, ABAP supports attributes and methods as Java does (apart from method name overloading)
In ABAP, a class has three visibility sections (PUBLIC, PROTECTED, PRIVATE)
public void transfer(int amount,Account target)
throws NegativeAmountException
Java
PUBLIC SECTION.METHODS:transfer IMPORTING
amounttarget TYPE REF TO account
RAISING cx_negative_amount.
ABAP
© SAP AG 2004, SAP TechEd / ABAP151 / 17
Similarities – Method Implementationspublic void withdraw ... {
if (this.amount>amount) {this.amount=this.amount-amount;
}else {throw new NegativeAmountException();
}}
Java
METHOD withdraw.IF me->amount > amount.me->amount = me->amount - amount.
ELSE.RAISE EXCEPTION TYPE cx_negative_amount.
ENDIF.ENDMETHOD.
ABAP
For basic operations, syntax can be translated almost one to one
”->” (or ”-”) replaces ”.”, ”.” replaces ”;”, ”me” replaces ”this”
In ABAP, blocks are built by keywords instead of {}
Raising exceptions follows the same principles
© SAP AG 2004, SAP TechEd / ABAP151 / 18
Similarities – Exceptions and Inheritance
class NegativeAmountException extends Exception{ }
Java
CLASS cx_negative_amount DEFINITION INHERITING FROM cx_static_check.ENDCLASS.
ABAP
Exception classes must be derived from predefined superclasses
The superclasses define how exception handling is checked
Throwable
RuntimeException
Exception Error
cx_root
cx_no_checkcx_static_check cx_dynamic_check
© SAP AG 2004, SAP TechEd / ABAP151 / 19
Similarities – Handling Objects in Java
public class BankApplication {
public static void main(String[] args) {
Account account1;Account account2;int amnt;
account1 = new Account("...");account2 = new Account("...");
try {amnt = ...;account1.transfer(amnt,account2);
}catch (NegativeAmountException excRef) {System.out.println("Negative Amount");
}}
}
Java
Reference Variables
Object Creation
Method Invocation
Exception Handling
© SAP AG 2004, SAP TechEd / ABAP151 / 20
Similarities – Handling Objects in ABAP
CLASS bank_application DEFINITION.PUBLIC SECTION.CLASS-METHODS main.
ENDCLASS.
CLASS bank_application IMPLEMENTATION.METHOD main.DATA: account1 TYPE REF TO account,
account2 TYPE REF TO account,amnt TYPE i,exc_ref TYPE REF TO cx_negative_amount,text TYPE string.
CREATE OBJECT: account1 EXPORTING id = `...`,account2 EXPORTING id = `...`.
TRY.amnt = ...account1->transfer( EXPORTING amount = amnt
target = account2 ).CATCH cx_negative_amount INTO exc_ref.text = exc_ref->get_text( ).MESSAGE text TYPE 'I'.
ENDTRY.ENDMETHOD.
ENDCLASS.ABAP
Reference Variables
Object Creation
Method Invocation
Exception Handling
© SAP AG 2004, SAP TechEd / ABAP151 / 21
Similarities – Keywords 1
Four-byte integer iintIncludes packages-importInterface implementationINTERFACESimplementsBranchingIF, ENDIFifIterationWHILEforSimple precision floating point numbers-floatException handlingCLEANUPfinallyFinal classes and methodsFINALfinalBoolean value-falseBranchingELSE, ELSEIFelseDouble precision floating point numbersfdoubleIterationDOdoBranchingWHEN OTHERSdefaultProceed with next iterationCONTINUEcontinueConstant data objectCONSTANTSconstClass definitionCLASSclassCharacter data typec, stringcharException handlingCATCHcatchBranchingWHENcaseOne-byte integerbbyteLeaves an iterationEXITbreakBoolean data type-booleanAbstract classes and methodsABSTRACTabstractPurposeABAPJava
© SAP AG 2004, SAP TechEd / ABAP151 / 22
Similarities – Keywords 2
IterationWHILEwhileReturn value of a methodRETURNINGvoidException handlingTRYtryBoolean value-truePrevent serialization- (implemented by self defined serialization)transientPropagates exceptionsRAISINGthrowsSelf referencemethisThreading/parallel processingCALL FUNCTION DESTINATION IN GROUPsynchronizedBranchingCASEswitchAddresses the super class supersuperEnforces IEEE norm for floating point operations-strictfpStatic class componentsCLASS-...staticTwo-byte integersshortLeaves a methodRETURNreturnProtected componentsPROTECTEDprotectedPrivate componentsPRIVATEprivatePackages- (supported by tools)packageNull referenceCLEAR, INITIALnullObject instantiationCREATEnewInvocation APIBY KERNEL MODULEnativeEight-byte integer-longInterface definitionINTERFACEinterfacePurposeABAPJava
© SAP AG 2004, SAP TechEd / ABAP151 / 23
Similarities – Built-in Data Types
Time field (HHMMSS)t-Character stringstring-
Date field (YYYYMMDD)d-
Packed number (BCD)p-Numeric character fieldn-
Byte stringxstring-
Two-byte integersshort
Single precision floating point
-float
Double precision floating point
fdouble
Eight-byte integer-longFour-byte integeriint
Character fieldccharOne-byte integerb, xbyteBoolean data type-booleanDescriptionABAPJava
Handling dates
Handling times
Variable length
Business calculations
ABAP specials:
© SAP AG 2004, SAP TechEd / ABAP151 / 24
Similarities – J2EE Architecture
DesktopApplication
DynamicHTML Pages
EnterpriseBeans
JSP
EnterpriseBeans
DB DB
Presentation Layer
Application Layer (WAS)
Database Layer
© SAP AG 2004, SAP TechEd / ABAP151 / 25
Similarities – ABAP Architecture
SAP GUIDynamic
HTML Pages
ABAPPrograms
BSP
ABAPClasses
DB
Presentation Layer
Application Layer (WAS)
Database Layer
(Web) Dynpro
ABAP Special Features
Summary
Motivation
Similarities Between Java and ABAP
© SAP AG 2004, SAP TechEd / ABAP151 / 27
ABAP Special Features – Many Keywords 1
DATABASEDATADCUSTOMER-FUNCTION
CURSOR-SELECTIONCURSORCURRENTCURRENCY
CSEQUENCECSCREATECPICPCOVERCOUNTRYCOUNT
COSHCOSCORRESPONDINGCOPIESCONVERTCONVERSIONCONTROLSCONTROL
CONTINUECONSTANTSCONNECTIONCONNECTCONDITIONCONDENSECONCATENATECOMPUTE
COMPRESSIONCOMPONENTSCOMPONENTCOMPARINGCOMMONCOMMITCOMMENTCOLUMN
COLORCOLLECTCOL_TOTALCOL_POSITIVECOL_NORMALCOL_NEGATIVECOL_KEYCOL_HEADING
COL_GROUPCOL_BACKGROUNDCODEPAGECODECOCNCLOSECLOCK
CLIKECLIENTCLEARCLEANUPCLASS-POOLCLASS-METHODSCLASS-EVENTSCLASS-DATA
CLASSCIRCULARCHECKBOXCHECKCHARLENCHARACTERCHAR-TO-HEXCHANGING
CHAIN-REQUESTCHAIN-INPUTCHAINCENTEREDCEILCATCHCASTINGCASE
CALLINGCALLCACBYTE-NSBYTE-NABYTE-CSBYTE-CO
BYTE-CNBYTE-CABYTEBYPASSINGBYBUFFERBTBREAK-POINT
BOUNDSBOUNDARIESBOUNDBLUEBLOCKSBLOCKBLANKSBLANK
BLACKBIT-XORBIT-ORBIT-NOTBIT-ANDBITBINARYBIG
BETWEENBEGINBEFOREBACKWARDBACKGROUNDBACKAVGAUTHORITY-CHECK
AUTHORITYATTRIBUTESATANATASSIGNINGASSIGNEDASSIGNASSERT
ASINASCENDINGASARITHMETICAREAARCHIVEAPPLICATIONAPPENDING
APPENDAGEAPPENDANYANDANALYZERALLALIASESAFTER
ADJACENTADDACTUALACTIVATIONACOSACCEPTINGABSTRACTABS
Java has about 50 keywords – ABAP has more than 700 …
© SAP AG 2004, SAP TechEd / ABAP151 / 28
ABAP Special Features – Many Keywords 2
INOUTINNERINITIALIZATIONINITIALINHERITINGINDEX-LINEINDEXINCREMENT
INCLUDINGINCLUDEINIMPORTINGIMPORTIMPLEMENTATIONIMMEDIATELYIGNORING
IFIDSIDENTIFICATIONIDICONIHOTSPOTHOLD
HNHINTHIGHHIDEHELP-REQUESTHELP-IDHEADINGHEADER
HEAD-LINESHAVINGHASHEDHANDLERHANDLEGTGROUPSGROUP
GREENGLOBALGETGENERATEGEGAPSFUNCTION-POOLFUNCTION
FTOFROMFRIENDSFREEFRAMESFRAMEFRACFOUND
FORWARDFORMATFORMFORFONTFLUSHFLOORFIXED-POINT
FIRST-LINEFIRSTFINDFINALFILTERFILEFIELDSFIELD-SYMBOLS
FIELD-GROUPSFIELDFETCHFEXTRACTEXTENSIONEXTENDEDEXPORTING
EXPORTEXPONENTEXPIRATIONEXPEXIT-COMMANDEXITEXISTSEXECUTE
EXECEXCLUDINGEXCLUDEEXCEPTIONSEXCEPTION-TABLEEXCEPTIONEVENTSEVENT
ESCAPEERRORSERRORMESSAGEEQENTRYENTRIESENHANCEMENT-SECTION
ENHANCEMENT-POINT
ENHANCEMENTENDWHILEENDTRYENDSELECTENDPROVIDEENDMODULEENDMETHODENDLOOP
ENDINTERFACEENDINGENDIFENDIANENDFUNCTIONENDFORMENDEXECENDENHANCEMENT
ENDDOENDCLASSENDCHAINENDCATCHENDCASEENDATEND-OF-SELECTIONEND-OF-PAGE
END-OF-FILEEND-OF-DEFINITIONEND-LINES
END-ENHANCEMENT-SECTION
ENDENCODINGENABLINGENABLED
ELSEIFELSEEDITOR-CALLEDITEDYNPRODYNAMICDURING
DUPLICATESDUPLICATEDUMMYDODIVIDEDIVDISTINCTDISTANCE
DISPLAY-MODEDISPLAYDISCONNECTDIRECTORYDIALOGDESTINATIONDESCRIBEDESCENDING
DEPARTMENTDELETINGDELETEDEFINITIONDEFININGDEFINEDEFERREDDEFAULT
DECIMALSDDMMYYDD/MM/YYYYDD/MM/YYDBMAXLENDAYLIGHTDATEDATASET
© SAP AG 2004, SAP TechEd / ABAP151 / 29
ABAP Special Features – Many Keywords 3
REGEXREFRESHREFERENCEREFREDEFINITIONREDRECEIVINGRECEIVER
RECEIVEREAD-ONLYREADRANGERAISINGRAISERADIOBUTTONQUICKINFO
QUEUE-ONLYPUTPUSHBUTTONPUBLICPROVIDEPROTECTEDPROPERTYPROGRAM
PROCESSPROCEDUREPRIVATEPRINT-CONTROLPRINTPRIMARYPREFERREDPOSITION
POOLPLACESPINKPF-STATUSPFPERFORMINGPERFORMPATTERN
PARTPARAMETERSPARAMETER-TABLEPARAMETERPAGESPAGEPADDINGPACKAGE
POVERLAYOUTPUT-LENGTHOUTPUTOUTEROUTOTHERSORDER
OROPTIONSOPTIONALOPTIONOPENONLYONOLE
OFFSETOFFOFOCCURSOCCURRENCESOCCURRENCEOBLIGATORYOBJECTS
OBJECTONUMOFCHARNUMERICNUMBERNULLNSNP
NOTNON-UNIQUENON-UNICODENODESNODENO-ZERONO-TOPOFPAGENO-TITLE
NO-SIGNNO-SCROLLINGNO-HEADINGNO-GROUPINGNO-GAPSNO-GAPNO-EXTENSIONSNO-EXTENSION
NO-DISPLAYNONEXTNEW-SECTIONNEW-PAGENEW-LINENEWNESTING
NENBNAMENANMULTIPLYMOVE-CORRESPONDINGMOVE
MODULEMODIFYMODIFIERMODIFMODEMODMMDDYYMM/DD/YYYY
MM/DD/YYMINOR-IDMINMETHODSMETHODMESSAGESMESSAGE-IDMESSAGE
MEMORYMAXIMUMMAXMATCHCODEMATCHMASKMARGINMAJOR-ID
MAINMLTLPILOWERLOWLOOPLOGFILE
LOG10LOGLOCALELOCALLOAD-OF-PROGRAMLOADLITTLELISTBOX
LIST-PROCESSINGLISTLINESLINE-SIZELINE-SELECTIONLINE-COUNTLINELIKE
LEVELLENGTHLEGACYLEFT-JUSTIFIEDLEFTLEAVELEADINGLE
LAYOUTLATELASTLANGUAGEKINDKEYSKEYKERNEL
KEEPINGKEEPJOINJOBISINVERSEINTOINTERVALS
INTERNALINTERFACESINTERFACE-POOLINTERFACEINTENSIFIEDINSTANCESINSERTINPUT
© SAP AG 2004, SAP TechEd / ABAP151 / 30
ABAP Special Features – Many Keywords 4
ZONEZYYMMDDYELLOW
XSTRLENXSTRINGXSEQUENCEXMLXWRITEWORKWORD
WITHOUTWITH-TITLEWITH-HEADINGWITHWINDOWWIDTHWHILEWHERE
WHENEVERWHENWARNINGWAITVISIBLEVIAVERSIONVARYING
VARYVALUESVALUE-REQUESTVALUEVALIDUTF-8USINGUSER-COMMAND
USERUPPERUPDATEUPUNTILUNPACKUNITUNIQUE
UNICODEUNDERUNASSIGNULINETYPESTYPE-POOLSTYPE-POOLTYPE
TRYTRUNCATIONTRUNCATETRUNCTRANSPORTINGTRANSLATETRANSFORMATIONTRANSFER
TRANSACTIONTRAILINGTRACE-TABLETRACE-FILETOP-OF-PAGETOP-LINESTOTITLEBAR
TITLE-LINESTITLETIMESTIMETEXTPOOLTEXTTESTINGTASK
TANHTANTABSTRIPTABLEVIEWTABLESTABLETABBEDTAB
TSYSTEM-EXITSYSTEM-EXCEPTIONSSYSTEM-CALLSYNTAX-CHECKSYMBOLSUPPRESSSUPPLIED
SUMSUFFIXSUBTRACTSUBSTRINGSUBSCREENSUBROUTINESUBMITSUBMATCHES
SUBKEYSTRUCTURESTRLENSTRINGSTOPSTEP-LOOPSTATICSSTATIC
STATEMENTSTATESTARTINGSTART-OF-SELECTIONSTANDARDSTAMPSTABLESQRT
SQLSPOTSSPOOLSPLITSPECIFIEDSOURCESORTEDSORTABLE
SORTSOMESKIPSIZESINHSINGLESINSIMPLE
SIGNSHORTDUMP-IDSHIFTSHAREDSETSEPARATEDSEPARATESELECTIONS
SELECTION-TABLESELECTION-SETSSELECTION-SETSELECTION-
SCREENSELECTIONSELECT-OPTIONSSELECTSECTION
SECONDSSEARCHSCROLLINGSCROLL-BOUNDARYSCROLLSCREENSAVINGSAP-SPOOL
SAPRUNROWSROUNDROLLBACKRIGHT-JUSTIFIEDRIGHTRFC
RETURNINGRETURNRESULTSRESULTRESPECTINGRESOLUTIONRESETRESERVE
REQUESTEDREQUESTREPORTREPLACINGREPLACEMENTREPLACERENAMINGREJECT
© SAP AG 2004, SAP TechEd / ABAP151 / 31
ABAP Special Features – Many Keywords 5
Is a historically grown 4GL language
Is specialized for business applications
Sometimes uses keywords instead of operands
Has only few system classes
ABAP:
You:Can use most of these keywords in method implementations
Will find almost all of these keywords in existing coding
© SAP AG 2004, SAP TechEd / ABAP151 / 32
ABAP Special Features – Many Keywords 6
Enables extensive syntax and type checks at compile time
Is more flexible when using additions and operands comparedto method calls
Is highly optimized with regard to performance
Enables efficient application development by powerful concepts - for example, large data volumes can be processed efficiently
Allows seamless and easy integration of important interfaces to services (for example, SQL, XSLT, screen programming, external programs, and so on)
Results in a consistent documentation of everything a businessapplication programmer needs to know
On the other hand, using language statementsinstead of classes:
© SAP AG 2004, SAP TechEd / ABAP151 / 33
ABAP Special Features – Keyword Documentation
© SAP AG 2004, SAP TechEd / ABAP151 / 34
ABAP Special Features – Runtime Environment 1
ABAP is the programing interface of SAP NetWeaver Web Application Server ABAP
→ You need a WAS to work with ABAP
1. A WAS is available in your enterprise: Everyone with developer authorizations can program ABAP
2. For training purposes, a Mini WAS ABAP is available
1. (Almost) for free atwww.sap.com/company/shop(SAP Knowlede Shop → General → SAP NetWeaver → WAS)
2. For free as SAP Press book CDs
© SAP AG 2004, SAP TechEd / ABAP151 / 35
ABAP Special Features – Runtime Environment 2
Persistent Data(Database, Files, ...)
User Interface(SAP GUI, Web, ...)
WebApplicationServer
...SELECT * FROM ......
ABAP
ABAP Objects
© SAP AG 2004, SAP TechEd / ABAP151 / 36
ABAP Special Features – Runtime Environment 3
WebApplicationServer
CLASS ...... SELECT * FROM ......
ENDCLASS.
CLASS ...... SELECT * FROM ......
ENDCLASS.
CLASS ...METHOD main.
...ENDMETHOD.
ENDCLASS.ABAP Programs
ABAP Virtual Machine
Processes
© SAP AG 2004, SAP TechEd / ABAP151 / 37
ABAP Special Features – Program Execution 1
Magic word for ABAP program execution: Transaction code
Transaction codes call programs –for example, SE80 calls the ABAP Workbench, which is written in ABAP
Transaction codes are usually hiddenbehind menu entries, for example.
Transaction codes entered in theinput fields of the standard toolbar of an ABAP-based SAP System serveas shortcuts (SE93)
© SAP AG 2004, SAP TechEd / ABAP151 / 38
ABAP Special Features – Program Execution 2
Creating a transaction code
execute method main of class bank_application in program BANKAPPLICATION
© SAP AG 2004, SAP TechEd / ABAP151 / 39
ABAP Special Features – ABAP and Database Access 1
ABAP is tailor-made for (mass) data processing in businessapplications based on relational databases.
The language and the runtime environment have many features thatsupport business programming (for example, support of internationalization, distributed programming (RFC), authoritychecks).
The most important aspect of business programming in ABAP is itshandling of database tables:
Databases are generated from data types in the ABAP Dictionary
Database access is integrated into the language as Open SQL
Performance of database accesses is optimized via a bufferingmechanism integrated into the runtime environment
OLTP (Online Transaction Programming) is supported by the SAP LUWconcept (transaction and enqueue handling) for many user systems
© SAP AG 2004, SAP TechEd / ABAP151 / 40
ABAP Special Features – ABAP and Database Access 2
ID AMOUNT
... ...Database
ABAP Dictionary
CLASS account DEFINITION.PUBLIC SECTION.METHODS:
constructorIMPORTING id TYPE accounts-id,
depositIMPORTING amount TYPE accounts-amount,
PRIVATE SECTION.DATA:
amount TYPE accounts-amount.ENDCLASS.
CLASS account IMPLEMENTATION.METHOD constructor.SELECT SINGLE amount
FROM accountsINTO (amount)WHERE id = id.
ENDMETHOD....
ENDCLASS.ABAP
© SAP AG 2004, SAP TechEd / ABAP151 / 41
ABAP Special Features – The ABAP Type System 1
Types
Data Types
Elementary Daty Types
Fixed Length
Variable Length
Objects
Data Objects
Elementary Data Objects
Static Data Objects
Dynamic Data Objects
f
i
x
Floating Point Numbers
Integers
Byte Fields
string
xstring
Character Strings
Byte Strings
data, any
clike
csequence
numeric
simple
xsequence
c
d Date Fields
n Numeric Text Fields
t Time Fields
p Packed Numbers
Text Fields
Generic Types
© SAP AG 2004, SAP TechEd / ABAP151 / 42
ABAP Special Features – The ABAP Type System 2Types
Data Types
Complex Data Types
Structured Types
Table Types
Object Types
Classes
Interfaces
Objects
Data Objects
Complex Data Objects
Structures
Internal Tables
Reference Types
Data References
Object References
Reference Variables
Data Reference Variables
Object Reference Variables
Interface References Interface Reference Variables
Class References Class Reference Variables
Objects
Index Tables
Standard Tables
Sorted Tables
Hashed Tables
Standard Tables
Sorted Tables
Hashed Tables
data, any
object
any table
[standard] table
sorted table
hashed table
index table
© SAP AG 2004, SAP TechEd / ABAP151 / 43
ABAP Special Features – The ABAP Type System 3
TYPES account_tab_type TYPE HASHED TABLE OF accountsWITH UNIQUE KEY id.
DATA account_tab TYPE account_tab_type.
DATA account_wa TYPE accounts.
SELECT *FROM accountsINTO TABLE account_tabWHERE id = ...
READ TABLE account_tabWITH TABLE KEY id = ...INTO account_wa.
ABAP
Local Type in Program Internal Table Type
ABAP Dictionary
Internal Table
Structure
© SAP AG 2004, SAP TechEd / ABAP151 / 44
ABAP Special Features – ABAP’s Procedural Heritage 1
ABAP Objects, the object-oriented extension of ABAP isvery similar to JAVA:
ABAP Objects is based on classes and interfaces.
Classes and interaces have attributes and methods as components.
Objects are created from classes and are accessed via referencevariables.
Polymorphism is supported by interface implementation and singleinheritance.
Addtionally, ABAP Objects allows events as components of classes
Events are declared with EVENTS and can be raised inside methodsusing RAISE EVENT.
Methods can become event handlers with METHODS ... FOR EVENTEvents can be registered at runtime using SET ACTIVATION
But: there was an ABAP world before ABAP Objects!
© SAP AG 2004, SAP TechEd / ABAP151 / 45
ABAP Special Features – ABAP’s Procedural Heritage 2
Before the introduction of methods in classes, modularization was carried out with function modules (external) and subroutines (internal) in programs:
ABAP Program
* Global Declarations ...DATA ...
FORM ...DATA ......
ENDFORM.
Function Group
* Global Declarations ...DATA ...
FORM ...DATA ......SELECT * FROM ......
ENDFORM.
......CALL FUNCTION ...PERFORM ......END...
FUNCTION ...DATA ......PERFORM ......
ENDFUNCTION.
© SAP AG 2004, SAP TechEd / ABAP151 / 46
ABAP Special Features – ABAP’s Procedural Heritage 3
Before the introduction of transaction codes linked to methods in classes, program execution was carried out using transaction codes linked to dynpros(screens) or by calling a special reporting process in the runtime environment:
ABAP Program
* Global Declarations ...DATA ...
LOAD-OF-PROGRAM....
START-OF-SELECTION....
ABAP Virtual MachineReporting Process
SUBMIT ...
ABAP Program
* Global Declarations ...DATA ...
MODULE ......
ENDMODULE.
Dynpro
PROCESS AFTER INPUT.MODULE ...
TCODE
© SAP AG 2004, SAP TechEd / ABAP151 / 47
ABAP Special Features – ABAP Program Types 1
xxxxxTransaction Code
xSUBMITxxxxSubroutines
xFunction Modules
xxxxxMethods
xxxxxxInterfaces
xxxxxClasses
xReporting Events
xxxList Events
xxxSelection Screen Events
xxxDialog Modules
xxxDynpro
xxxxxxGlobal Data
Interface Pool
Class Pool
Type Pool
Subroutine Pool
Function Pool
Module Pool
Executable Program
SupportedFeatures
There are lot of different types of ABAP programs!
The type of a program defines its features and how it is executed in the runtimesystem.
© SAP AG 2004, SAP TechEd / ABAP151 / 48
ABAP Special Features – ABAP Program Types 2
You might also encounter include programs. These are textually included in other programs and inherit their environment.
© SAP AG 2004, SAP TechEd / ABAP151 / 49
ABAP Special Features – Development Environment 1
Java/J2EE (SAP solution)
RepositoryLocal Development
Environments
LocalDevelopment
Activation
Build Service J2EE Server
Check Out
Check In
SourceCode Archive
Pool Deployment
© SAP AG 2004, SAP TechEd / ABAP151 / 50
ABAP Special Features – Development Environment 2
ABAPSAP Systems(Development)
ABAP Workbench
DevelopersDevelopersDevelopers
SAP Systems(Consolidation and Test)
WAS
DevelopersDevelopersQM, Tester
SAP Systems(Productive)
WAS
DevelopersDevelopersEnd User
CTS CTS
Repository Objectsin Packages
Programs, Screens, Classes, Interfaces, BSPs, Data Types, Function Modules, ...
© SAP AG 2004, SAP TechEd / ABAP151 / 51
ABAP Special Features – Development Environment 3
Specialized Tools for various Repository Objects:
ABAP Editor for ABAP Source Code (programs, implementations).
Class Builder for Global Classes and Interfaces
ABAP Dictionary for Global Data Types and Database Tables
Function Builder for Function Groups and Function Modules
Web Application Builder for BSPs
Screen Painter for Dynpros
Menu Painter for Taskbars
...
Simple Usage via Forward Navigation in ABAP Worbench.
ABAP Special Features
Summary
Motivation
Similarities Between Java and ABAP
© SAP AG 2004, SAP TechEd / ABAP151 / 53
Summary
ABAP Objects itself is very similar to Java.
However, ABAP is more than ABAP Objects.
In ABAP, the role of many statements is equivalent to that of methods in Java.
ABAP is in part a highly specialized programminginterface of the WAS.
It is sufficient to know the basic (Java-like) languageelements of ABAP in order to get started.
Complex (library-type) language elements of ABAP can belooked up on demand.
© SAP AG 2004, SAP TechEd / ABAP151 / 54
Further Information
ABAP Documentation:Always the first source of information
Articles in Journals:http://www.intelligenterp.com/feature/archive/heymann.shtml
http://www.intelligenterp.com/feature/archive/keller.shtml
http://www.sappublications.com/insider/article.htm?key=20248
Many ABAP articles at http://www.sappro.com
SAP Press Books:ABAP Objects, Introduction: ISBN 0-201-75080-5 (English)ISBN 3-89842-147-3 (German)
ABAP Objects, Reference:ISBN 1-59229-011-6 (English)ISBN 3-89842-444-8 (German)for more books visit http://www.sap-press.com, http://www.sappress.de.
© SAP AG 2004, SAP TechEd / ABAP151 / 55
SAP Developer Network
Look for SAP TechEd ’04 presentations and videos on the SAP Developer Network.
Coming in December.
http://www.sdn.sap.com/
© SAP AG 2004, SAP TechEd / ABAP151 / 56
Q&A
Questions?
© SAP AG 2004, SAP TechEd / ABAP151 / 57
Please complete your session evaluation.
Be courteous — deposit your trash, and do not take the handouts for the following session.
Feedback
Thank You !
© SAP AG 2004, SAP TechEd / ABAP151 / 58
No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice.
Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors.
Microsoft, Windows, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation.
IBM, DB2, DB2 Universal Database, OS/2, Parallel Sysplex, MVS/ESA, AIX, S/390, AS/400, OS/390, OS/400, iSeries, pSeries, xSeries, zSeries, z/OS, AFP, Intelligent Miner, WebSphere, Netfinity, Tivoli, and Informix are trademarks or registered trademarks of IBM Corporation in the United States and/or other countries.
Oracle is a registered trademark of Oracle Corporation.
UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.
Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc.
HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C®, World Wide Web Consortium, Massachusetts Institute of Technology.
Java is a registered trademark of Sun Microsystems, Inc.
JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape.
MaxDB is a trademark of MySQL AB, Sweden.
SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.
These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.
Copyright 2004 SAP AG. All Rights Reserved