Skip to Content
Author's profile photo Igor Barbaric

OO ABAP contest with books giveaway!

SDN Success Story

Hi! I have a very good reason to express my thanks to all of you folks, who helped me to do something incredible.

A year or so ago, I was a silent ABAP-er minding my own business, when a single SDN weblog started an avalanche that greatly improved my career. I posted a simple plain-text weblog (I was a beginner on writing weblogs) on how I used generic design patterns in an OO ABAP application that I designed. Mark Finnern liked it, and he encouraged me to apply for the session contest for SDN Meets Labs ‘05 in Waldorf. I was terrified because I have never presented before and was about to say “no”, but the little devil on my shoulder moved my fingers and I was applied. To my horror, I was accepted too! The snowball started to roll: although scared like hell, I survived SDN Meets Labs, in fact, I was very happy about it! Dirk Feeken from SAP suggested that my ideas were publishable, I presented at TechEd ’05 in Vienna (because YOU voted for my session!), met Horst Keller who introduced me to Florian Zimniak from Galileo Press, and we agreed to give it a try.

The Book

I started writing… well, something. I still didn’t know if I’d be able to type in enough meaningful stuff so that guys from SAP PRESS could call it “a book” and put side by side to their other great editions. But what the hell – I got myself in trouble and there was no return. For 6 months I fought with my little daughters over the laptop every evening, wiped milk and marmalade from it with all my patience and waited for my wife to loose hers. My eyeballs grew as I cursed the day… However, somehow I kept it going. And finally, the book Design Patterns in Object-oriented ABAP hit the market. I immediately forgot all the troubles!


You guys made it possible and I’d like to thank you by giving away a copy of the book. In fact, SAP PRESS committed to generously give away 3 copies. But you won’t get them for free. I’ll ask you to do something.

The Book’s Demo Application

To accompany the book I made a demo ABAP application. The application consists of a command tree to the left with nodes which represent objects in the program. Each object and the entire program as well serve the purpose of explaining design patterns described in the book. When user performs some action such as double-click, node expansion or right mouse click on a node, something happens. For example, an ALV grid with table data opens in the new container.

The Contest

Now what am I expecting you to do? The prize goes to the first 3 persons who discover a bug in my program and don’t tell anyone. Just kidding – actually I am inviting you to use your dirty imagination and do something with this program that you won’t exactly transport to production: copy the program and add your own code to it that performs something funny.
Just to give you a clue of what I have in mind, I have added such an object to the original code (class LCL_DOUBLE_SALARY), and here’s how it looks:


Don’t worry about wasting time on digging through this code: Expert OO ABAP knowledge is NOT a prerequisite to accomplish this, and I have already prepared a special class for this – you only need to add code to a method or two. I believe that even ABAP beginners should find this easy.


The demo was originally made in an ERP system and uses some ERP-specific tables, such as MAKT and LFA1, which made it harder to implement in entirety in BI, SEM, CRM etc.
This is why the downloadable instructions have “Generic” implementation too. There are very few differences compared to ERP: 2 extra Z* tables and generic data elements, which makes column headings meaningless. But I don’t think this is a big deal. Besides, you can skip it all if you comment out some code, as in instructions.

Anyway, here is description of what you need to do:

  • Download code with instructions from SAP PRESS and install the demo application (time consumption approx. 10 minutes)
  • Enter the ABAP program Z_DEMO_PATTERNS
  • If you don’t want to see the entire program at work and would like to save some time creating Z* tables and structures, you can comment out some code, but then you wan’t be able to use functions in program other than “double salary” and “SDN contest”. So comment out the following:
    • Implementation of the CONSTRUCTOR method of the LCL_MOD class
    • Commands in the CONSTRUCTOR method of classes LCL_MOD_DECORATOR and LCL_MOD_FACADE, starting from
      CREATE OBJECT o_dec_vendor

      until the end of the method

  • Copy this code into your own report program, behind the LIF_TREE_OBJECT interface definition (behind the ENDINTERFACE command):
  • Navigate to the CONSTRUCTOR method of the LCL_APPLICATION class
  • Declare the new objects:
    o_double_salary TYPE REF TO lcl_double_salary, o_sdn_contest TYPE REF TO lcl_sdn_contest
  • Navigate to the comment
    *------ create initial objects at the tree

    create the new objects and append them to the objects internal table similarly as I have done with others:

    * double salary CREATE OBJECT o_double_salary. APPEND o_double_salary TO me->t_active_objects. * SDN contest CREATE OBJECT o_sdn_contest. APPEND o_sdn_contest TO me->t_active_objects.
  • Navigate to the
    *>>>>>>>> YOUR CODE HERE

    comments (there are 2) and enter your code.

  • Send the entire code (just copy-paste the entire program) and short info on what your piece does (1-2 sentences and possibly a screen-shot) by July 26th to the email address: with subject “SDN Contest”.

I will run your programs in my system and if I get fired for this, I’ll keep all three books and sell them on a flee market. Otherwise, I’ll pick the funniest three implementations, send the books to the authors (or SAP PRESS will) and publish the winners on SDN.

The Rules

Now the rules – every game has them and this one is no exception:

  • The program must not make any damage or do something which would get me in trouble. So please don’t fool around with things like downloading child porn or playing tricks such as DELETE FROM bseg WHERE belnr NE space.
  • The program should not require too much extra work to implement (like creating many new dictionary objects, importing transport requests etc.)
  • Participants must be registered SDN members
  • Participants must not be related nor married to me 🙂

Good luck and thanks for participating!


Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member
      Hi Igor,
      you forgot to mention one big restriction (and I'm currently working hard to correct this). Your demo program only runs in an ERP system, not in BI, SEM, CRM etc. because you need the tables MAKT and LFA1.

      Best regards

      Author's profile photo Igor Barbaric
      Igor Barbaric
      Blog Post Author
      Thanks for your comment, Dirk!
      It's true - so far I have only worked in ERP and I completely overlooked the fact that there are other types of systems. I guess I should have based the entire thing on only Z* tables and data elements. I need to think a little to see what is the best thing to do about it now. As first thing, I'll indicate this in my weblog.
      Thanks again and regards,
      Author's profile photo Igor Barbaric
      Igor Barbaric
      Blog Post Author
      We have got the first contest application.
      Thanks, Tanveer!
      Author's profile photo Igor Barbaric
      Igor Barbaric
      Blog Post Author
      Thanks, Akshay!
      So far it's Wipro's internal contest, saving shipment money for SAP PRESS.
      Author's profile photo Igor Barbaric
      Igor Barbaric
      Blog Post Author
      Thanks to Dirk Herzog, I have discovered that my demo program was not runnable on systems other than ERP. Now I have updated the weblog as well as downloadable demo package which accompany the book. The generic system-independent demo was added.
      Have fun!
      Author's profile photo Igor Barbaric
      Igor Barbaric
      Blog Post Author
      Well, the situation with the contest at the moment is like this:
      The deadline is today, but since I have got only 2 applications and 3 books to give away, I decided to prolong the contest for one week, that is, until the 26th of July. So anyone who bothers to do anything at all with this demo of mine has a pretty good chance to win a book. I don’t think it’s a big effort – try and see!
      For the time being, Akshay and Tanveer from Wipro can be pretty sure to get the book, since they are the only ones who applied up to now.
      I can be relieved too, because I wondered what I would do if I got hundreds of applications to review.
      Unless more people apply, SAP PRESS will save money since they are giving away 2 books instead of 3, and they ship both books to the same address. Don't let them get away so easily!
      Hope to see some more joking programs from you!