<?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 Error while calling a super class public method in the subclass constructor in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-calling-a-super-class-public-method-in-the-subclass-constructor/m-p/3517974#M846107</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;I have code like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS gacl_applog DEFINITION ABSTRACT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    METHODS: &lt;/P&gt;&lt;P&gt;            create_new_a&lt;/P&gt;&lt;P&gt;               IMPORTING  pf_obj       TYPE balobj_d&lt;/P&gt;&lt;P&gt;                          pf_subobj    TYPE balsubobj&lt;/P&gt;&lt;P&gt;                          pf_extnumber TYPE string&lt;/P&gt;&lt;P&gt;               EXPORTING  pfx_log_hndl TYPE balloghndl&lt;/P&gt;&lt;P&gt;               EXCEPTIONS error&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS gacl_applog IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD create_new_a.&lt;/P&gt;&lt;P&gt;    DATA: ls_log TYPE bal_s_log.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Header aufsetzen&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    MOVE pf_extnumber TO ls_log-extnumber.&lt;/P&gt;&lt;P&gt;    ls_log-object     = pf_obj.&lt;/P&gt;&lt;P&gt;    ls_log-subobject  = pf_subobj.&lt;/P&gt;&lt;P&gt;    ls_log-aluser     = sy-uname.&lt;/P&gt;&lt;P&gt;    ls_log-alprog     = sy-repid.&lt;/P&gt;&lt;P&gt;    ls_log-aldate     = sy-datum.&lt;/P&gt;&lt;P&gt;    ls_log-altime     = sy-uzeit.&lt;/P&gt;&lt;P&gt;    ls_log-aldate_del = ls_log-aldate + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL FUNCTION 'BAL_LOG_CREATE'&lt;/P&gt;&lt;P&gt;         EXPORTING&lt;/P&gt;&lt;P&gt;              i_s_log      = ls_log&lt;/P&gt;&lt;P&gt;         IMPORTING&lt;/P&gt;&lt;P&gt;              e_log_handle = pfx_log_hndl&lt;/P&gt;&lt;P&gt;         EXCEPTIONS&lt;/P&gt;&lt;P&gt;              OTHERS       = 1.&lt;/P&gt;&lt;P&gt;    IF ( sy-subrc NE 0 ).&lt;/P&gt;&lt;P&gt;      MESSAGE ID      sy-msgid TYPE sy-msgty NUMBER sy-msgno&lt;/P&gt;&lt;P&gt;              WITH    sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4&lt;/P&gt;&lt;P&gt;              RAISING error.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS gcl_applog_temp DEFINITION INHERITING FROM gacl_applog.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    DATA: log_hndl   TYPE balloghndl READ-ONLY&lt;/P&gt;&lt;P&gt;        , t_log_hndl TYPE bal_t_logh READ-ONLY&lt;/P&gt;&lt;P&gt;        .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    METHODS: constructor&lt;/P&gt;&lt;P&gt;               IMPORTING  pf_obj       TYPE balobj_d&lt;/P&gt;&lt;P&gt;                          pf_subobj    TYPE balsubobj&lt;/P&gt;&lt;P&gt;                          pf_extnumber TYPE string&lt;/P&gt;&lt;P&gt;               EXCEPTIONS error&lt;/P&gt;&lt;P&gt;           , msg_add      REDEFINITION&lt;/P&gt;&lt;P&gt;           , display      REDEFINITION&lt;/P&gt;&lt;P&gt;           .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS gcl_applog_temp IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL METHOD create_new_a&lt;/P&gt;&lt;P&gt;           EXPORTING  pf_obj       = pf_obj&lt;/P&gt;&lt;P&gt;                      pf_subobj    = pf_subobj&lt;/P&gt;&lt;P&gt;                      pf_extnumber = pf_extnumber&lt;/P&gt;&lt;P&gt;           IMPORTING  pfx_log_hndl = log_hndl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    IF ( sy-subrc NE 0 ).&lt;/P&gt;&lt;P&gt;      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno&lt;/P&gt;&lt;P&gt;              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4&lt;/P&gt;&lt;P&gt;              RAISING error.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A public method of Super class has been called from the constructor of the sub class. we are getting the syntax error :&lt;/P&gt;&lt;P&gt;' In the constructor method, you can only access instance attributes, instance methods, or "ME" after calling the constructor of the superclass&amp;#133;'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please suggest how to change the code with out affecting the functioanlity.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you ,&lt;/P&gt;&lt;P&gt;Lakshmi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 14 Mar 2008 07:53:51 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-03-14T07:53:51Z</dc:date>
    <item>
      <title>Error while calling a super class public method in the subclass constructor</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-calling-a-super-class-public-method-in-the-subclass-constructor/m-p/3517974#M846107</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;I have code like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS gacl_applog DEFINITION ABSTRACT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    METHODS: &lt;/P&gt;&lt;P&gt;            create_new_a&lt;/P&gt;&lt;P&gt;               IMPORTING  pf_obj       TYPE balobj_d&lt;/P&gt;&lt;P&gt;                          pf_subobj    TYPE balsubobj&lt;/P&gt;&lt;P&gt;                          pf_extnumber TYPE string&lt;/P&gt;&lt;P&gt;               EXPORTING  pfx_log_hndl TYPE balloghndl&lt;/P&gt;&lt;P&gt;               EXCEPTIONS error&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS gacl_applog IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD create_new_a.&lt;/P&gt;&lt;P&gt;    DATA: ls_log TYPE bal_s_log.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Header aufsetzen&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    MOVE pf_extnumber TO ls_log-extnumber.&lt;/P&gt;&lt;P&gt;    ls_log-object     = pf_obj.&lt;/P&gt;&lt;P&gt;    ls_log-subobject  = pf_subobj.&lt;/P&gt;&lt;P&gt;    ls_log-aluser     = sy-uname.&lt;/P&gt;&lt;P&gt;    ls_log-alprog     = sy-repid.&lt;/P&gt;&lt;P&gt;    ls_log-aldate     = sy-datum.&lt;/P&gt;&lt;P&gt;    ls_log-altime     = sy-uzeit.&lt;/P&gt;&lt;P&gt;    ls_log-aldate_del = ls_log-aldate + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL FUNCTION 'BAL_LOG_CREATE'&lt;/P&gt;&lt;P&gt;         EXPORTING&lt;/P&gt;&lt;P&gt;              i_s_log      = ls_log&lt;/P&gt;&lt;P&gt;         IMPORTING&lt;/P&gt;&lt;P&gt;              e_log_handle = pfx_log_hndl&lt;/P&gt;&lt;P&gt;         EXCEPTIONS&lt;/P&gt;&lt;P&gt;              OTHERS       = 1.&lt;/P&gt;&lt;P&gt;    IF ( sy-subrc NE 0 ).&lt;/P&gt;&lt;P&gt;      MESSAGE ID      sy-msgid TYPE sy-msgty NUMBER sy-msgno&lt;/P&gt;&lt;P&gt;              WITH    sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4&lt;/P&gt;&lt;P&gt;              RAISING error.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS gcl_applog_temp DEFINITION INHERITING FROM gacl_applog.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    DATA: log_hndl   TYPE balloghndl READ-ONLY&lt;/P&gt;&lt;P&gt;        , t_log_hndl TYPE bal_t_logh READ-ONLY&lt;/P&gt;&lt;P&gt;        .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    METHODS: constructor&lt;/P&gt;&lt;P&gt;               IMPORTING  pf_obj       TYPE balobj_d&lt;/P&gt;&lt;P&gt;                          pf_subobj    TYPE balsubobj&lt;/P&gt;&lt;P&gt;                          pf_extnumber TYPE string&lt;/P&gt;&lt;P&gt;               EXCEPTIONS error&lt;/P&gt;&lt;P&gt;           , msg_add      REDEFINITION&lt;/P&gt;&lt;P&gt;           , display      REDEFINITION&lt;/P&gt;&lt;P&gt;           .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS gcl_applog_temp IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL METHOD create_new_a&lt;/P&gt;&lt;P&gt;           EXPORTING  pf_obj       = pf_obj&lt;/P&gt;&lt;P&gt;                      pf_subobj    = pf_subobj&lt;/P&gt;&lt;P&gt;                      pf_extnumber = pf_extnumber&lt;/P&gt;&lt;P&gt;           IMPORTING  pfx_log_hndl = log_hndl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    IF ( sy-subrc NE 0 ).&lt;/P&gt;&lt;P&gt;      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno&lt;/P&gt;&lt;P&gt;              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4&lt;/P&gt;&lt;P&gt;              RAISING error.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A public method of Super class has been called from the constructor of the sub class. we are getting the syntax error :&lt;/P&gt;&lt;P&gt;' In the constructor method, you can only access instance attributes, instance methods, or "ME" after calling the constructor of the superclass&amp;#133;'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please suggest how to change the code with out affecting the functioanlity.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you ,&lt;/P&gt;&lt;P&gt;Lakshmi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Mar 2008 07:53:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-calling-a-super-class-public-method-in-the-subclass-constructor/m-p/3517974#M846107</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-14T07:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: Error while calling a super class public method in the subclass constructor</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-calling-a-super-class-public-method-in-the-subclass-constructor/m-p/3517975#M846108</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;try calling the method by using &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;super-&amp;gt;method &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;otherwide you can try to call the method like this &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;divide_1_by( EXPORTING operand = 4 IMPORTING result = res ). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Mar 2008 08:24:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-calling-a-super-class-public-method-in-the-subclass-constructor/m-p/3517975#M846108</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-14T08:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: Error while calling a super class public method in the subclass constructor</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-calling-a-super-class-public-method-in-the-subclass-constructor/m-p/3517976#M846109</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;&lt;STRONG&gt;Call that method by instance of Subclass.&lt;/STRONG&gt;   OR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SUPER--&amp;gt;method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Read very useful document &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Constructors&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Constructors are special methods that cannot be called using CALL METHOD. Instead, they are called automatically by the system to set the starting state of a new object or class. There are two types of constructors - instance constructors and static constructors. Constructors are methods with a predefined name. To use them, you must declare them explicitly in the class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The instance constructor of a class is the predefined instance method CONSTRUCTOR. You declare it in the public section as follows: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;METHODS CONSTRUCTOR &lt;/P&gt;&lt;P&gt;        IMPORTING.. [VALUE(]&amp;lt;ii&amp;gt;[)] TYPE type [OPTIONAL].. &lt;/P&gt;&lt;P&gt;        EXCEPTIONS.. &amp;lt;ei&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and implement it in the implementation section like any other method. The system calls the instance constructor once for each instance of the class, directly after the object has been created in the CREATE OBJECT statement. You can pass the input parameters of the instance constructor and handle its exceptions using the EXPORTING and EXCEPTIONS additions in the CREATE OBJECT statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The static constructor of a class is the predefined static method CLASS_CONSTRUCTOR. You declare it in the public section as follows: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS-METHODS CLASS_CONSTRUCTOR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and implement it in the implementation section like any other method. The static constructor has no parameters. The system calls the static constructor once for each class, before the class is accessed for the first time. The static constructor cannot therefore access the components of its own class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls. reward if useful....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Mar 2008 08:30:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-calling-a-super-class-public-method-in-the-subclass-constructor/m-p/3517976#M846109</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-14T08:30:00Z</dc:date>
    </item>
  </channel>
</rss>

