<?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: Execute function module from Custom Table Value? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/execute-function-module-from-custom-table-value/m-p/2105079#M439158</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you can put the name of the FM in a variable and the parameters and exceptions in separate internal tables, then you can call the function modules using the statement:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;lt;b&amp;gt;call function NAME 
  parameter-table 
    PARA_TAB 
  exception-table 
    EXCP_TAB.&amp;lt;/b&amp;gt;

See a small example:
Example
type pools ABAP. 

data NAME type STRING value `READ_SPFLI_INTO_TABLE`. 

data PARA_TAB type ABAP_FUNC_PARMBIND_TAB. 
data PARA_LINE like line of PARA_TAB. 

data EXCP_TAB type ABAP_FUNC_EXCPBIND_TAB. 
data EXCP_LINE like line of EXCP_TAB. 

data CARRIER type SPFLI-CARRID. 
data JTAB type SPFLI_TAB. 

CARRIER = 'XYZ'. 
PARA_LINE-NAME = 'ID'. 
PARA_LINE-KIND = ABAP_FUNC_EXPORTING. 
get reference of CARRIER into PARA_LINE-VALUE. 
append PARA_LINE to PARA_TAB. 

PARA_LINE-NAME = 'ITAB'. 
PARA_LINE-KIND = ABAP_FUNC_IMPORTING. 
get reference of JTAB into PARA_LINE-VALUE. 
append PARA_LINE to PARA_TAB. 

EXCP_LINE-NAME = 'NOT_FOUND'. 
EXCP_LINE-VALUE = 1. 
insert EXCP_LINE into table EXCP_TAB. 

EXCP_LINE-NAME = 'OTHERS'. 
EXCP_LINE-VALUE = 4. 
insert EXCP_LINE into table EXCP_TAB. 

call function NAME 
  parameter-table 
    PARA_TAB 
  exception-table 
    EXCP_TAB. 

case SY-SUBRC. 
  when 1. 
    message id SY-MSGID type SY-MSGTY number SY-MSGNO. 
  when 2. 
    message E888(SABAPDOCU) with 'Error in  function module'. 
endcase.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REgards,&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Apr 2007 15:05:34 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-04-05T15:05:34Z</dc:date>
    <item>
      <title>Execute function module from Custom Table Value?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/execute-function-module-from-custom-table-value/m-p/2105076#M439155</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 custom table with following field&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
FUNNAME        CHAR    1000
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That contains records like the following &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
CALL FUNCTION 'ZMATF' EXPORTING MATNR = P_MATNR IMPORTING MATDESCRIPTION = V_MATERIALDESC.
CALL FUNCTION 'Y_CHECK_EXIT' EXPORTING USEREXIT = 'EFNDTAXWAR' IMPORTING EXECUTE  =  EXECUTE TABLES I_ZA01   =  I_ZA01.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' EXPORTING WAIT = 'X'.
CALL FUNCTION 'RS_TABLE_LIST_CREATE' EXPORTING TABLE_NAME = TABNAME.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;My requirement is according some of the user conditions i need to select entry from this table and execute the corresponding function module&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried to use GENERATE SUBROUTINE POOL itab NAME name. But this have limitation of 36 subroutine pools for one program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any info highly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;aRs&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Apr 2007 14:28:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/execute-function-module-from-custom-table-value/m-p/2105076#M439155</guid>
      <dc:creator>former_member194669</dc:creator>
      <dc:date>2007-04-05T14:28:03Z</dc:date>
    </item>
    <item>
      <title>Re: Execute function module from Custom Table Value?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/execute-function-module-from-custom-table-value/m-p/2105077#M439156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi..&lt;/P&gt;&lt;P&gt; you can do like this..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;get all the FM Names from Dbase and place in Itab where ur &lt;/P&gt;&lt;P&gt;  itab is having FM name and Position.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now read the FM name u want...and find position from ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ur ITAB is &lt;/P&gt;&lt;P&gt; FM_NAME  POSITION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now using following stmt...u can assign number to the subroutine. write all the FMs in different subroutines...go through this...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;perform n OF subr1 subr2 ...&amp;lt;/b&amp;gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;n OF subr1 subr2 ... &lt;/P&gt;&lt;P&gt;This statement selects a subroutine subr in the same program from a list. The list subr1 subr2 ... can contain up to 256 subroutines specified directly. For n, you must specify a numeric data object that contains a number between 1 and the number of subroutines specified when executed. The system calls the subroutine subr, for which the list item i is contained in n. You cannot specify parameter_list for this variant and you can only call subroutines without a parameter interface.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Apr 2007 14:48:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/execute-function-module-from-custom-table-value/m-p/2105077#M439156</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-05T14:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: Execute function module from Custom Table Value?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/execute-function-module-from-custom-table-value/m-p/2105078#M439157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I  could not able understand what your are suggesting. Can please explain little bit more on this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;aRs&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Apr 2007 14:58:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/execute-function-module-from-custom-table-value/m-p/2105078#M439157</guid>
      <dc:creator>former_member194669</dc:creator>
      <dc:date>2007-04-05T14:58:57Z</dc:date>
    </item>
    <item>
      <title>Re: Execute function module from Custom Table Value?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/execute-function-module-from-custom-table-value/m-p/2105079#M439158</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you can put the name of the FM in a variable and the parameters and exceptions in separate internal tables, then you can call the function modules using the statement:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;lt;b&amp;gt;call function NAME 
  parameter-table 
    PARA_TAB 
  exception-table 
    EXCP_TAB.&amp;lt;/b&amp;gt;

See a small example:
Example
type pools ABAP. 

data NAME type STRING value `READ_SPFLI_INTO_TABLE`. 

data PARA_TAB type ABAP_FUNC_PARMBIND_TAB. 
data PARA_LINE like line of PARA_TAB. 

data EXCP_TAB type ABAP_FUNC_EXCPBIND_TAB. 
data EXCP_LINE like line of EXCP_TAB. 

data CARRIER type SPFLI-CARRID. 
data JTAB type SPFLI_TAB. 

CARRIER = 'XYZ'. 
PARA_LINE-NAME = 'ID'. 
PARA_LINE-KIND = ABAP_FUNC_EXPORTING. 
get reference of CARRIER into PARA_LINE-VALUE. 
append PARA_LINE to PARA_TAB. 

PARA_LINE-NAME = 'ITAB'. 
PARA_LINE-KIND = ABAP_FUNC_IMPORTING. 
get reference of JTAB into PARA_LINE-VALUE. 
append PARA_LINE to PARA_TAB. 

EXCP_LINE-NAME = 'NOT_FOUND'. 
EXCP_LINE-VALUE = 1. 
insert EXCP_LINE into table EXCP_TAB. 

EXCP_LINE-NAME = 'OTHERS'. 
EXCP_LINE-VALUE = 4. 
insert EXCP_LINE into table EXCP_TAB. 

call function NAME 
  parameter-table 
    PARA_TAB 
  exception-table 
    EXCP_TAB. 

case SY-SUBRC. 
  when 1. 
    message id SY-MSGID type SY-MSGTY number SY-MSGNO. 
  when 2. 
    message E888(SABAPDOCU) with 'Error in  function module'. 
endcase.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REgards,&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Apr 2007 15:05:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/execute-function-module-from-custom-table-value/m-p/2105079#M439158</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-05T15:05:34Z</dc:date>
    </item>
  </channel>
</rss>

