All ABAP developers should know that when dealing with (most) online processes we can use breakpoints to interrupt the execution of a program at runtime, taking us into the ABAP debugger. Broadly speaking, breakpoints are in one of two camps:
- Hard breakpoints set by coding the breakpoint into the ABAP logic itself.
The BREAK macro
Notice from the code snippet above that the BREAK keyword is in lowercase, even though all my other keywords are in uppercase (thanks to pretty printer)? This is because BREAK is not actually a keyword but rather a special macro defined in a configuration table that hails back to the R/2 days: TRMAC.
This form of macro works very similar to macro’s that you can define in your program using DEFINE / END-OF-DEFINITION, except that by being defined in table TRMAC they are automatically accessible from all ABAP programs. Notice that the BREAK macro expects one parameter &1, which will be placed within quotes to allow the character string comparison. So when I write in my ABAP program:
I am actually using macro shorthand to write:
IF sy-uname EQ 'BARDENS'.
Notice too that the ABAP compiler automatically converts the user ID (macro parameter &1) to uppercase. If only the ABAP debugger would let me walk through the substituted macro logic – this inability to debug (and hence increased difficulty to support) is the main reason I try to avoid using locally-defined macros.
A little bit of macro fun…
Warning! Table TRMAC is an SAP system table which is not meant to be maintained by customers. Removing or changing entries in this table could really mess with your SAP system. This could in turn land you in trouble.
If the warning doesn’t scare you and you feel like messing with a fellow ABAPer’s head, temporarily add the following macro definition to table TRMAC substituting their user ID in place of COLLEAGUE.
Next, create a new program with the following code and get them to run it under their user ID. It will break for your colleague, but not for you. 🙂
INTO TABLE gt_flights
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
i_structure_name = 'SFLIGHT'
t_outtab = gt_flights.
This presentation on SDN has a section on a new concept of activatable breakpoints being introduced with WAS 6.40. These hardcoded breakpoints remain dormant until activated by configuration.