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.
01.ZREPORT_CREATE_MACRO.02. 03.*First we define a Macro04. 05.DEFINE Z_MULTIPLY.06. MULTIPLY &1 BY &2.07.END-OF-DEFINITION.08. 09.* Declare the variables10. 11.DATA:12.v_numb1 TYPE i Value 10,13.v_numb2 TYPE i value 20.14. 15.* Call the macro16. 17.Z_MULTIPLY v_numb1 v_numb2.18. 19.* Display the result20. 21.WRITE:/ 'Macro Result is:', v_numb1.
No comments:
Post a Comment