Previous Post: Next Post:

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

by on July 1, 2009 at 2:16 pm

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.
http://abap-sdn-examples-tpj.googlecode.com/files/AFS_OO_Tutorials_Source_Code.zip

You can download a high resolution version MP4 version of the video here:
http://blip.tv/file/get/Thomas_jung-AFSJuly12009ABAPOOPart1752.mp4

You can download an iPod/iPhone version of the video here:
http://blip.tv/file/get/Thomas_jung-AFSJuly12009ABAPOOPart1358.mp4

Tags: , , , ,

Posted in ABAP Freak Show and eGeek TV .


8 comments

Replies

  1. Steffen Froehlich Jul 2nd 2009

    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 Jul 2nd 2009

    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.

  3. Simon Jul 6th 2009

    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.

    Simon

  4. Thomas Jung Jul 6th 2009

    >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 Jan 5th 2011

    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.
    endloop.

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

  6. 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.

    -ewH

  7. crepmaster Jan 10th 2011

    Thanx Ed! the concept is clearer now.

  8. 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
    Hyderabad
    India


Trackbacks


Leave a Reply

Subscribe to comments via RSS