<?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 help! in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/macro-help/m-p/6419580#M1409100</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have searched the sdn about the macro ,but i have found nothing valuable information. so i have to post a message for help again. the situation is :&lt;/P&gt;&lt;P&gt;DEFINE assign_comp.&lt;/P&gt;&lt;P&gt;fld = &amp;amp;2.&lt;/P&gt;&lt;P&gt;translate fld to upper case.&lt;/P&gt;&lt;P&gt;assign component fld of structure &amp;amp;1 to &amp;amp;3.&lt;/P&gt;&lt;P&gt;END-OF-DEFINITION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS:&amp;lt;zmst_rec&amp;gt; TYPE any,&lt;/P&gt;&lt;P&gt;&amp;lt;int_table&amp;gt; TYPE SORTED TABLE,&lt;/P&gt;&lt;P&gt;&amp;lt;tmp_table&amp;gt; TYPE SORTED TABLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS:&amp;lt;fs&amp;gt;,&amp;lt;fs_1&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM ( ) INTO TABLE &amp;lt;tmp_table&amp;gt; .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT &amp;lt;tmp_table&amp;gt; INTO &amp;lt;zmst_rec&amp;gt;.&lt;/P&gt;&lt;P&gt;assign_comp &amp;lt;zmst_rec&amp;gt;:dateto &amp;lt;fs_1&amp;gt;,datefrom &amp;lt;fs_2&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My doubt is the macro defined 3 parameters ,but the way which is assigned ....i can't understand. why use a colon,and does it mean pass dateto to datefrom ? and anybody can tell me the reason, thanks much.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 13 Dec 2009 13:03:01 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-12-13T13:03:01Z</dc:date>
    <item>
      <title>macro help!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/macro-help/m-p/6419580#M1409100</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have searched the sdn about the macro ,but i have found nothing valuable information. so i have to post a message for help again. the situation is :&lt;/P&gt;&lt;P&gt;DEFINE assign_comp.&lt;/P&gt;&lt;P&gt;fld = &amp;amp;2.&lt;/P&gt;&lt;P&gt;translate fld to upper case.&lt;/P&gt;&lt;P&gt;assign component fld of structure &amp;amp;1 to &amp;amp;3.&lt;/P&gt;&lt;P&gt;END-OF-DEFINITION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS:&amp;lt;zmst_rec&amp;gt; TYPE any,&lt;/P&gt;&lt;P&gt;&amp;lt;int_table&amp;gt; TYPE SORTED TABLE,&lt;/P&gt;&lt;P&gt;&amp;lt;tmp_table&amp;gt; TYPE SORTED TABLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS:&amp;lt;fs&amp;gt;,&amp;lt;fs_1&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM ( ) INTO TABLE &amp;lt;tmp_table&amp;gt; .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT &amp;lt;tmp_table&amp;gt; INTO &amp;lt;zmst_rec&amp;gt;.&lt;/P&gt;&lt;P&gt;assign_comp &amp;lt;zmst_rec&amp;gt;:dateto &amp;lt;fs_1&amp;gt;,datefrom &amp;lt;fs_2&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My doubt is the macro defined 3 parameters ,but the way which is assigned ....i can't understand. why use a colon,and does it mean pass dateto to datefrom ? and anybody can tell me the reason, thanks much.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Dec 2009 13:03:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/macro-help/m-p/6419580#M1409100</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-12-13T13:03:01Z</dc:date>
    </item>
    <item>
      <title>Re: macro help!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/macro-help/m-p/6419581#M1409101</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi junchuan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my first recommendation is &lt;STRONG&gt;not&lt;/STRONG&gt; to use macros. Yo can not debug them and they decrease  heavily the readability of code. Macros replace the source code at compile-time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The second ist: Please post code using the above &amp;lt;_&amp;gt; code markup to enhance readability.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And then the colon: This is SAP BASICS. Using a colon after a statement will repeat the statement for all elements in the comma-separeated list behind.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;assign_comp &amp;lt;zmst_rec&amp;gt;:dateto &amp;lt;fs_1&amp;gt;,datefrom &amp;lt;fs_2&amp;gt;.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;is equal to&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;assign_comp &amp;lt;zmst_rec&amp;gt; dateto &amp;lt;fs_1&amp;gt;.
assign_comp &amp;lt;zmst_rec&amp;gt; datefrom &amp;lt;fs_2&amp;gt;.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A necessary precondition is that datefrom and dateto are char variables containing the strings 'DATEFROM' and 'DATETO'. Otherwise this will not work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The macro&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DEFINE assign_comp.
fld = &amp;amp;2.
translate fld to upper case.
assign component fld of structure &amp;amp;1 to &amp;amp;3.
END-OF-DEFINITION.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;going through the compile-time macro substitution will create&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;translate dateto to upper case."which makes no sense at all in your case
assign component dateto of structure  &amp;lt;zmst_rec&amp;gt; to  &amp;lt;fs_1&amp;gt;.
translate datefrom to upper case."which makes no sense at all in your case
assign component datefrom of structure  &amp;lt;zmst_rec&amp;gt; to  &amp;lt;fs_2&amp;gt;.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just to have maximum transparency, I would probably write&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;ASSIGN COMPONENT:
  'DATETO'    OF STRUCTURE &amp;lt;zmst_rec&amp;gt; to &amp;lt;fs_1&amp;gt;,
  'DATEFROM'  OF STRUCTURE &amp;lt;zmst_rec&amp;gt; to &amp;lt;fs_2&amp;gt;.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Less is more.&lt;/CODE&gt;&lt;/PRE&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;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Dec 2009 13:55:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/macro-help/m-p/6419581#M1409101</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2009-12-13T13:55:45Z</dc:date>
    </item>
    <item>
      <title>Re: macro help!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/macro-help/m-p/6419582#M1409102</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks Clemens .i understand now thanks a lot.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Dec 2009 02:12:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/macro-help/m-p/6419582#M1409102</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-12-14T02:12:39Z</dc:date>
    </item>
  </channel>
</rss>

