<?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: About CLASS-METHODS? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/about-class-methods/m-p/3121742#M741334</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Declares static events in a class or interface in ABAP Objects. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can only use this statement in the declaration part of a class declaration (see CLASS ) or interface definition (see INTERFACE). The CLASS- prefix to the EVENTS statement means that the event evt is declared as a static event. Otherwise, the CLASS-EVENTS statement has the same syntax as the EVENTS statement for instance events. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Static events belong to the static components of a class. Unlike instance events, that can only be triggered in instance methods, static events can be triggered both in instance methods and in static methods. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Within a class, the appearance of static events is the same as that of instance events, and they can be addressed in the same way. You can also define handler methods for static events using the SET HANDLER statement if their visibility allows it. In this case, there is no FOR addition, since the required information is already available through the definition of the event handler method, and you do not have to specify a triggering instance. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note &lt;/P&gt;&lt;P&gt;If the class has a static constructor (a method called CLASS_CONSTRUCTOR) that has not yet been executed in the program, it is executed on a static event in the class before the first registration of an event handler method. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;CLASS C1 DEFINITION. &lt;/P&gt;&lt;P&gt;  PUBLIC SECTION. &lt;/P&gt;&lt;P&gt;    METHODS CONSTRUCTOR. &lt;/P&gt;&lt;P&gt;    CLASS-METHODS CREATE_COUNT_RESET. &lt;/P&gt;&lt;P&gt;    CLASS-EVENTS  COUNT_RESET. &lt;/P&gt;&lt;P&gt;  PRIVATE SECTION. &lt;/P&gt;&lt;P&gt;    CLASS-DATA CREATE_COUNT TYPE I. &lt;/P&gt;&lt;P&gt;ENDCLASS. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS C2 DEFINITION. &lt;/P&gt;&lt;P&gt;  PUBLIC SECTION. &lt;/P&gt;&lt;P&gt;    METHODS COUNT_HANDLER FOR EVENT COUNT_RESET OF C1. &lt;/P&gt;&lt;P&gt;ENDCLASS. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: O1 TYPE REF TO C1, &lt;/P&gt;&lt;P&gt;      O2 LIKE O1, &lt;/P&gt;&lt;P&gt;      O3 LIKE O1, &lt;/P&gt;&lt;P&gt;      HANDL TYPE REF TO C2. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE OBJECT: O1, &lt;/P&gt;&lt;P&gt;               O2, &lt;/P&gt;&lt;P&gt;               O3, &lt;/P&gt;&lt;P&gt;               HANDL. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET HANDLER HANDL-&amp;gt;COUNT_HANDLER. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLEAR: O1, &lt;/P&gt;&lt;P&gt;       O2, &lt;/P&gt;&lt;P&gt;       O3. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL METHOD C1=&amp;gt;CREATE_COUNT_RESET. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS C1 IMPLEMENTATION. &lt;/P&gt;&lt;P&gt;  METHOD CONSTRUCTOR. &lt;/P&gt;&lt;P&gt;    CREATE_COUNT = CREATE_COUNT + 1. &lt;/P&gt;&lt;P&gt;  ENDMETHOD. &lt;/P&gt;&lt;P&gt;  METHOD CREATE_COUNT_RESET. &lt;/P&gt;&lt;P&gt;    CLEAR CREATE_COUNT. &lt;/P&gt;&lt;P&gt;    RAISE EVENT COUNT_RESET. &lt;/P&gt;&lt;P&gt;  ENDMETHOD. &lt;/P&gt;&lt;P&gt;ENDCLASS. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS C2 IMPLEMENTATION. &lt;/P&gt;&lt;P&gt;  METHOD COUNT_HANDLER. &lt;/P&gt;&lt;P&gt;    WRITE 'Object counter reset'. &lt;/P&gt;&lt;P&gt;  ENDMETHOD. &lt;/P&gt;&lt;P&gt;ENDCLASS. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This example builds on the first example in the CLASS-METHODS documentation. It is possible to execute the static method CREATE_COUNT_RESET, even though there are no more instances of class C1. The COUNT_HANDLER method of object HANDL of class C2 is registered as handler for the static event COUNT_RESET, and is triggered.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Nov 2007 10:59:36 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-11-28T10:59:36Z</dc:date>
    <item>
      <title>About CLASS-METHODS?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/about-class-methods/m-p/3121734#M741326</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;In ABAP objects i have seen while declaring methods, they are prefixing CLASS-METHODS?&lt;/P&gt;&lt;P&gt;Actually what does that mean?&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;Ammu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2007 09:56:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/about-class-methods/m-p/3121734#M741326</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-28T09:56:53Z</dc:date>
    </item>
    <item>
      <title>Re: About CLASS-METHODS?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/about-class-methods/m-p/3121735#M741327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Amruth,&lt;/P&gt;&lt;P&gt;CLASS-METHODS is used while declaring the static methods.&lt;/P&gt;&lt;P&gt;CLASS-DATA is used while declaring static attributes.&lt;/P&gt;&lt;P&gt;Static methods can access only static attributes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if it is useful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chandru&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2007 10:00:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/about-class-methods/m-p/3121735#M741327</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-28T10:00:01Z</dc:date>
    </item>
    <item>
      <title>Re: About CLASS-METHODS?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/about-class-methods/m-p/3121736#M741328</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is the use of static methods?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2007 10:00:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/about-class-methods/m-p/3121736#M741328</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-28T10:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: About CLASS-METHODS?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/about-class-methods/m-p/3121737#M741329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No answer for the other question&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2007 10:13:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/about-class-methods/m-p/3121737#M741329</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-28T10:13:01Z</dc:date>
    </item>
    <item>
      <title>Re: About CLASS-METHODS?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/about-class-methods/m-p/3121738#M741330</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;Static methods work like global functions, restricted to the context of a class.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  static methods can only access static attributes and can only trigger static events&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Ravikanth Alapati&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2007 10:20:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/about-class-methods/m-p/3121738#M741330</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-28T10:20:27Z</dc:date>
    </item>
    <item>
      <title>Re: About CLASS-METHODS?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/about-class-methods/m-p/3121739#M741331</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;A static method can be called without prior instantiation of the class. If the method does not need to know any details of an instance then we can define the method as static.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Static methods can only use static components in their implementation part.Static methods are called using CALL METHOD &amp;lt;classname&amp;gt;=&amp;gt;&amp;lt;class_method&amp;gt;.&lt;/P&gt;&lt;P&gt;If you are calling a static method from within the class, you can omit the class name. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You access static attributes using &amp;lt;classname&amp;gt;=&amp;gt;&amp;lt;class_attribute&amp;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;Omkar.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2007 10:30:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/about-class-methods/m-p/3121739#M741331</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-28T10:30:08Z</dc:date>
    </item>
    <item>
      <title>Re: About CLASS-METHODS?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/about-class-methods/m-p/3121740#M741332</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can only use this statement in the declaration part of a class definition (see CLASS ) or in an interface definition (see INTERFACE). The CLASS- prefix to the METHODS statement means that the method meth is declared as a static method. Otherwise, the CLASS-METHODS statement has the same syntax as the METHODS statement for instance methods. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Static methods belong to the static components of a class. Unlike instance methods, which can access both instance and static attributes, and trigger both instance and static events, static methods can only access static attributes (see CLASS-DATA), and can only trigger static events (see CLASS-EVENTS). This makes static methods independent of instances, and callable even when no instances of a class exist. Static methods work like global functions, restricted to the context of a class. You use them to work with the contents of static attributes, or for tasks that affect the entire system. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Static methods cannot be redefined in a subclass. For this reason, you do not need to declare them as abstract or final methods. The REDEFINITION, ABSTRACT, and FINAL additions of the METHODS statement are not allowed in the CLASS-METHODS statement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Within a class, static methods have the same appearance as instance methods, and can be addressed in the same way. They can also be addressed from outside the class if their visibility allows. When you address a static method from outside its class, you can use either an object reference or the class name. For example, if meth is a static method of the class class , you can address it using CALL METHOD class=&amp;gt;meth in any program in which the class class is declared.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2007 10:48:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/about-class-methods/m-p/3121740#M741332</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-28T10:48:18Z</dc:date>
    </item>
    <item>
      <title>Re: About CLASS-METHODS?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/about-class-methods/m-p/3121741#M741333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chandra,&lt;/P&gt;&lt;P&gt;Because You replied telling that CLASS-METHODS triggers CLASS-EVENTS.&lt;/P&gt;&lt;P&gt;BTW What does class-events mean? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Amruth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2007 10:58:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/about-class-methods/m-p/3121741#M741333</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-28T10:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: About CLASS-METHODS?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/about-class-methods/m-p/3121742#M741334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Declares static events in a class or interface in ABAP Objects. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can only use this statement in the declaration part of a class declaration (see CLASS ) or interface definition (see INTERFACE). The CLASS- prefix to the EVENTS statement means that the event evt is declared as a static event. Otherwise, the CLASS-EVENTS statement has the same syntax as the EVENTS statement for instance events. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Static events belong to the static components of a class. Unlike instance events, that can only be triggered in instance methods, static events can be triggered both in instance methods and in static methods. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Within a class, the appearance of static events is the same as that of instance events, and they can be addressed in the same way. You can also define handler methods for static events using the SET HANDLER statement if their visibility allows it. In this case, there is no FOR addition, since the required information is already available through the definition of the event handler method, and you do not have to specify a triggering instance. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note &lt;/P&gt;&lt;P&gt;If the class has a static constructor (a method called CLASS_CONSTRUCTOR) that has not yet been executed in the program, it is executed on a static event in the class before the first registration of an event handler method. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;CLASS C1 DEFINITION. &lt;/P&gt;&lt;P&gt;  PUBLIC SECTION. &lt;/P&gt;&lt;P&gt;    METHODS CONSTRUCTOR. &lt;/P&gt;&lt;P&gt;    CLASS-METHODS CREATE_COUNT_RESET. &lt;/P&gt;&lt;P&gt;    CLASS-EVENTS  COUNT_RESET. &lt;/P&gt;&lt;P&gt;  PRIVATE SECTION. &lt;/P&gt;&lt;P&gt;    CLASS-DATA CREATE_COUNT TYPE I. &lt;/P&gt;&lt;P&gt;ENDCLASS. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS C2 DEFINITION. &lt;/P&gt;&lt;P&gt;  PUBLIC SECTION. &lt;/P&gt;&lt;P&gt;    METHODS COUNT_HANDLER FOR EVENT COUNT_RESET OF C1. &lt;/P&gt;&lt;P&gt;ENDCLASS. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: O1 TYPE REF TO C1, &lt;/P&gt;&lt;P&gt;      O2 LIKE O1, &lt;/P&gt;&lt;P&gt;      O3 LIKE O1, &lt;/P&gt;&lt;P&gt;      HANDL TYPE REF TO C2. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE OBJECT: O1, &lt;/P&gt;&lt;P&gt;               O2, &lt;/P&gt;&lt;P&gt;               O3, &lt;/P&gt;&lt;P&gt;               HANDL. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET HANDLER HANDL-&amp;gt;COUNT_HANDLER. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLEAR: O1, &lt;/P&gt;&lt;P&gt;       O2, &lt;/P&gt;&lt;P&gt;       O3. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL METHOD C1=&amp;gt;CREATE_COUNT_RESET. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS C1 IMPLEMENTATION. &lt;/P&gt;&lt;P&gt;  METHOD CONSTRUCTOR. &lt;/P&gt;&lt;P&gt;    CREATE_COUNT = CREATE_COUNT + 1. &lt;/P&gt;&lt;P&gt;  ENDMETHOD. &lt;/P&gt;&lt;P&gt;  METHOD CREATE_COUNT_RESET. &lt;/P&gt;&lt;P&gt;    CLEAR CREATE_COUNT. &lt;/P&gt;&lt;P&gt;    RAISE EVENT COUNT_RESET. &lt;/P&gt;&lt;P&gt;  ENDMETHOD. &lt;/P&gt;&lt;P&gt;ENDCLASS. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS C2 IMPLEMENTATION. &lt;/P&gt;&lt;P&gt;  METHOD COUNT_HANDLER. &lt;/P&gt;&lt;P&gt;    WRITE 'Object counter reset'. &lt;/P&gt;&lt;P&gt;  ENDMETHOD. &lt;/P&gt;&lt;P&gt;ENDCLASS. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This example builds on the first example in the CLASS-METHODS documentation. It is possible to execute the static method CREATE_COUNT_RESET, even though there are no more instances of class C1. The COUNT_HANDLER method of object HANDL of class C2 is registered as handler for the static event COUNT_RESET, and is triggered.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2007 10:59:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/about-class-methods/m-p/3121742#M741334</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-28T10:59:36Z</dc:date>
    </item>
  </channel>
</rss>

