Skip to Content

Unspeakable ABAP Mysteries and a Challenge – Part 2


Buried in the deepest layers of your Web Application Server and thought – and hoped! – forgotten by mankind lie unspeakable terrors.

Eons ago, they roamed the Earth as gods, but now they sleep and dream. These are the Old Ones, of whom the crazy Arab Abdul Al’Hazred wrote:

  • That is not dead, which may eternal lie
  • Yet with strange eons, even Death may die.

I have been a scholar for most of my life, and my musings have led me to research many dark secrets of SAP technologies. But now – with my latest studies of the Necronomicon, the legendary black book written by said crazy Arab – I must have stirred something. Whatever has brought me to the attention of the Old Ones, they are onto me, and soon my days will be over.

But before they find me, I want to pass onto you the secrets at which I have had the briefest glimps, just quick enough to keep most of my sanity yet long enough to loose all hope and faith in the Universe being a place for humankind.

The Bizarre World of TRMAC

Eons ago SAP decided to create new special purpose commands especially for HR programming. Of course these commands have been useful, but fortunately SAP stopped otherwise we wouldn’t ABAP as general purpose programming language but different special languages for HR, FI, CO and nowadays XI, Records Management and so on. So let’s look how it works and have a look at the transparent table TRMAC:


It’s interesting to see how quite common ABAP commands have been realized using these macros. But please be aware that this is a look back into time: I think some of these commands have been integrated into ABAP kernel.

Now we use transaction sm30 to create new command BREAKME that sets a breakpoint if the program has been started transaction se38:


Please be careful when you reproduce the results: Sometimes I had to do a new logon after changes in TRMAC – and please start numbering the commands with ‘000’.

A Challenge

Of course macro programming is an inferior programming technique:

  • We can’t debug them,
  • we don’t have type checking,
  • we get trouble if the ABAP language group creates a new command with the same name,
  • we can surprising results if another application creates a new TRMAC macro or a standard macro with the same name.

But macro programming is fun and separates ABAP wannabes from experts. I think during the ABAP month in SDN we should take the chance and enrich ABAP with some really useless and perhaps frightening commands, think about a GOTO statement, an ALTER command or entries like in good old Cobol? Or do you want to write an Add On to the new ABAP editor for TRMAC macros? Do we need a SAPlink plugin for TRMAC? I would love to read blogs with sophisticated, inspiring and weird solutions.

You must be Logged on to comment or reply to a post.
  • Hi Tobias
    You have touched upon a great topic here.Macros can be really useful in situations where repetative code is involved but not much programming logic is involved.For example I recently created an macro for capturing the values of the ALV fieldcatalog while creating an ALV report.This really made the code much cleaner and easier to maintain.
    • Hi Ravi,

      you are right. I do use macros too for fieldcatalogs and especially select-options – but only in a local context.

      Once I defined a macro in a global include to shorten function calls but now I consider it as a design error: the interface of the function module was too fat and 99% the calls could be avoided by a proper OO exception handling. So before defining global macros I ask myself whether I can avoid this better using a good design.

      And same applies to TRMAC macros. I don’t like “fat” programming languages and prefer a well designed OO framework to dozens of special commands. But perhaps you can change my mind and create a really useful TRMAC macro? I would like to read about it in a blog entry.


    • Oh, I’m really very sorry but I didn’t know the other blog. I think I should better search SDN before writing my blogs.

      But it is interesting: BREAK-POINTS, LOGGING-POINTS and ASSERTIONS seen to be the first application that come to programmer’s mind.

      But the challenge is still open – I would love to see a GOTO or ALTER statement in ABAP 😉