<?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: how to write macro. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-macro/m-p/2730693#M633856</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;Check this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
define update_flg.
  move &amp;amp;1 to &amp;amp;2-updkz.
  modify &amp;amp;3 from &amp;amp;2 index &amp;amp;4.
end-of-definition.                       " Update_flg

update_flg c_x wa_ysccpvapitem i_ysccpvapitem v_tabix.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;a®&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 03 Sep 2007 07:01:46 GMT</pubDate>
    <dc:creator>former_member194669</dc:creator>
    <dc:date>2007-09-03T07:01:46Z</dc:date>
    <item>
      <title>how to write macro.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-macro/m-p/2730691#M633854</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi all,&lt;/P&gt;&lt;P&gt;     i want to write one macro in my function module for selecting data from one table and give back to the function module.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how to code that and how to call in fm. i dont no anything about macro.&lt;/P&gt;&lt;P&gt;please help me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks in advance.&lt;/P&gt;&lt;P&gt;vinod&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Sep 2007 06:58:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-macro/m-p/2730691#M633854</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-03T06:58:03Z</dc:date>
    </item>
    <item>
      <title>Re: how to write macro.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-macro/m-p/2730692#M633855</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Macro Add-Range Definition&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;define add-range.&lt;/P&gt;&lt;P&gt;  &amp;amp;3-sign   = &amp;amp;1.&lt;/P&gt;&lt;P&gt;  &amp;amp;3-option = &amp;amp;2.&lt;/P&gt;&lt;P&gt;  &amp;amp;3-low    = &amp;amp;4.&lt;/P&gt;&lt;P&gt;  &amp;amp;3-high   = &amp;amp;5.&lt;/P&gt;&lt;P&gt;  append &amp;amp;3.&lt;/P&gt;&lt;P&gt;end-of-definition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Macro Implementation&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    add-range 'I' 'EQ' w_allc_n w_allc ' '.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;See the documentation below.&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;DEFINE &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basic form &lt;/P&gt;&lt;P&gt;DEFINE macro. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All macro use is expanded fully in translation. Macros are a text substitute for the translation phase - not a modularization technique for runtime use. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You conclude a macro with the END-OF-DEFINITION statement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you define a macro, you can use placeholders (&amp;amp;n, where n = 1, 2, ..., 9). When the macro is expanded, &amp;amp;n is replaced with the n-th current parameter. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example &lt;/P&gt;&lt;P&gt;Suppose you define a macro "INCREMENT", which you then use in your program. &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;Notes &lt;/P&gt;&lt;P&gt;As a rule, you should use subroutines (FORM, FUNCTION) instead of macros. This is because subroutines - unlike macros - are supported by all of the ABAP Workbench tools (debugging, runtime analysis, runtime error handling, ...). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You cannot define a macro within a macro using the DEFINE statement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You cannot use an ABAP keyword as a macro name. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The validity of a macro definition is determined by its position in the source code. You can use a given macro in any line of code following its definition. There is no distinction between global and local macros. For example, the fact that a macro is defined within a subroutine has no effect on its validity. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you redefine a macro, that is, assign a new meaning to an existing name, the new meaning takes effect from the position in the program where the macro was redefined. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Pratyusha&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Pratyu Usha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Sep 2007 07:00:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-macro/m-p/2730692#M633855</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-03T07:00:06Z</dc:date>
    </item>
    <item>
      <title>Re: how to write macro.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-macro/m-p/2730693#M633856</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;Check this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
define update_flg.
  move &amp;amp;1 to &amp;amp;2-updkz.
  modify &amp;amp;3 from &amp;amp;2 index &amp;amp;4.
end-of-definition.                       " Update_flg

update_flg c_x wa_ysccpvapitem i_ysccpvapitem v_tabix.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;a®&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Sep 2007 07:01:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-macro/m-p/2730693#M633856</guid>
      <dc:creator>former_member194669</dc:creator>
      <dc:date>2007-09-03T07:01:46Z</dc:date>
    </item>
    <item>
      <title>Re: how to write macro.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-macro/m-p/2730694#M633857</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&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 &lt;/P&gt;&lt;P&gt;include them in a macro.  For  example, this can  be useful for long calculations or complex &lt;/P&gt;&lt;P&gt;WRITE statements. You can only use a macro within the program in which it is defined, and it &lt;/P&gt;&lt;P&gt;can only 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;&lt;/P&gt;&lt;P&gt;see this sample code&lt;/P&gt;&lt;P&gt;REPORT ZMACRO.&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;*-- End of Program&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="541586"&gt;&lt;/A&gt;&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;srinivas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Sep 2007 07:06:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-macro/m-p/2730694#M633857</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-03T07:06:14Z</dc:date>
    </item>
    <item>
      <title>Re: how to write macro.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-macro/m-p/2730695#M633858</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; See below code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &amp;lt;b&amp;gt;Macro in ABAP &lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Macro in ABAP&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Submitted by : SAP Basis, ABAP Programming and Other IMG Stuff&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;               &lt;A href="http://www.sap-img.com" target="test_blank"&gt;http://www.sap-img.com&lt;/A&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;REPORT ZMACRO.&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;*-- End of Program&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward if helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Sep 2007 07:10:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-macro/m-p/2730695#M633858</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-03T07:10:01Z</dc:date>
    </item>
  </channel>
</rss>

