Chapter 090
Local & Global Macro
Source
: http://abapjoy.blogspot.com
Local macro
means DEFINE ~ END-OF-DEFINITION in the ABAP program.
REPORT ZMACRO_01.
DATA: result TYPE i,
n1 TYPE i VALUE 5,
n2 TYPE
i VALUE 6.
DEFINE operation.
result = &1 &2 &3.
output
&1 &2 &3 result.
END-OF-DEFINITION.
DEFINE output.
write: / ' Result : &1 &2 &3 is',
&4.
END-OF-DEFINITION.
operation 4 + 3.
operation 2 ** 7.
operation 8 - 3.
|
Result : 4 + 3 is 7
Result : 2 ** 7 is 128
Result : 8 - 3 is 5
|
While Global
macro is set in the table ‘TRMAC.
Once you
register global macro in table, all programs can access and use it.
The global macro which is being used the most is BREAK statement.
You can check in table TRMAC.
Let’s create a sample macro in
t-code:sm30. This global macro functions like APPEND command. Then, you just
write ‘APT variable’ in ABAP
program.
When you try to check if the command is a global macro, you can check the
table trmac.
No comments:
Post a Comment