<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Macros in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/macros/m-p/2302033#M503177</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Macros are like subroutines..but not used i guess&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DEFINE INCREMENT.&lt;/P&gt;&lt;P&gt;  ADD 1 TO &amp;amp;1.&lt;/P&gt;&lt;P&gt;END-OF-DEFINITION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: NUMBER TYPE I VALUE 1.&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;INCREMENT NUMBER.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; 1. As a rule, you should use subroutines (FORM, FUNCTION)&lt;/P&gt;&lt;P&gt;    instead of macros. This is because subroutines - unlike&lt;/P&gt;&lt;P&gt;    macros - are supported by all of the ABAP Workbench tools&lt;/P&gt;&lt;P&gt;    (debugging, runtime analysis, runtime error handling, ...).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; 2. You cannot define a macro within a macro using the DEFINE&lt;/P&gt;&lt;P&gt;    statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; 3. You cannot use an ABAP keyword as a macro name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; 4. The validity of a macro definition is determined by its&lt;/P&gt;&lt;P&gt;    position in the source code. You can use a given macro in&lt;/P&gt;&lt;P&gt;    any line of code following its definition. There is no&lt;/P&gt;&lt;P&gt;    distinction between global and local macros. For example,&lt;/P&gt;&lt;P&gt;    the fact that a macro is defined within a subroutine has no&lt;/P&gt;&lt;P&gt;    effect on its validity.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; 5. If you redefine a macro, that is, assign a new meaning to&lt;/P&gt;&lt;P&gt;    an existing name, the new meaning takes effect from the&lt;/P&gt;&lt;P&gt;    position in the program where the macro was redefined.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 14 May 2007 12:59:34 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-05-14T12:59:34Z</dc:date>
    <item>
      <title>Macros</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/macros/m-p/2302031#M503175</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;what r Macros?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 May 2007 12:55:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/macros/m-p/2302031#M503175</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-14T12:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: Macros</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/macros/m-p/2302032#M503176</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Very old way of implementing subroutines, they shouldn't be used. Check DEFINE macro.  statement documentation via F1 help.&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 May 2007 12:57:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/macros/m-p/2302032#M503176</guid>
      <dc:creator>Peter_Inotai</dc:creator>
      <dc:date>2007-05-14T12:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: Macros</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/macros/m-p/2302033#M503177</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Macros are like subroutines..but not used i guess&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DEFINE INCREMENT.&lt;/P&gt;&lt;P&gt;  ADD 1 TO &amp;amp;1.&lt;/P&gt;&lt;P&gt;END-OF-DEFINITION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: NUMBER TYPE I VALUE 1.&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;INCREMENT NUMBER.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; 1. As a rule, you should use subroutines (FORM, FUNCTION)&lt;/P&gt;&lt;P&gt;    instead of macros. This is because subroutines - unlike&lt;/P&gt;&lt;P&gt;    macros - are supported by all of the ABAP Workbench tools&lt;/P&gt;&lt;P&gt;    (debugging, runtime analysis, runtime error handling, ...).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; 2. You cannot define a macro within a macro using the DEFINE&lt;/P&gt;&lt;P&gt;    statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; 3. You cannot use an ABAP keyword as a macro name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; 4. The validity of a macro definition is determined by its&lt;/P&gt;&lt;P&gt;    position in the source code. You can use a given macro in&lt;/P&gt;&lt;P&gt;    any line of code following its definition. There is no&lt;/P&gt;&lt;P&gt;    distinction between global and local macros. For example,&lt;/P&gt;&lt;P&gt;    the fact that a macro is defined within a subroutine has no&lt;/P&gt;&lt;P&gt;    effect on its validity.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; 5. If you redefine a macro, that is, assign a new meaning to&lt;/P&gt;&lt;P&gt;    an existing name, the new meaning takes effect from the&lt;/P&gt;&lt;P&gt;    position in the program where the macro was redefined.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 May 2007 12:59:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/macros/m-p/2302033#M503177</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-14T12:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: Macros</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/macros/m-p/2302034#M503178</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Look at the below link&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db972835c111d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db972835c111d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Look at the below link for Program which are developed using the Macros&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/ab022.htm" target="test_blank"&gt;http://www.sap-img.com/ab022.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt; Sudheer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 May 2007 12:59:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/macros/m-p/2302034#M503178</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-14T12:59:54Z</dc:date>
    </item>
    <item>
      <title>Re: Macros</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/macros/m-p/2302035#M503179</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As programs grow larger and larger, it becomes more difficult for programmers to enhance and debug source code. Luckily, computer languages make developers' lives easier by offering various modularization methods, making program code meaningful and easily understandable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ABAP, SAP's programming language, is no exception. It leverages various modularization options, each having its own strengths and weaknesses. These options may have local access from a particular program&amp;#151;such as form routines and macros&amp;#151;or they may have global access, such as function modules or include programs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Although a comprehensive discussion of all the modularization techniques available in ABAP is beyond the scope of this article, we can look at one option&amp;#151;macros&amp;#151;and consider some situations where they work better than other options.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db972835c111d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db972835c111d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And here is a sample code which explains Macros:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*DATA: result TYPE i,&lt;/P&gt;&lt;P&gt;*n1 TYPE i VALUE 5,&lt;/P&gt;&lt;P&gt;*n2 TYPE i VALUE 6.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;This is macro definition.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;*DEFINE operation.&lt;/P&gt;&lt;P&gt;*result = &amp;amp;1 &amp;amp;2 &amp;amp;3. "&amp;amp;1 &amp;amp;2 &amp;amp;3 are place holders&lt;/P&gt;&lt;P&gt;*output &amp;amp;1 &amp;amp;2 &amp;amp;3 result. " Calling the macro output&lt;/P&gt;&lt;P&gt;*END-OF-DEFINITION.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;This is another macro (output) definition&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;*DEFINE output.&lt;/P&gt;&lt;P&gt;*write: / 'The result of &amp;amp;1 &amp;amp;2 &amp;amp;3 is', &amp;amp;4. " 4 place holders passed to&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                                         " this macro&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                                         " Here &amp;amp;4 is the place holder&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                                         " for result&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*END-OF-DEFINITION.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;Calling the macro operation 3 times with three different&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;operation( addition, power, subtraction ).&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; operation 4 + 3.   "Here &amp;amp;1 place holder for 4&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                    "     &amp;amp;2 place holder for +&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                    "     &amp;amp;3 place holder for 3&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; operation 2 ** 7.  "Here &amp;amp;1 place holder for 2&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                    "     &amp;amp;2 place holder for **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                    "     &amp;amp;3 place holder for 7&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; operation n2 - n1. "Here &amp;amp;1 place holder for n2&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                    "     &amp;amp;2 place holder for -&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                    "     &amp;amp;3 place holder for n1&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this info helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;kumar.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 May 2007 13:04:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/macros/m-p/2302035#M503179</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-14T13:04:41Z</dc:date>
    </item>
  </channel>
</rss>

