ABAP Freak Show – July 1st – ABAP OO Tutorial Part 1

This week we begin a 5 part 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.

You can also download all the source code from all 5 tutorials. Just be sure to look at the ReadMe.pdf file for important tips on installing the source code.

You can download a high resolution version MP4 version of the video here:

You can download an iPod/iPhone version of the video here:

Tags: , ,

12 responses to “ABAP Freak Show – July 1st – ABAP OO Tutorial Part 1”

  1. Steffen Froehlich says :

    Thanks Thomas for the beginners oo-tutorials. I’ve got two questions about OO and selection screens.

    The way people start programs in ERP are done by transactions. So Tcodes can link directly to OO-Classes. Is there a way to use theses powerful selection-screens in OO methods, because for an selection screen you ever need to create a program (which seems a little bit old style 😉 ).

    When using a selection options with ranges for an data-element like:

    SELECT-OPTIONS: so_matnr FOR mara-matnr.

    and you want using it in OO-context you’ve declare a separate range-table like this:

    DATA: ltr_matnr TYPE RANGE OF mara-matnr.
    ltr_matnr[] = so_matnr[].
    CALL METHOD zcl_class=>init_attr
    CHANGING matnr = ltr_matnr.

    Are there other / smarter ways, today?

  2. Thomas Jung says :

    Thanks for the questions. These aspects of integration into the UI for Classic Dynpro constructs are all things I will cover in Part 4 of the tutorial.

    For any screen related elements (Selection Screens or Full Dynpro screens), you still need a program. Yes it is old style, but by the time OO was coming along in ABAP we were already beginning the transition to new UI technologies and I suppose the investment in a full OO version of classic dynpro just wasn’t worth it.

    However in part 4 I will talk about how to keep this program as mostly an empty shell and divert most of your processing into a class.

    Finally, yes the range table is the only way of declaring a parameter or variable to access a select-option. You can at least create range tables as data dictionary table types. I will show that in part 4 as well.

    • krishna says :

      Hi Thomas,

      Can you please post the link of OOABAP videos. I could not those clips in all the links in scn and enterprise geeks. i could not see any proper material for OOABAP.

      Thanks in advance.

  3. Simon says :

    Hi Thomas,

    Thanks for doing these – they are really useful. I am not sure if this question even makes sense, but I will ask it anyway :-)… I always thought that ABAP was originally procedural due to the fact that it was somehow compiled down to C (I’m not sure why I assumed this) – did something change in the underlying implementation of ABAP to allow for ABAP OO?

    Keep up the great work. Really enjoy listening and learning about this stuff.


  4. Thomas Jung says :

    >always thought that ABAP was originally procedural due to the fact that it was somehow compiled down to C (I’m not sure why I assumed this)

    ABAP doesn’t really compile down to C code. The confusion is maybe the fact that the ABAP Compiler and the ABAP virtual machine are both implemented in C/C++. However ABAP creates a byte code that is interpreted by the ABAP virtual machine – actually a lot like the way Java works. But this doesn’t really effect OO/Procedural.

    ABAP was procedural simply because that was the way most programming languages were designed when ABAP first came about. Procedural ABAP design is largely a mixture of concepts from COBOL and C.

  5. Crepmaster says :

    Hy Thomas thanx for the tutorial ( i’m at part 3 🙂 ) .
    Is it possible to use a perfom inside a method like something like this.
    method alfa.
    select * from ztable into it_ztable
    where blablabla.
    loop at it_ztable assigning .
    perform complete_data.

    if yes, how should i declare the data in the form to use it_ztable data?
    Is it better build a new method?

    • Ed Herrmann says :

      Hi Crep, you can’t use perform statements inside of methods. You should definitely build a new method for any block of code that will be called multiple times. You can declare the method as private if it is only to be used inside the class, and not by outside callers of the class.


  6. crepmaster says :

    Thanx Ed! the concept is clearer now.

  7. sureshchinta says :

    hi Thomus ,

    Heartly appreciated for ur Webdynpro topics,Very nice and interested …iam start learning with ur abap oops and webdynpro topics always i used to watch ur videos..
    very useful to every sap men.

    Thanking you and Warm regards
    Suresh chinta
    sap consultant

  8. Amit says :

    Hey Thomas,

    Thanks for the ABAP videos.

    I would like to ask you, as I am a beginner in ABAP Programming. What is your advice to start from?I am self learner.



  9. clarkgee says :

    Excellent. I have had OO training before but these are the best I have seen and very useful. Thanks

  10. Jack Sugrue says :

    Thomas, I am working my way through this 5-part series and it is tremendously helpful. However, when we tried to import the transport of the Source files, we got 5 errors, all related to Field ‘I_OPTIONS-DATABASE_QUERY_OPTIONS’ being unknown. “It is neither in one of the specified tables no…”.

    Is there something we can do to correct this and allow the transports to import?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: