<?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: How to call method dynamically? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-call-method-dynamically/m-p/2887716#M678431</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;currently, we use below codes to realize this, but &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                DATA:&lt;/P&gt;&lt;P&gt;                        l_parameters         TYPE abap_parmbind_tab,&lt;/P&gt;&lt;P&gt;                        l_parameter_wa       TYPE abap_parmbind,&lt;/P&gt;&lt;P&gt;                        l_class_param_wa     TYPE swcont,&lt;/P&gt;&lt;P&gt;                        l_descr_ref          TYPE REF TO cl_abap_classdescr,&lt;/P&gt;&lt;P&gt;                        l_constructor        TYPE abap_methdescr,&lt;/P&gt;&lt;P&gt;                        l_constructor_param  TYPE abap_parmdescr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                FIELD-SYMBOLS: &amp;lt;g&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                DATA: lv_ref1 TYPE REF TO cl_abap_classdescr.&lt;/P&gt;&lt;P&gt;                DATA: lv_ref TYPE REF TO object.&lt;/P&gt;&lt;P&gt;                DATA: lv_ref2 TYPE REF TO object.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                gv_class = "class_name ".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                lv_ref1 ?= cl_abap_typedescr=&amp;gt;describe_by_name( gv_class ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                l_parameter_wa-name = 'RETURN'.&lt;/P&gt;&lt;P&gt;                l_parameter_wa-kind = cl_abap_classdescr=&amp;gt;exporting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                INSERT l_parameter_wa INTO TABLE l_parameters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                CREATE OBJECT lv_ref&lt;/P&gt;&lt;P&gt;                  TYPE&lt;/P&gt;&lt;P&gt;                    (gv_class)&lt;/P&gt;&lt;P&gt;                  PARAMETER-TABLE&lt;/P&gt;&lt;P&gt;                    l_parameters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                CALL METHOD lv_ref-&amp;gt;('GET_INSTANCE')&lt;/P&gt;&lt;P&gt;                  receiving&lt;/P&gt;&lt;P&gt;                    return = lv_ref2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but when create the object, error shows:&lt;/P&gt;&lt;P&gt;CREATE OBJECT is not permitted for this class at this point.     It was tried to create an instance of the class "CL_HRRCF_CANDIDATE_BUPA_BL".&lt;/P&gt;&lt;P&gt;This class is declared as 'CREATE PRIVATE', which means that the 'CREATE' for this class is 'private', that means, creating intances of this class is only allowed within the class (in the methods of the class), but not outside.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help me on this? thnak very much!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 20 Sep 2007 07:23:51 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-09-20T07:23:51Z</dc:date>
    <item>
      <title>How to call method dynamically?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-call-method-dynamically/m-p/2887714#M678429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;we called the static method CL_ABAP_CLASSDESCR=&amp;gt;DESCRIBE_BY_NAME( '&amp;lt;class_name&amp;gt;' ). &lt;/P&gt;&lt;P&gt;The method returns an instance of CL_ABAP_CLASSDESCR, the instance name is l_object.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;l_object = cl_abap_classdescr=&amp;gt;describe_by_name( class_name ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We had already know that in this class(class_name), it has a Public method GET_INSTANCE(),  then &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                call method l_object-&amp;gt;get_instance&lt;/P&gt;&lt;P&gt;                  RECEIVING&lt;/P&gt;&lt;P&gt;                    return = l_objectXX.     &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but error shows: Method "GET_INSTANCE" is unknown or PROTECTED or PRIVATE. then how to use the l_object to call this method dynamically??&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Sep 2007 02:56:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-call-method-dynamically/m-p/2887714#M678429</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-20T02:56:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to call method dynamically?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-call-method-dynamically/m-p/2887715#M678430</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The class_name here is dynamic, the value is passed by other program. so the methods of the different class_name are dynamic as well.  that is why we can not use create object obj type class_name here.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Sep 2007 03:06:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-call-method-dynamically/m-p/2887715#M678430</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-20T03:06:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to call method dynamically?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-call-method-dynamically/m-p/2887716#M678431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;currently, we use below codes to realize this, but &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                DATA:&lt;/P&gt;&lt;P&gt;                        l_parameters         TYPE abap_parmbind_tab,&lt;/P&gt;&lt;P&gt;                        l_parameter_wa       TYPE abap_parmbind,&lt;/P&gt;&lt;P&gt;                        l_class_param_wa     TYPE swcont,&lt;/P&gt;&lt;P&gt;                        l_descr_ref          TYPE REF TO cl_abap_classdescr,&lt;/P&gt;&lt;P&gt;                        l_constructor        TYPE abap_methdescr,&lt;/P&gt;&lt;P&gt;                        l_constructor_param  TYPE abap_parmdescr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                FIELD-SYMBOLS: &amp;lt;g&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                DATA: lv_ref1 TYPE REF TO cl_abap_classdescr.&lt;/P&gt;&lt;P&gt;                DATA: lv_ref TYPE REF TO object.&lt;/P&gt;&lt;P&gt;                DATA: lv_ref2 TYPE REF TO object.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                gv_class = "class_name ".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                lv_ref1 ?= cl_abap_typedescr=&amp;gt;describe_by_name( gv_class ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                l_parameter_wa-name = 'RETURN'.&lt;/P&gt;&lt;P&gt;                l_parameter_wa-kind = cl_abap_classdescr=&amp;gt;exporting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                INSERT l_parameter_wa INTO TABLE l_parameters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                CREATE OBJECT lv_ref&lt;/P&gt;&lt;P&gt;                  TYPE&lt;/P&gt;&lt;P&gt;                    (gv_class)&lt;/P&gt;&lt;P&gt;                  PARAMETER-TABLE&lt;/P&gt;&lt;P&gt;                    l_parameters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                CALL METHOD lv_ref-&amp;gt;('GET_INSTANCE')&lt;/P&gt;&lt;P&gt;                  receiving&lt;/P&gt;&lt;P&gt;                    return = lv_ref2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but when create the object, error shows:&lt;/P&gt;&lt;P&gt;CREATE OBJECT is not permitted for this class at this point.     It was tried to create an instance of the class "CL_HRRCF_CANDIDATE_BUPA_BL".&lt;/P&gt;&lt;P&gt;This class is declared as 'CREATE PRIVATE', which means that the 'CREATE' for this class is 'private', that means, creating intances of this class is only allowed within the class (in the methods of the class), but not outside.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help me on this? thnak very much!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Sep 2007 07:23:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-call-method-dynamically/m-p/2887716#M678431</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-20T07:23:51Z</dc:date>
    </item>
  </channel>
</rss>

