<?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: Dynamic call of function modules in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-call-of-function-modules/m-p/5351617#M1232229</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But how do you write the code that actually calls the FM? Especially how do I code the parameter list?&lt;/P&gt;&lt;P&gt;Sometime the FM will have 3 import parameters while other times it might have 15 or 20.  How do I code that?  Is there a way to say, "here is an internal table containing my Import parameters and another that contains my export parameters"?  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was hoping for maybe something like:&lt;/P&gt;&lt;P&gt;  CALL FUNCTION fmvariablename&lt;/P&gt;&lt;P&gt;       EXPORTING PARAMETER TABLE t_exptable&lt;/P&gt;&lt;P&gt;       IMPORTING PARAMETER TABLE t_imptable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where t_exptable would have a structure something like this:&lt;/P&gt;&lt;P&gt;            exptable&lt;/P&gt;&lt;P&gt;            ....parametername&lt;/P&gt;&lt;P&gt;            ....parametervalue variable or &amp;lt;field symbol&amp;gt; name &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or maybe I could build the function call simular to the way a dynamic SQL statement is built.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am thinking that this is not really possible, but I thought I would ask. If you know that this is not possible please tell me that too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had another thought.  If this cannot be done with a FM, how about a method call?  I don't know too much about OO ABAP,  but am wanting to learn.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Larry Browning on Mar 18, 2009 10:37 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 18 Mar 2009 15:34:26 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-03-18T15:34:26Z</dc:date>
    <item>
      <title>Dynamic call of function modules</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-call-of-function-modules/m-p/5351615#M1232227</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have an idea about using a DB table to define the calling of a function module.  Now I know that you can call a FM named in a variable, but what about the Import/Export parameters? &lt;/P&gt;&lt;P&gt;Let's say that FM1 has the following parameters.&lt;/P&gt;&lt;P&gt;  Import&lt;/P&gt;&lt;P&gt;      i_par1&lt;/P&gt;&lt;P&gt;      i_par2&lt;/P&gt;&lt;P&gt;  export&lt;/P&gt;&lt;P&gt;      e_par1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FM2 has&lt;/P&gt;&lt;P&gt;    Import&lt;/P&gt;&lt;P&gt;      i_par1&lt;/P&gt;&lt;P&gt;    Export&lt;/P&gt;&lt;P&gt;      e_par1&lt;/P&gt;&lt;P&gt;      e_par2&lt;/P&gt;&lt;P&gt;      e_par3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to dynamicly call these 2 FMs with the same code?  I realize that the parameters would have to be defined properly (data type) for it to work, but what about the number of import and export parameters?  Or do I have to make a rule that any FM module that is defined in this DB table has to have the same parameter interface?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Mar 2009 14:56:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-call-of-function-modules/m-p/5351615#M1232227</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-18T14:56:41Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic call of function modules</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-call-of-function-modules/m-p/5351616#M1232228</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Define your import parameters as OPTIONAL( You can find checkbox in the import tab of se37)  so if you are passing or NOT passing will not be a issue&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a®&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Mar 2009 15:04:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-call-of-function-modules/m-p/5351616#M1232228</guid>
      <dc:creator>former_member194669</dc:creator>
      <dc:date>2009-03-18T15:04:47Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic call of function modules</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-call-of-function-modules/m-p/5351617#M1232229</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But how do you write the code that actually calls the FM? Especially how do I code the parameter list?&lt;/P&gt;&lt;P&gt;Sometime the FM will have 3 import parameters while other times it might have 15 or 20.  How do I code that?  Is there a way to say, "here is an internal table containing my Import parameters and another that contains my export parameters"?  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was hoping for maybe something like:&lt;/P&gt;&lt;P&gt;  CALL FUNCTION fmvariablename&lt;/P&gt;&lt;P&gt;       EXPORTING PARAMETER TABLE t_exptable&lt;/P&gt;&lt;P&gt;       IMPORTING PARAMETER TABLE t_imptable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where t_exptable would have a structure something like this:&lt;/P&gt;&lt;P&gt;            exptable&lt;/P&gt;&lt;P&gt;            ....parametername&lt;/P&gt;&lt;P&gt;            ....parametervalue variable or &amp;lt;field symbol&amp;gt; name &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or maybe I could build the function call simular to the way a dynamic SQL statement is built.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am thinking that this is not really possible, but I thought I would ask. If you know that this is not possible please tell me that too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had another thought.  If this cannot be done with a FM, how about a method call?  I don't know too much about OO ABAP,  but am wanting to learn.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Larry Browning on Mar 18, 2009 10:37 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Mar 2009 15:34:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-call-of-function-modules/m-p/5351617#M1232229</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-18T15:34:26Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic call of function modules</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-call-of-function-modules/m-p/5351618#M1232230</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Larry&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can't you use an IF ELSE ENDIF if it's just about two FMs?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pushpraj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Mar 2009 15:42:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-call-of-function-modules/m-p/5351618#M1232230</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-18T15:42:07Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic call of function modules</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-call-of-function-modules/m-p/5351619#M1232231</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No, I was hoping for something where I could call just about any FM specified in the DB table.  It would have to be designed so that the parameters would also be specified in the table as well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Mar 2009 15:46:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-call-of-function-modules/m-p/5351619#M1232231</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-18T15:46:36Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic call of function modules</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-call-of-function-modules/m-p/5351620#M1232232</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think your issue with export table that comes out of function module. For handling this you need to use the logic of creating dynamic table or fill it in a flat structure ( please check fm RFC_READ_TABLE )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; a®&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Mar 2009 15:47:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-call-of-function-modules/m-p/5351620#M1232232</guid>
      <dc:creator>former_member194669</dc:creator>
      <dc:date>2009-03-18T15:47:29Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic call of function modules</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-call-of-function-modules/m-p/5351621#M1232233</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hmm,  I looked at that FM and am not sure how that would help.   Apparently my brain hasn't formed a connection with this and my question.  Can you expand on this please?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Mar 2009 16:04:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-call-of-function-modules/m-p/5351621#M1232233</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-18T16:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic call of function modules</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-call-of-function-modules/m-p/5351622#M1232234</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Larry&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't think OOPS might come to rescue here.&lt;/P&gt;&lt;P&gt;I remember there is a table which holds the export import parametrers of the fms (at least there oughtr to be).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but the thing is there aer only sso many things to take care here, like matching the data type.&lt;/P&gt;&lt;P&gt;maybe you could do some thing with the CASE statemwent.&lt;/P&gt;&lt;P&gt;but that'd entail a pretty good number of combinations.&lt;/P&gt;&lt;P&gt;seems bleak to me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pushpraj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Mar 2009 16:15:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-call-of-function-modules/m-p/5351622#M1232234</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-18T16:15:54Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic call of function modules</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-call-of-function-modules/m-p/5351623#M1232235</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Say for example in your exporting table in SE37 table tab&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA	LIKE	YTAB1500	Data read (out)   " Flat structure with a length of 1500 characters
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  data: dref type ref to data.           
  field-symbols: &amp;lt;wa&amp;gt; type any, &amp;lt;comp&amp;gt; type any.
  create data dref type (query_table).   " Import parameter for example table name to query
  assign dref-&amp;gt;* to &amp;lt;wa&amp;gt;.                "
    select * from (query_table) into &amp;lt;wa&amp;gt; where (options).
     write : &amp;lt;wa&amp;gt; to wa_data.
     append wa_dta to data.
    endselect.
  endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a®s&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;May this will help you out&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Mar 2009 16:18:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-call-of-function-modules/m-p/5351623#M1232235</guid>
      <dc:creator>former_member194669</dc:creator>
      <dc:date>2009-03-18T16:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic call of function modules</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-call-of-function-modules/m-p/5351624#M1232236</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes it is possible pass the parameters in dynamic way. Check the online help on the CALL FUNCTION statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this example:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* copied from the online help on the CALL FUNCTION

TYPE-POOLS abap. 

DATA: line(80) TYPE c, 
      text_tab LIKE STANDARD TABLE OF line, 
      filename TYPE string, 
      filetype(10) TYPE c, 
      fleng TYPE i. 

DATA: func TYPE string, 
      ptab TYPE abap_func_parmbind_tab, 
      ptab_line TYPE abap_func_parmbind, 
      etab TYPE abap_func_excpbind_tab, 
      etab_line TYPE abap_func_excpbind. 

func = 'GUI_DOWNLOAD'. 
filename = 'c:\temp\text.txt'. 
filetype = 'ASC'. 

ptab_line-name = 'FILENAME'. 
ptab_line-kind = abap_func_exporting. 
GET REFERENCE OF filename INTO ptab_line-value. 
INSERT ptab_line INTO TABLE ptab. 

ptab_line-name = 'FILETYPE'. 
ptab_line-kind = abap_func_exporting. 
GET REFERENCE OF filetype INTO ptab_line-value. 
INSERT ptab_line INTO TABLE ptab. 

ptab_line-name = 'DATA_TAB'. 
ptab_line-kind = abap_func_tables. 
GET REFERENCE OF text_tab INTO ptab_line-value. 
INSERT ptab_line INTO TABLE ptab. 

ptab_line-name = 'FILELENGTH'. 
ptab_line-kind = abap_func_importing. 
GET REFERENCE OF fleng INTO ptab_line-value. 
INSERT ptab_line INTO TABLE ptab. 

... 

etab_line-name = 'OTHERS'. 
etab_line-value = 10. 
INSERT etab_line INTO TABLE etab. 

CALL FUNCTION func 
  PARAMETER-TABLE 
    ptab 
  EXCEPTION-TABLE 
    etab. 

CASE sy-subrc. 
  WHEN 1. 
    ... 
  ... 
ENDCASE.  
&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>Wed, 18 Mar 2009 16:32:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-call-of-function-modules/m-p/5351624#M1232236</guid>
      <dc:creator>naimesh_patel</dc:creator>
      <dc:date>2009-03-18T16:32:42Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic call of function modules</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-call-of-function-modules/m-p/5351625#M1232237</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;a®s,&lt;/P&gt;&lt;P&gt;I am aware of dynamic internal tables and in fact I am using them in a different area of the very same program I am wanting to do a dynamic call to FM with.  However, I have not yet seen the connection to how this could be used to answer my question.  As best as I can tell I would need to be able to somehow specify dynamically the parameter lists (parameter name and the value passed of that parameter) .  I don't know how to do this or even if it can be done at all.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I really do appreciate your help with my question, but I am just not getting the connection to what you are suggesting and my question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Mar 2009 16:45:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-call-of-function-modules/m-p/5351625#M1232237</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-18T16:45:24Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic call of function modules</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-call-of-function-modules/m-p/5351626#M1232238</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Naimesh,&lt;/P&gt;&lt;P&gt;That looks like exactly what I am wanting to do!  I can't believe I didn't simply look at the help on CALL FUNCTION.  I did look at my ABAP quick reference card that is pretty old (version 4.5) and it did not have the PARAMETER-TABLE addition in it.  We are now at 6.20 and upgrading to 7.0 this summer, so maybe I should throw that card away!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry, My bad.  I will award you points!!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Mar 2009 17:00:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-call-of-function-modules/m-p/5351626#M1232238</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-18T17:00:56Z</dc:date>
    </item>
  </channel>
</rss>

