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.
I started writing well, something. I still didnt know if Id 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 Id 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 wont get them for free. Ill ask you to do something.
The Books 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.
Now what am I expecting you to do? The prize goes to the first 3 persons who discover a bug in my program and dont tell anyone. Just kidding actually I am inviting you to use your dirty imagination and do something with this program that you wont 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 heres how it looks:
Dont 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: email@example.com with subject “SDN Contest”.
I will run your programs in my system and if I get fired for this, Ill keep all three books and sell them on a flee market. Otherwise, Ill pick the funniest three implementations, send the books to the authors (or SAP PRESS will) and publish the winners on SDN.
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 dont 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!