<?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/2359165#M521683</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;&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="406927"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Debugging a macro is not possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Bala&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Jun 2007 09:57:04 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-06-14T09:57:04Z</dc:date>
    <item>
      <title>macros</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/macros/m-p/2359162#M521680</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;what is macro ? how it will be used in realtime and can u debug a macro&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2007 09:45:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/macros/m-p/2359162#M521680</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-14T09:45:17Z</dc:date>
    </item>
    <item>
      <title>Re: macros</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/macros/m-p/2359163#M521681</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;macro is just useful like subroutienes.but we can't debugg the macro.&lt;/P&gt;&lt;P&gt;see this simple example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:result(3) type n.&lt;/P&gt;&lt;P&gt;define addition.&lt;/P&gt;&lt;P&gt;result = &amp;amp;1 &amp;amp;2 &amp;amp;3.&lt;/P&gt;&lt;P&gt;write:/ 'result of &amp;amp;1 &amp;amp;2 &amp;amp;3 is:',result.&lt;/P&gt;&lt;P&gt;end-of-definition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;addition 10 + 20.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for more info see this 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;rgds,&lt;/P&gt;&lt;P&gt;bharat.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2007 09:49:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/macros/m-p/2359163#M521681</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-14T09:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: macros</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/macros/m-p/2359164#M521682</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;Macros&lt;/P&gt;&lt;P&gt;If you want to reuse the same set of statements more than once in a program, you can include&lt;/P&gt;&lt;P&gt;them in a macro. For example, this can be useful for long calculations or complex WRITE&lt;/P&gt;&lt;P&gt;statements. You can only use a macro within the program in which it is defined, and it can only&lt;/P&gt;&lt;P&gt;be called in lines of the program following its definition.&lt;/P&gt;&lt;P&gt;The following statement block defines a macro &amp;lt;macro&amp;gt;:&lt;/P&gt;&lt;P&gt;DEFINE &amp;lt;macro&amp;gt;.&lt;/P&gt;&lt;P&gt;&amp;lt;statements&amp;gt;&lt;/P&gt;&lt;P&gt;END-OF-DEFINITION.&lt;/P&gt;&lt;P&gt;You must specify complete statements between DEFINE and END-OF-DEFINITION. These&lt;/P&gt;&lt;P&gt;statements can contain up to nine placeholders (&amp;amp;1, &amp;amp;2, ..., &amp;amp;9). You must define the macro&lt;/P&gt;&lt;P&gt;before the point in the program at which you want to use it.&lt;/P&gt;&lt;P&gt;Macros do not belong to the definition part of the program. This means that the DEFINE...ENDOF-&lt;/P&gt;&lt;P&gt;DEFINITION block is not interpreted before the processing blocks in the program. At the&lt;/P&gt;&lt;P&gt;same time, however, macros are not operational statements that are executed within a&lt;/P&gt;&lt;P&gt;processing block at runtime. When the program is generated, macro definitions are not taken&lt;/P&gt;&lt;P&gt;into account at the point at which they are defined. For this reason, they do not appear in the&lt;/P&gt;&lt;P&gt;overview of the structure of ABAP programs [Page 44].&lt;/P&gt;&lt;P&gt;A macro definition inserts a form of shortcut at any point in a program and can be used at any&lt;/P&gt;&lt;P&gt;subsequent point in the program. As the programmer, you must ensure that the macro&lt;/P&gt;&lt;P&gt;definition occurs in the program before the macro itself is used. Particular care is required if you&lt;/P&gt;&lt;P&gt;use both macros and include programs, since not all include programs are included in the syntax&lt;/P&gt;&lt;P&gt;check (exception: TOP include).&lt;/P&gt;&lt;P&gt;To use a macro, use the following form:&lt;/P&gt;&lt;P&gt;&amp;lt;macro&amp;gt; [&amp;lt;p1&amp;gt; &amp;lt;p2&amp;gt; ... &amp;lt;p9&amp;gt;].&lt;/P&gt;&lt;P&gt;When the program is generated, the system replaces &amp;lt;macro&amp;gt; by the defined statements and&lt;/P&gt;&lt;P&gt;each placeholder &amp;amp;i by the parameter &amp;lt;pi&amp;gt;. You can use macros within macros. However, a&lt;/P&gt;&lt;P&gt;macro cannot call itself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex.&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;DEFINE OPERATION.&lt;/P&gt;&lt;P&gt;RESULT = &amp;amp;1 &amp;amp;2 &amp;amp;3.&lt;/P&gt;&lt;P&gt;OUTPUT &amp;amp;1 &amp;amp;2 &amp;amp;3 RESULT.&lt;/P&gt;&lt;P&gt;END-OF-DEFINITION.&lt;/P&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.&lt;/P&gt;&lt;P&gt;END-OF-DEFINITION.&lt;/P&gt;&lt;P&gt;OPERATION 4 + 3.&lt;/P&gt;&lt;P&gt;OPERATION 2 ** 7.&lt;/P&gt;&lt;P&gt;OPERATION N2 - N1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The produces the following output:&lt;/P&gt;&lt;P&gt;The result of 4 + 3 is 7&lt;/P&gt;&lt;P&gt;The result of 2 ** 7 is 128&lt;/P&gt;&lt;P&gt;The result of N2 - N1 is 1&lt;/P&gt;&lt;P&gt;Here, two macros, OPERATION and OUTPUT, are defined. OUTPUT is nested in&lt;/P&gt;&lt;P&gt;OPERATION. OPERATION is called three times with different parameters. Note how&lt;/P&gt;&lt;P&gt;the placeholders &amp;amp;1, &amp;amp;2, ... are replaced in the macros.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following example shows that a macro definition only works in the program lines&lt;/P&gt;&lt;P&gt;following its definition. Do not copy it!&lt;/P&gt;&lt;P&gt;Suppose we have a program with a subroutine TEST:&lt;/P&gt;&lt;P&gt;PROGRAM MACRO_TEST.&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;FORM TEST.&lt;/P&gt;&lt;P&gt;WRITE '...'.&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;Suppose we then changed the program to the following:&lt;/P&gt;&lt;P&gt;PROGRAM MACRO_TEST.&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;FORM TEST.&lt;/P&gt;&lt;P&gt;DEFINE MACRO.&lt;/P&gt;&lt;P&gt;WRITE '...'.&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;END-OF-DEFINITION.&lt;/P&gt;&lt;P&gt;MACRO.&lt;/P&gt;&lt;P&gt;Inserting the macro changes nothing in the generated form of the program.&lt;/P&gt;&lt;P&gt;Processing blocks - here a subroutine - are always indivisible. We could also write&lt;/P&gt;&lt;P&gt;the program as follows:&lt;/P&gt;&lt;P&gt;PROGRAM MACRO_TEST.&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;DEFINE MACRO.&lt;/P&gt;&lt;P&gt;WRITE '...'.&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;END-OF-DEFINITION.&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;FORM TEST.&lt;/P&gt;&lt;P&gt;MACRO.&lt;/P&gt;&lt;P&gt;The most essential feature of a macro definition is that it should occur before the&lt;/P&gt;&lt;P&gt;macro is used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Bhaskar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2007 09:55:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/macros/m-p/2359164#M521682</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-14T09:55:48Z</dc:date>
    </item>
    <item>
      <title>Re: macros</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/macros/m-p/2359165#M521683</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;&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="406927"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Debugging a macro is not possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Bala&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2007 09:57:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/macros/m-p/2359165#M521683</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-14T09:57:04Z</dc:date>
    </item>
    <item>
      <title>Re: macros</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/macros/m-p/2359166#M521684</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;gurus  i am very gratefully to those who responded to my query&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;suresh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jun 2007 09:05:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/macros/m-p/2359166#M521684</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-15T09:05:46Z</dc:date>
    </item>
  </channel>
</rss>

