Skip to Content
author's profile photo Former Member
Former Member

Procedure to create MACRO

Hi,

Can any one just let me know the procedure to create

MACROS.

Thanks In Advance

Regards

Irfan Hussain

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 13, 2005 at 09:49 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 13, 2005 at 09:56 AM

    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,

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

    Hope it helps u

    Thanks&Regards,

    Ruthra

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 13, 2005 at 10:12 AM

    Don't use them !

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

    Add a comment
    10|10000 characters needed characters exceeded

    • 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.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.