ABAP UNIT by example

I’m reading Ken Beck’s “Test-Driven Development by example” (a review when I’ll finish it) and I tried to find if there’s a way to adapt it to ABAP.

Yes, it does. Mainly because SAP launched ABAP Unit, a test environment appliable to both programs and classes.

In programs is easy to implement: you must just define a local class FOR TESTING and go on.

In classes… it’s the same, but a bit trickier: take a look at this link from SAP

Let’s try it.
Continue reading



Great class to show your HTML strings via dialog box or within a custom container.

Just a trick: if you will use both options within the same program, it will fail if you don’t reset your browser AND the custom container.

It means that you must create a global (sigh) variable for the custom container:

DATA: browser TYPE REF TO cl_gui_custom_container.

And before the call to the dialog version you must free it:

  TRY .
       IF browser IS BOUND.
         CALL METHOD browser->free
             OTHERS 0"nasty
     CATCH cx_root.

The nasty thing here is the cleansing of SY-SUBRC even when errors occured. You can find a way to make it cleaner, I bet.

But it’s up to you to do it.

Variants’ function modules

Just a few, because I want not to forget it…

– RS_ALL_VARIANTS_4_1_REPORT: providing the name of the report (sy-repid), and just by putting ‘*’ in the TEXT parameter, you will get a table with all the variants of the program.

– RS_VARIANT_CATALOG: (online only?) by providing a program’s name, the system will show a pop-up window with the variants’ list of the program. The user can select one of them, who will be returned in the exporting parameters.

– RS_VARIANT_CONTENTS: just tell this beauty the program and its variant’s name, and it will give you a VALUTAB table parameter with its variable contents.

Rant: Learn how to use Module-pools!

Why some self-called ‘developers’ create module-pools if they don’t understand the whole concept of them? Where’s the sense of create a module-pool for each action of the same concept? Why must I find a module-pool for create data, another one for display it, and a third one to delete them? Where did those self-called ‘developers’ learn about the module-pool thing?


Maybe I’m the one who’s wrong, but I ever supposed a module-pool is a bunch of code pieces and screens, that, under the same concept, allow the easy maintenance of a business concept’s actions. I mean, if I must maintain the object Ob, I will create a SINGLE module-pool, with enough code pieces (modules) and screens to be able to maintain all the Ob’s properties. I will save time and space if I can use a single screen and block and/or hide its useless items when they are not needed…

Then I’ll decide if I want a single transaction or more of them, calling the proper screen, who will block by itself its parts what will not be used by the calling transaction. It will save time and space, and, better than this, will make my life easier when the users will ask me to modify the screen. Think about it: I will to modify ONE screen, when all those self-called ‘developers’ will must to modify three or more.


Why people cannot (or want not) learn the advantages of a tool before to use it?

The Pomodoro Technique(TM)

I’m a confused mind. It’s something natural being a chimp, but it doesn’t help too much to my productivity. When I’m feeling “unfocused” or too tired to continue with my current task, I find easy ways to rest my mind. Sadly, personal situations affect my worktime (as they do to everyone but robots and jedi knights), and when I’m tired my rest times tend to space themselves shorter (more rests, less work… it hurts… to my work). Continue reading