<?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: Using a dynamic variable in the Import command of a Method call in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-a-dynamic-variable-in-the-import-command-of-a-method-call/m-p/8592819#M1661721</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;An idea: Instead of a typed parameter you could use a data reference (type ref to data) and dereference it within the method...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kr,&lt;/P&gt;&lt;P&gt;Manu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 Feb 2012 15:34:07 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2012-02-23T15:34:07Z</dc:date>
    <item>
      <title>Using a dynamic variable in the Import command of a Method call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-a-dynamic-variable-in-the-import-command-of-a-method-call/m-p/8592818#M1661720</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 am trying to make a Method call fully dynamic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have found out how to make the Method name dynamic, but I am having trouble figuring out how to make the Importing statement dynamic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in my code below:&lt;/P&gt;&lt;P&gt;      CALL METHOD o_main-&amp;gt;(v_call)&lt;/P&gt;&lt;P&gt;        IMPORTING&lt;/P&gt;&lt;P&gt;          it_ekko = i_ekko.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to know if it's possible to make both "it_ekko" AND "i_ekko" dynamic so I can use this same call for various tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that makes sense...thanks for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Feb 2012 15:28:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-a-dynamic-variable-in-the-import-command-of-a-method-call/m-p/8592818#M1661720</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-23T15:28:58Z</dc:date>
    </item>
    <item>
      <title>Re: Using a dynamic variable in the Import command of a Method call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-a-dynamic-variable-in-the-import-command-of-a-method-call/m-p/8592819#M1661721</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;An idea: Instead of a typed parameter you could use a data reference (type ref to data) and dereference it within the method...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kr,&lt;/P&gt;&lt;P&gt;Manu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Feb 2012 15:34:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-a-dynamic-variable-in-the-import-command-of-a-method-call/m-p/8592819#M1661721</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-23T15:34:07Z</dc:date>
    </item>
    <item>
      <title>Re: Using a dynamic variable in the Import command of a Method call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-a-dynamic-variable-in-the-import-command-of-a-method-call/m-p/8592820#M1661722</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Andrew,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The method call is fully dynamic; not only the parameters can be specified dynamically but also the method name.&lt;/P&gt;&lt;P&gt;This is a help extract:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: line     TYPE c LENGTH 80, 
      text_tab LIKE STANDARD TABLE OF line, 
      filename TYPE string, 
      filetype TYPE c LENGTH 10, 
      fleng    TYPE i. 

DATA: meth  TYPE string, 
      class TYPE string, 
      ptab TYPE abap_parmbind_tab, 
      ptab_line TYPE abap_parmbind, 
      etab TYPE abap_excpbind_tab, 
      etab_line TYPE abap_excpbind. 

DATA: exc_ref TYPE REF TO cx_sy_dyn_call_error, 
      exc_text TYPE string. 

class    = 'CL_GUI_FRONTEND_SERVICES'. 
meth     = 'GUI_DOWNLOAD'. 
filename = 'c:\temp\text.txt'. 
filetype = 'ASC'. 

ptab_line-name = 'FILENAME'. 
ptab_line-kind = cl_abap_objectdescr=&amp;gt;exporting. 
GET REFERENCE OF filename INTO ptab_line-value. 
INSERT ptab_line INTO TABLE ptab. 

ptab_line-name = 'FILETYPE'. 
ptab_line-kind = cl_abap_objectdescr=&amp;gt;exporting. 
GET REFERENCE OF filetype INTO ptab_line-value. 
INSERT ptab_line INTO TABLE ptab. 

ptab_line-name = 'DATA_TAB'. 
ptab_line-kind = cl_abap_objectdescr=&amp;gt;changing. 
GET REFERENCE OF text_tab INTO ptab_line-value. 
INSERT ptab_line INTO TABLE ptab. 

ptab_line-name = 'FILELENGTH'. 
ptab_line-kind = cl_abap_objectdescr=&amp;gt;importing. 
GET REFERENCE OF fleng INTO ptab_line-value. 
INSERT ptab_line INTO TABLE ptab. 

etab_line-name = 'OTHERS'. 
etab_line-value = 4. 
INSERT etab_line INTO TABLE etab. 

TRY. 
    CALL METHOD (class)=&amp;gt;(meth) 
      PARAMETER-TABLE 
        ptab 
      EXCEPTION-TABLE 
        etab. 
    CASE sy-subrc. 
      WHEN 1. 
        ... 
      ... 
    ENDCASE. 
  CATCH cx_sy_dyn_call_error INTO exc_ref. 
    exc_text = exc_ref-&amp;gt;get_text( ). 
    MESSAGE exc_text TYPE 'I'. 
ENDTRY.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Valentin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Feb 2012 16:12:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-a-dynamic-variable-in-the-import-command-of-a-method-call/m-p/8592820#M1661722</guid>
      <dc:creator>valentin_catalin2</dc:creator>
      <dc:date>2012-02-23T16:12:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using a dynamic variable in the Import command of a Method call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-a-dynamic-variable-in-the-import-command-of-a-method-call/m-p/8592821#M1661723</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use the PARAMETER-TABLE. Check out this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

*
CLASS lcl_data DEFINITION.
  PUBLIC SECTION.
    METHODS: do_something IMPORTING iv_1 TYPE i
                          RETURNING value(rv_val) TYPE i.
ENDCLASS.                    "lcl_data DEFINITION
*
START-OF-SELECTION.
  DATA: o_data TYPE REF TO lcl_data.
  DATA: lv_1 TYPE i VALUE 10.
  DATA: lv_out TYPE i.

  CREATE OBJECT o_data.

  DATA: v_method TYPE string.
  DATA: ptab TYPE abap_parmbind_tab.
  DATA: lwa_tab LIKE LINE OF ptab.
  DATA: lo_data TYPE REF TO data.
  DATA: lo_out  TYPE REF TO data.
  lwa_tab-name = 'IV_1'.
  lwa_tab-kind = cl_abap_objectdescr=&amp;gt;exporting.
  GET REFERENCE OF lv_1 INTO lo_data.
  lwa_tab-value = lo_data.
  INSERT lwa_tab INTO TABLE ptab.
*  append lwa_tab in table  ptab.

  lwa_tab-name = 'RV_VAL'.
  lwa_tab-kind = cl_abap_objectdescr=&amp;gt;returning.
  GET REFERENCE OF lv_out INTO lo_out.
  lwa_tab-value = lo_out.
  INSERT lwa_tab INTO TABLE ptab.

  TRY.
      v_method = 'DO_SOMETHING'.
      CALL METHOD o_data-&amp;gt;(v_method)
        PARAMETER-TABLE
          ptab.
    CATCH cx_root.
  ENDTRY.

  WRITE: lv_out.

*
CLASS lcl_data IMPLEMENTATION.
  METHOD do_something.
    rv_val = iv_1 * 12.
  ENDMETHOD.                    "do_something
ENDCLASS.                    "lcl_data IMPLEMENTATION
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Feb 2012 16:27:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-a-dynamic-variable-in-the-import-command-of-a-method-call/m-p/8592821#M1661723</guid>
      <dc:creator>naimesh_patel</dc:creator>
      <dc:date>2012-02-23T16:27:15Z</dc:date>
    </item>
    <item>
      <title>Re: Using a dynamic variable in the Import command of a Method call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-a-dynamic-variable-in-the-import-command-of-a-method-call/m-p/8592822#M1661724</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Naimesh Patel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried your suggestion and I can understand most of it, but I still don't have it working correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am getting an dump with the error message:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; When dynamically calling the method "GET_EKKO" of the class "ZCL_ME007I", the&lt;/P&gt;&lt;P&gt;  parameter "IT_EKKO" was transferred with the incorrect parameter type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you help me with this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Andy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Feb 2012 18:07:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-a-dynamic-variable-in-the-import-command-of-a-method-call/m-p/8592822#M1661724</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-23T18:07:18Z</dc:date>
    </item>
    <item>
      <title>Re: Using a dynamic variable in the Import command of a Method call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-a-dynamic-variable-in-the-import-command-of-a-method-call/m-p/8592823#M1661725</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to use the Importing type as your parameter is importing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* CALL METHOD o_main-&amp;gt;(v_call)
* IMPORTING
* it_ekko = i_ekko.

  lwa_tab-name = 'IT_EKKO'.
  lwa_tab-kind = cl_abap_objectdescr=&amp;gt;importing   "&amp;lt;&amp;lt;.
  get REFERENCE OF i_ekko into lo_Data.
  lwa_tab-value = lo_data.
  INSERT lwa_tab into table ptab.
..
 &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Feb 2012 19:27:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-a-dynamic-variable-in-the-import-command-of-a-method-call/m-p/8592823#M1661725</guid>
      <dc:creator>naimesh_patel</dc:creator>
      <dc:date>2012-02-23T19:27:43Z</dc:date>
    </item>
    <item>
      <title>Re: Using a dynamic variable in the Import command of a Method call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-a-dynamic-variable-in-the-import-command-of-a-method-call/m-p/8592824#M1661726</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ahhh...perfect...that did it.  Thanks!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Feb 2012 11:31:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-a-dynamic-variable-in-the-import-command-of-a-method-call/m-p/8592824#M1661726</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-24T11:31:27Z</dc:date>
    </item>
  </channel>
</rss>

