Currently Being Moderated
Thomas Jung

Basic ABAP OO eLearnings

Posted by Thomas Jung in thomas.jung on Aug 11, 2009 6:29:17 AM

Introduction 

This blog introduces a 5 part eLearning series based upon a frequent request – to look at basic ABAP Object Oriented concepts. Throughout this series we will look at OO terminology, development tools, and design patterns that span a variety of ABAP release levels. We will try to keep the discussion away from all the new cutting edge syntax so that it is still quite usable for those of you on older releases like 4.6C or 6.20.

For the 5 part series we will start with Part 1 looking at tooling (the ABAP Class Builder) and some basic terminology. In Part 2 we will expand the lesson by looking at static vs. instance, visibility, exception classes, inheritance, polymorphism and abstract classes. In part 3 we will see how a special type of class, called a persistent object, can be used for Object Oriented access to the database. In part 4 we will explore Object Oriented concepts in User Interface technologies. Keeping with the theme of older release levels, we will focus this part on using Model View Controller and OO eventing within Classic Dynpro applications. Finally in part 5 we will look at real world, complex example that uses all the techniques and technologies from the previous parts.

Part 1 - Basics

In Part1 of the eLearning we start with the very most basic concepts. We will explore the class builder tool within SE80 and discuss some of the terminology that you need to know in order to begin to learn Object Oriented design and development.

Part 1 Video Running Time: 53 Minutes

Part 2 - Classes, Inheritance, Visibility, Polymorphism

In this part, we will expand the lesson by looking at static vs. instance, visibility, exception classes, inheritance, polymorphism and abstract classes. We start with a very basic class with only static methods that works very much like a Function Group/Function Modules. Next we change the methods into instance methods and see how a class instance allows us to model complex data structures and relationships in code. Then we see how exception classes can make our exceptions more meaningful and simplify the surrounding code for dealing with exceptions. Finally we see the real power of object oriented design come to life as we use inheritance and polymorphism to hide the inner complexity of our business logic from calling applications all while ensuring uniform execution of our code. These techniques may feel foreign at first, but in the long run they lead to code that is easier and safer to maintain.

Part 2 Video Running Time: 1 Hour, 10 Minutes

Part 3 - Persistant Objects

In this part, we will expand the lessons of the previous tutorial and look at a special type of class in ABAP – the Persistent Object. Persistent Objects are an OO-based approach to the types of data access that you would normally perform with SQL statements. With Persistent Objects you don’t code any SQL statements. Instead a class is generated for you that contains SET and GET methods for reading and updating data. ABAP Persistent Objects also contain the functionality for more complex update scenarios – like V2 Asynchronous updates.

Part 3 Video Running Time: 1 Hour, 9 Minutes

Part 4 - User Interface

In this part, we look at the special use case of Object Oriented technology and design techniques as they are applied to User Interface creation. Throughout all the ABAP UI technologies, we study how MVC (Model View Controller) design can be applied. We look briefly at BSP and Web Dynpro ABAP and OO effects the overall design as well as specific features like UI element rendering and eventing. We close with an example of how you can adapt even Classic Dynpro and its PBO/PAI processing looks to a more Object Oriented MVC flow.

Part 4 Video Running Time: 1 Hour

Part 5 - Putting It All Together

In this final entry in the 5 part ABAP OO series, we examine examples of how SAP puts the techniques that we learned in the previous 4 sessions to work within the standard code that they deliver to customers. We start by looking at the CL_BCS classes for sending email. CL_BCS* serves as a perfect example of the use of Persistent Objects and Polymorphism. We also look at the functionality behind the new ABAP Code Completion feature in the ABAP Editor. This block of code uses Persistent Objects, Inheritance/Polymorphism, Exception Classes, and MVC structured Classic Dynpro.

Part 5 Video Running Time: 42 Minutes

Source Code

Source Code Download

The source code for this tutorial is provided in two different formats. The directories cofiles and data contain ABAP transport files with all the development objects contained in this tutorial. If you have access and permission to import transport files from external systems, this can be a good way to import the tutorial source code. All objects are imported at once and all development object types are supported. However you should only use this approach if you are importing into a 7.0 or higher level system. The transport files contain development objects (like Web Dynpro ABAP) that only exist at this development level. If you import the transport in earlier releases, you will receive import errors.

The other solution is to import the development objects using SAPlink. SAPlink is not an SAP provided or supported solution. It is a community created project for exporting and importing ABAP development objects in XML format. You can read more about SAPlink at http://www.saplink.org.

The SAPlink files are the ones with the file extension NUGG. I have divided the SAPlink files into smaller groups so that you can import just the objects that you want and avoid technologies that might not be supported on your release level. The main drawback to SAPlink is that it doesn't have a plug-in that supports persistent objects. Therefore it is not possible to include the persistent classes from Part 3 of the Tutorial. I have still included the data dictionary objects and programs from this section of the tutorial.

The following is the listing of the SAPlink objects and the suggested order of import:

  • NUGG_AFS_OO - these are basic classes and programs from Tutorial #1 and #2. They should be usable back to WebAS 6.10 and higher based releases.
  • NUGG_AFS_OO_PERSISTENT_DDIC - these are the only the data dictionary objects used in Tutorial #3.
  • NUGG_AFS_OO_PERSISTENT_PROGRAMS - these are the dynpro programs that are used to test the persistent classes from Tutorial #3. They need the persistent objects that cannot be offered via SAPlink. You would need to create the persistent objects manually before you could import these programs
    without error.
  • NUGG_AFS_OO_PERSISTENT_PROGRAMS_702 - These would mostly be an item of curiosity. For proper import they would require an ABAP 7.02 based system (which isn't available yet as of Aug 2009) or NetWeaver 7.1x or higher (of which there is not version of the Business Suite that runs on this
    NetWeaver release). Chances are low that there are many people who could import these objects without syntax errors. However knowing this, you might still want to study the code to see what will be possible in the near future.
  • NUGG_AFS_OO_UI_DDIC - From Tutorial #4 - these are the data dictionary objects that are used throughout the UI based tutorials. Please import these before any of the other UI tutorials and regardless of which UI technology tutorials you are importing.
  • NUGG_AFS_OO_UI_DYNPRO - From Tutorial #4 - these are the classic dynpro based tutorials and can be imported into any release level supported by SAPlink (technically the demos should work back in 4.6C as well if you want to recreate them manually).
  • NUGG_AFS_OO_UI_BSP - From Tutorial #4 - these are the BSP (Business Server Pages) related examples. Only import them into a WebAS 6.20 or higher based release level.
  • NUGG_AFS_OO_UI_WDA - From Tutorial #4 - these are Web Dynpro ABAP related examples. Only import them into a NetWeaver 7.0 or higher based release level.

Comments

Actions

Filter Blog

By date:
By tag: