1 / 34

ABAP Objects

hunter
Download Presentation

ABAP Objects

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


    1. Andreas Blumenthal Jürgen Heymann SAP AG ABAP Objects

    2. ABAP Objects ABAP Objects as a strategic SAP technology Programming with objects, classes, and interfaces in ABAP Interoperability with other object systems

    3. Positioning ABAP Objects Benefits of object orientation Current situation External interoperability ABAP programming What are ABAP Objects ? Benefits of ABAP Objects

    4. Benefits of Object Orientation Encapsulation - outside vs. inside Explicit interfaces Control of complexity and dependencies Reuse - of components and by inheritance Maintainability Interoperability across languages (Java, VB, ...) and object systems (DCOM/CORBA) Foundation for patterns and frameworks

    5. Current Interoperability Technology BOR (Business Object Repository) Foundation for DCOM/CORBA connection Fully featured standard object model Medium level object wrappers for business functionality written in standard ABAP BAPIs (Business APIs) Defined within the BOR Function-oriented, stable interfaces to R/3 applications Support for Internet applications

    6. Current ABAP Programming Complexity reduction by powerful high-level programming constructs Procedural abstraction (function library) Data abstraction (type pools, complex data types) Logical databases for hierarchical data access Event-oriented programming with logical databases and interactive reporting Fully integrated SQL interface In-memory tables: fast key access, sorted and/or nested, group control, ... ...

    7. What Are ABAP Objects ? Complete integration of a fully featured object model into the ABAP programming language 100% upward-compatible extension of ABAP/4 Bottom up: use objects in existing ABAP programs (reports, module- and function-pools) Top down: call forms and functions from within objects All ABAP language constructs are available within objects Fully integrated into the ABAP Workbench Class library for global classes (will absorb BOR)

    8. Benefits of ABAP Objects Identical object model for external access and internal usage Seamless object model from analysis through design to implementation Kernel-embedded foundation for objects Make OO benefits available for the implementation of the world’s largest business application True two-way interoperability: ABAP <=> Java, ABAP <=> VB, ... Speed, speed, speed ! Enabling technology for GUI programming with frontend controls (ActiveX, JavaBeans)

    9. ABAP Objects ABAP Objects as a strategic SAP technology Programming with objects, classes, and interfaces in ABAP Interoperability with other object systems

    10. Fundamentals: Objects vs. Data & Functions Objects occur 'naturally' in the world. We want to model our software accordingly E.g.: Transportation company: trucks (various kinds), loads (various), etc. Functions and data ‘Big common data structure’ and some common functions Lots of CASE statements, sparsely filled data structures Objects: car, truck, load, … Various kinds of everything, objects for truck, load, … Object: data and functions that belong together to model / implement a specific concept Fewer CASE statements, densely filled data, cohesion

    11. Fundamentals: What Is an Object ? Objects have… ...state, described by its attributes ...behavior, described by its methods ...identity to distinguish them from other objects with same state and behavior Objects can interact with each other... ...by accessing (public) attributes ...by calling methods ...by raising or handling events Objects are instances of classes

    12. The ABAP Object Classes… ...specify behavior of ‘same kind of’ objects ...define how objects can be accessed from outside (public vs. protected vs. private) ...hide implementation details ...may be specialized in subclasses

    13. An Example

    14. Some Important Points Objects are created dynamically Storage management, garbage collection Access to objects via object reference only!!! Distinguish instances by object reference Only and explicit means of dependency Sharing always and only via (object) references (similar to field-symbols; all other ABAP types are value-based!) Internal data hidden from users Private data accessible only by the object’s methods

    15. Component Definitions Attributes… ...store the internal state of an object (data) ...can be references to other objects …can be: read-only, virtual, class attributes …can be constants Virtual attributes: ‘Attribute’ from the outside, inside the object Set- and Get-methods. Dynamic control of Set-/Get-methods.

    16. Component Definitions Methods… …are operations on objects (the ‘functionality’) …are the only way to change the state of an object (other than public attributes) ...have parameters and can raise exceptions (similar to function modules) ...can pass back a return value No method-name overloading!

    17. Using Attributes and Methods

    18. Component Definitions Events... ...occur at a particular point in time, e.g. ‘change in state of an object’ ...can be raised to inform other interested objects ...can pass parameters

    19. Event Handling Events are handled by classes General publish-subscribe model Syntax similar to ‘Visual Basic’ event handling Event handlers... ...are methods for handling events from other objects ...are declared with reference to the event to be handled (signature from there) …must be ‘registered’ explicitly

    21. Class Component Definitions Class attributes... ...are data on class level, independent of object / instance ...are ‘always there’ like global variables / functions ...have global lifetime, with scope tied to class Class methods... ...can only access class attributes ...can be called like ‘global functions’, but are tied to class

    22. Using Class Components

    23. Inheritance A class can be derived from another Only specify what is different / added Add attributes and methods Redefine / override existing methods (in any section) = change implementation, ‘slight change’ of interface possible ‘Single inheritance’ on class

    24. Using Inheritance Polymorphism on object references

    25. Interfaces define the interaction between different objects Polymorphism independent of class / inheritance Classes can implement multiple interfaces Uniform access through interface reference

    26. Interfaces... …can define same components as class - without implementation ...may ‘enclose’ multiple other interfaces (hierarchy) …have separate name spaces for their components Components of enclosed interfaces are not visible in the top-level interface (‘black boxes’); there is a mapping/aliasing feature

    27. Implementation of interfaces A class can implement many interfaces Interfaces are implemented ‘side-by-side’ in a class (like COM) No name conflicts on the class level No semantic conflicts at class level and interface composition Using interfaces Access by interface reference like object reference An interface reference only exposes the components of that interface Assignment / ‘cast’ to another interface possible

    28. Interface Example

    29. Interfaces and Classes

    30. Naming and Visibility Class components... …share a common name space within the class ...may be public = visible to all protected = visible to subclasses and implementation private = visible to the class implementation only ...depend on instance data or not Interface components Separate name space for interface components Interfaces are visible as a whole (like ‘view’)

    31. Miscellaneous Avoid naming conflicts, selectively make components visible Constructor (Destructor) Friends

    32. The ABAP Object Model Summary Classes and interfaces Attributes, methods, and events Classes can implement interfaces Interface composition Single inheritance for classes, multiple composition + aliasing for interfaces Event handling

    33. ABAP Objects ABAP Objects as a strategic SAP technology Programming with objects, classes, and interfaces in ABAP Interoperability with other object systems

    35. Interoperability Features Transparent two-way mapping between ABAP Objects and external object models Automatic generation of proxies and stubs Location transparency: CREATE OBJECT obj DESTINATION dest Delta management for mass data For details see presentation on Distributed Objects

More Related