<?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 Macro in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/macro/m-p/3363699#M807124</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Friends&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can u explain  what is the use of macro? also i need a sample program for Macro.&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;Anbu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 31 Jan 2008 02:49:17 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-01-31T02:49:17Z</dc:date>
    <item>
      <title>Macro</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/macro/m-p/3363699#M807124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Friends&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can u explain  what is the use of macro? also i need a sample program for Macro.&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;Anbu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Jan 2008 02:49:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/macro/m-p/3363699#M807124</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-31T02:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: Macro</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/macro/m-p/3363700#M807125</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;STRONG&gt;anbulakshmi arul&lt;/STRONG&gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Macros&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;&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 them in a macro. For example, this can be useful for long calculations or complex WRITE statements. You can only use a macro within the program in which it is defined, and it can only be called in lines of the program following its definition. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following statement block defines a macro &amp;lt;macro&amp;gt;:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DEFINE &amp;lt;macro&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   &amp;lt;statements&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;END-OF-DEFINITION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example:&lt;/STRONG&gt;&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;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;&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;&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;See this link.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/9f/db972835c111d1829f0000e829fbfe/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/9f/db972835c111d1829f0000e829fbfe/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Plzz reward if it is useful,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Mahi&lt;/STRONG&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Jan 2008 03:01:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/macro/m-p/3363700#M807125</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-31T03:01:27Z</dc:date>
    </item>
    <item>
      <title>Re: Macro</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/macro/m-p/3363701#M807126</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Lakshmi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Macro is also like a perform, but macro is local to the specific program..&lt;/P&gt;&lt;P&gt;check this code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*Macro for assigning space rather than 0.00 for numeric fields
DEFINE concat_nonull.

your code in between "&amp;lt;&amp;lt; what ever u wanted that code to do

END-OF-DEFINITION.

"calling the macro here:
concat_nonull lf_line lf_buf lf_line c_tab &amp;lt;fs_comp&amp;gt;.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;concat_nonull is the name of the macro&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Jan 2008 03:02:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/macro/m-p/3363701#M807126</guid>
      <dc:creator>former_member156446</dc:creator>
      <dc:date>2008-01-31T03:02:13Z</dc:date>
    </item>
    <item>
      <title>Re: Macro</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/macro/m-p/3363702#M807127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want to reuse the same set of statements more than once in a program, you can include them in a macro. For example, this can be useful for long calculations or complex WRITE statements. You can only use a macro within the program in which it is defined, and it can only be called in lines of the program following its definition. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Few Uses and advantages of Macro are&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of writing the same data declaration statement each time a new variable is declared, you can simply reuse the code via macros.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use macros to define variables. A simple example is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DEFINE table&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;data: &amp;amp;1 like &amp;amp;2 occurs 0 with header line.&lt;/P&gt;&lt;P&gt;END-OF-DEFINITION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;table itab1 lfa1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;table itab2 pernr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of writing the same data declaration statement each time a new variable is declared, you can simply reuse the code via macros.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Complex WRITE statements&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Programs often get unnecessarily verbose and difficult to understand because they contain lengthy and redundant WRITE statements. Macros allow you to maintain readability while writing complex WRITE statements. You can write macros to replace all variants supported by the WRITE statement. Here's a simple example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DEFINE Write_stat&lt;/P&gt;&lt;P&gt;Write : &amp;amp;1 no-zero right-justified color &amp;amp;2.&lt;/P&gt;&lt;P&gt;END-OF-DEFINITION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The example declares a macro write_stat. The macro prints&amp;#151;after truncating their zeros&amp;#151;variables in a right-aligned format in the color specified by number &amp;amp;2. Instead of writing similar WRITE statements repeatedly, you can simply call the macro and pass the desired output specifications as parameters, like this:&lt;/P&gt;&lt;P&gt;Write_stat var1 1.&lt;/P&gt;&lt;P&gt;Write_stat var2 2.       &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Reading/changing variable values&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;You can use macros to replace any set of repetitive statements that check or modify values of variables. Typical examples are simple IF checks or CLEAR statements. For simplicity's sake, I'm showing only how the body of such macros may look:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If not &amp;amp;1 is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Endif.&lt;/P&gt;&lt;P&gt;clear: &amp;amp;1,&lt;/P&gt;&lt;P&gt;&amp;amp;2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Formulas or calculations&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;You can use macros to define formulas for complex calculations. In this case, the placeholders may be operands (such as +, -), constant values, or local variables. Here's an example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DEFINE operation.&lt;/P&gt;&lt;P&gt;result = ( &amp;amp;1 &amp;amp;2 &amp;amp;3 ) &amp;amp;4 ( &amp;amp;5 &amp;amp;6 &amp;amp;7 ).&lt;/P&gt;&lt;P&gt;END-OF-DEFINITION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Operation 5 &amp;#150; 3 / var2 + 9.&lt;/P&gt;&lt;P&gt;Operation var1 + 7 * 6 + 5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Working with heavy data&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Many SAP programs use macros to export and import data to and from the database. Consumption of system resources is optimal if macros are employed, particularly when a large amount of data is involved:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DEFINE EXPORT_MACRO.&lt;/P&gt;&lt;P&gt;Export  &amp;amp;1  &amp;amp;2  &amp;amp;3  to database indx(DB) id 'DATA'.&lt;/P&gt;&lt;P&gt;END-OF-DEFINITION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXPORT_MACRO itab1 itab2 itab3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this example, the data of three internal tables that may each consist of a large number of records is exported to the table INDX. Had we used form routines in this case, you can't imagine the resources (CPU time and memory) that would be consumed while passing tables as parameters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this Helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;VB&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Jan 2008 03:02:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/macro/m-p/3363702#M807127</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-31T03:02:43Z</dc:date>
    </item>
  </channel>
</rss>

