Creating ABAP Macro

Macro is like a function, where as you can supply parameters and it can return a value, the only difference is that you can’t debug it. These days I don’t see new program developed using Macro because functions and sub routines are more reliable and easier to trace.

But here’s a sample code on how to create MACRO in ABAP.

ZREPORT_CREATE_MACRO.

*First we define a Macro



DEFINE Z_MULTIPLY.
MULTIPLY &1 BY &2.
END-OF-DEFINITION.

* Declare the variables

DATA:
v_numb1 TYPE i Value 10,
v_numb2 TYPE i value 20.

* Call the macro

Z_MULTIPLY v_numb1 v_numb2.

* Display the result

WRITE:/ 'Macro Result is:', v_numb1.

Subscribe in a reader

Comments

0 Responses to "Creating ABAP Macro"

Post a Comment

Stay Updated