DEFINE m_macro.
ABAP Statements ...
END-OF-DEFINTION.
Some important points about Macro:
- Macro call should be placed only after Macro definition
- Macro can contain up-to nine placeholders
- Macros can be called inside another macro
- Macro can't call itself
Pros:
Macro is faster than other modularization techniques ex. sub-routines (Illustrated below)
Cons:
Macros can't be debugged. Hence, complex code should not be written inside macros
Runtime Analysis (SE30)
To analyze the run time of Macro and subroutines, demo code is written. Click to view demo source code
Macro Code
Subroutine Code
Run-time Analysis findings: Macros work much faster than Subroutines as it is evident from 'Execution time in seconds' of Run-time Analysis Tool.
Macro:
Subroutine:
To conclude, Macros can be useful in reducing the run time of your programs but care should be taken to avoid complex logic inside macros as they can't be debugged.
No comments:
Post a Comment