cancel
Showing results for 
Search instead for 
Did you mean: 

Procedure to create MACRO

Former Member
0 Kudos

Hi,

Can any one just let me know the procedure to create

MACROS.

Thanks In Advance

Regards

Irfan Hussain

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Don't use them !

You can't debug them and they make programs un-readable.

rainer_hbenthal
Active Contributor
0 Kudos

I'm in disagreement with you.


DEFINE addline.
wa_line-one = &1.
wa_line-two = &2.
wa_line-three = &3.
append wa_line to it_line.
END-of-definiton.


addline 'a' 'b' 'c'.

is more readable ispecially when you have a lots af insert in a table without haviung the possibility to do a loop. It is much more readable then having tons of assignments and appends.

Former Member
0 Kudos

Hi,

A sample code,Here operation is the MACRO

REPORT ZMACRO.

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: / 'The result of &1 &2 &3 is', &4.

END-OF-DEFINITION.

OPERATION 4 + 3.

OPERATION 2 ** 7.

OPERATION N2 - N1.

Check this link,

<u>http://help.sap.com/saphelp_erp2004/helpdata/en/9f/db972835c111d1829f0000e829fbfe/frameset.htm</u>

Hope it helps u

Thanks&Regards,

Ruthra

Former Member
0 Kudos

hi

this is the help from sap

Defines a section of source code (macro) that you can address using the name macro. Source code saved as a DEFINE macro may only consist of complete ABAP statements

Suppose you define a macro "INCREMENT", which you then use in your program.

DEFINE INCREMENT.

ADD 1 TO &1.

END-OF-DEFINITION.

DATA: NUMBER TYPE I VALUE 1.

...

INCREMENT NUMBER.

cheers,

sasi