<?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: error creating a object in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-creating-a-object/m-p/3668403#M883588</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You'll often see methods such as GET_INSTANCE referred to as factory methods.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 Apr 2008 14:41:18 GMT</pubDate>
    <dc:creator>matt</dc:creator>
    <dc:date>2008-04-09T14:41:18Z</dc:date>
    <item>
      <title>error creating a object</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-creating-a-object/m-p/3668400#M883585</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;&lt;/P&gt;&lt;P&gt;We update our SAP from 4.7 to ECC6.0 and now, in a report program it's giving the next error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- You cannot create an instance of the class "CL_SWF_REP_MANAGER" outside the class...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;at 4.7 it's work fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here it's the code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS cl_swf_rdg_dispatcher DEFINITION LOAD.&lt;/P&gt;&lt;P&gt;DATA: int TYPE REF TO if_swf_rep_workitem_selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;{ ... }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF int IS INITIAL.&lt;/P&gt;&lt;P&gt;    CREATE OBJECT int TYPE cl_swf_rep_manager.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;{ ... }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for ur help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2008 12:01:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-creating-a-object/m-p/3668400#M883585</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-09T12:01:28Z</dc:date>
    </item>
    <item>
      <title>Re: error creating a object</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-creating-a-object/m-p/3668401#M883586</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This occurs because now the instantiation method for the class is private (folder &lt;STRONG&gt;Properties&lt;/STRONG&gt; ), that is, the only way to instantiate the class is using a friend/agent to instantiate the class. The agents are declared as friends of the class, go to the folder &lt;STRONG&gt;Friends&lt;/STRONG&gt; and you will find the class &lt;STRONG&gt;CL_SWF_REP_ITEM2OBJECT&lt;/STRONG&gt;. Now you need to change the reference variable to refer to this friend class/interface with instantion method public and find out in this one how to instantiate the class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2008 12:21:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-creating-a-object/m-p/3668401#M883586</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-09T12:21:51Z</dc:date>
    </item>
    <item>
      <title>Re: error creating a object</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-creating-a-object/m-p/3668402#M883587</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We usually define the class as PROTECTED or PRIVATE to avoid direct access and Final to avoid INHERITING. Thus you must use the method GET_INSTANCE to get a instance of its class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use this way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA o_ref_class  TYPE REF TO cl_swf_rep_manager.
DATA o_ref_interf TYPE REF TO if_swf_rep_workitem_selection.

START-OF-SELECTION.

*// Instantiate your object using Norrowing cast
  o_ref_class ?= cl_swf_rep_manager=&amp;gt;get_instance( ).
*// Instantiate your object using Widening cast
  o_ref_interf = cl_swf_rep_manager=&amp;gt;get_instance( ).

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Don't forget to close this Thread when your question be answered !&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Marcelo Ramos&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2008 14:22:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-creating-a-object/m-p/3668402#M883587</guid>
      <dc:creator>marcelo_ramos1</dc:creator>
      <dc:date>2008-04-09T14:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: error creating a object</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-creating-a-object/m-p/3668403#M883588</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You'll often see methods such as GET_INSTANCE referred to as factory methods.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2008 14:41:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-creating-a-object/m-p/3668403#M883588</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2008-04-09T14:41:18Z</dc:date>
    </item>
  </channel>
</rss>

