What do you mean by Macros in abap?What are its functions?

Macros are defined within the program. As we have seen in modularization, like that if the user wants to use the set of statements repeatedly in a program, then you have to place them in Macros. They are the source code transformers in pre-compile stage. Macros are helpful for long calculations or complex write statements. Macros can be called in lines not in sets of a program in which it is defined.
Based on the placeholders Macros are designed where they work like pointers in C language.
You can define a macro within the DEFINE...END-OF-DEFINITION statement.
It is necessary to define a macro. Macros can use parameters. The <param1>…. replaces the placeholders. For example Parameters like N=1,2,3
The maximum number of placeholders in a macro definition is nine. That is, when the user runs the program the SAP system includes the macro with appropriate statements and the placeholders &1, &2,….&9. These placeholders are again replaced by the parameters param1, param2 ...param9. We can use macro within another macro, but not the same macro.


Enter transaction code SE38. Create a new program by name ZMACRO_TEST. Update the description in the short text field, and also with appropriate attributes such as Type and Status as shown in the following screenshot −
Following is the code −
Here you can see the three checkboxes in the screen. While running the program, select S2 checkbox which is middle one.
The above code produces the following output –
If all checkboxes are selected, the code displays the following output −

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status