<?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 Define Macro in a class constructor error in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/define-macro-in-a-class-constructor-error/m-p/12392732#M1994900</link>
    <description>&lt;P&gt;Hello, I have the below code in a constructor to a class. I know that this is not a good one but I am going to re-construct this class later. The code is:&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;  method constructor.
    clear( ).
    define log_mess.
      CLEAR gs_log_message.
      gs_log_message-msgty = &amp;amp;1.
      gs_log_message-msgid = &amp;amp;2.
      gs_log_message-msgno = &amp;amp;3.
      gs_log_message-msgv1 = &amp;amp;4.
      gs_log_message-msgv2 = &amp;amp;5.
      gs_log_message-msgv3 = &amp;amp;6.
      gs_log_message-msgv4 = &amp;amp;7.
      zcl_slg1_log=&amp;gt;add_log( gs_log_message ). "SLG1

    IF &amp;amp;1 EQ 'E'.
     gv_error = abap_true.
    ENDIF.
    end-of-definition.
  endmethod.
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;This give the below error in eclipse "The statement "LOG_MESS" is invalid. Check the spelling. spelling." but with F3 does to the macro and when you activate the class all are ok and the error disappeared.&lt;/P&gt;
  &lt;P&gt;Does anyone knows how to eliminate the error during the CHECK (Ctrl+F2).&lt;/P&gt;
  &lt;P&gt;Thnaks Elias&lt;/P&gt;</description>
    <pubDate>Mon, 14 Jun 2021 09:45:34 GMT</pubDate>
    <dc:creator>ekekakos</dc:creator>
    <dc:date>2021-06-14T09:45:34Z</dc:date>
    <item>
      <title>Define Macro in a class constructor error</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/define-macro-in-a-class-constructor-error/m-p/12392732#M1994900</link>
      <description>&lt;P&gt;Hello, I have the below code in a constructor to a class. I know that this is not a good one but I am going to re-construct this class later. The code is:&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;  method constructor.
    clear( ).
    define log_mess.
      CLEAR gs_log_message.
      gs_log_message-msgty = &amp;amp;1.
      gs_log_message-msgid = &amp;amp;2.
      gs_log_message-msgno = &amp;amp;3.
      gs_log_message-msgv1 = &amp;amp;4.
      gs_log_message-msgv2 = &amp;amp;5.
      gs_log_message-msgv3 = &amp;amp;6.
      gs_log_message-msgv4 = &amp;amp;7.
      zcl_slg1_log=&amp;gt;add_log( gs_log_message ). "SLG1

    IF &amp;amp;1 EQ 'E'.
     gv_error = abap_true.
    ENDIF.
    end-of-definition.
  endmethod.
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;This give the below error in eclipse "The statement "LOG_MESS" is invalid. Check the spelling. spelling." but with F3 does to the macro and when you activate the class all are ok and the error disappeared.&lt;/P&gt;
  &lt;P&gt;Does anyone knows how to eliminate the error during the CHECK (Ctrl+F2).&lt;/P&gt;
  &lt;P&gt;Thnaks Elias&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jun 2021 09:45:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/define-macro-in-a-class-constructor-error/m-p/12392732#M1994900</guid>
      <dc:creator>ekekakos</dc:creator>
      <dc:date>2021-06-14T09:45:34Z</dc:date>
    </item>
    <item>
      <title>Re: Define Macro in a class constructor error</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/define-macro-in-a-class-constructor-error/m-p/12392733#M1994901</link>
      <description>&lt;P&gt;I cannot see anything wrong in your code (from the syntax point of view).&lt;BR /&gt;About logging... if you are able to import programs to your system (your boss allows you, I mean), I recommend you to take a look at &lt;A href="https://github.com/ABAP-Logger/ABAP-Logger"&gt;Git ABAP logger&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I found it through a book of Paul Hardy, and they're awesome (the class...but the book and its author are awesome too) &lt;/P&gt;</description>
      <pubDate>Mon, 14 Jun 2021 10:47:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/define-macro-in-a-class-constructor-error/m-p/12392733#M1994901</guid>
      <dc:creator>VXLozano</dc:creator>
      <dc:date>2021-06-14T10:47:58Z</dc:date>
    </item>
    <item>
      <title>Re: Define Macro in a class constructor error</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/define-macro-in-a-class-constructor-error/m-p/12392734#M1994902</link>
      <description>&lt;P&gt;I found what was wrong. For some reason the constructor went below the methods that call the macros that's why I have this error, but the program was OK. Now I move the Constructor to the begining of the class implementation and the errors from the checking disappeared.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Elias&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jun 2021 11:16:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/define-macro-in-a-class-constructor-error/m-p/12392734#M1994902</guid>
      <dc:creator>ekekakos</dc:creator>
      <dc:date>2021-06-14T11:16:12Z</dc:date>
    </item>
    <item>
      <title>Re: Define Macro in a class constructor error</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/define-macro-in-a-class-constructor-error/m-p/12392735#M1994903</link>
      <description>&lt;P&gt;Not a single message in my Eclipse ADT 2020-09 (I know, I'm late) for this code (local class inside executable program) - I also tested in a global class, no message either:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT zreport.
CLASS lcl_app DEFINITION.
  PUBLIC SECTION.
    METHODS constructor.
ENDCLASS.
CLASS lcl_app IMPLEMENTATION.
  method constructor.
    define log_mess.
      assert 1 = 1.
    end-of-definition.
  ENDMETHOD.
ENDCLASS.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Jun 2021 11:19:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/define-macro-in-a-class-constructor-error/m-p/12392735#M1994903</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2021-06-14T11:19:27Z</dc:date>
    </item>
    <item>
      <title>Re: Define Macro in a class constructor error</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/define-macro-in-a-class-constructor-error/m-p/12392736#M1994904</link>
      <description>&lt;P&gt;I am putting a picture with error&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1946781-define-error.jpg" /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jun 2021 11:27:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/define-macro-in-a-class-constructor-error/m-p/12392736#M1994904</guid>
      <dc:creator>ekekakos</dc:creator>
      <dc:date>2021-06-14T11:27:21Z</dc:date>
    </item>
    <item>
      <title>Re: Define Macro in a class constructor error</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/define-macro-in-a-class-constructor-error/m-p/12392737#M1994905</link>
      <description>&lt;P&gt;This demonstrates that there's a problem with your code. There's no way the syntax of a class should be wrong if a method implementation comes before another one. This is a &lt;A href="https://en.wikipedia.org/wiki/Code_smell" target="_blank"&gt;code smell&lt;/A&gt;, and a problem waiting to bite again. If someone sorts the methods of the class, for example, it'll be syntactically incorrect again. And any new methods will have to have their implementation after the constructor.&lt;/P&gt;&lt;P&gt;Of course, the problem is the macro. There are two issues:&lt;/P&gt;&lt;P&gt;1) You've defined it in the wrong place. It should be defined in the Macro section.&lt;/P&gt;&lt;P&gt;2) Macros are obsolete and should not be used. Define your own logging class, or use the logger Vic recommended. Or replace the macro with a method. &lt;/P&gt;</description>
      <pubDate>Mon, 14 Jun 2021 12:15:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/define-macro-in-a-class-constructor-error/m-p/12392737#M1994905</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2021-06-14T12:15:58Z</dc:date>
    </item>
    <item>
      <title>Re: Define Macro in a class constructor error</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/define-macro-in-a-class-constructor-error/m-p/12392738#M1994906</link>
      <description>&lt;P&gt;Matthew you are right about the 2nd issue, that's why I said that I need an answer for now because I am going to re-engineer it. For the 1st issue I didn't know that there is a specific place for macros in a class. I will try to find it where.&lt;/P&gt;&lt;P&gt;As far as concern the code smell, I will check it and come back late in the evening.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Elias&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jun 2021 13:48:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/define-macro-in-a-class-constructor-error/m-p/12392738#M1994906</guid>
      <dc:creator>ekekakos</dc:creator>
      <dc:date>2021-06-14T13:48:13Z</dc:date>
    </item>
    <item>
      <title>Re: Define Macro in a class constructor error</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/define-macro-in-a-class-constructor-error/m-p/12392739#M1994907</link>
      <description>&lt;P&gt;defining a macro to populate a method of another class &amp;amp; populate a global variable for the result. &lt;/P&gt;&lt;P&gt;This is terrible, could you post your code here : &lt;/P&gt;&lt;P&gt;&lt;A href="https://answers.sap.com/articles/12984186/share-your-abap-gore-part-2.html" target="test_blank"&gt;https://answers.sap.com/articles/12984186/share-your-abap-gore-part-2.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jun 2021 13:56:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/define-macro-in-a-class-constructor-error/m-p/12392739#M1994907</guid>
      <dc:creator>FredericGirod</dc:creator>
      <dc:date>2021-06-14T13:56:47Z</dc:date>
    </item>
  </channel>
</rss>

