<?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 in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic/m-p/3342938#M801469</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi sivaranjhani,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is an example of how to call a function dynamically (note: comments were added to an existing example from the standard help)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT ZDANY_DYN_FM_CALL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*The constants and structures required to use the dynamic function call&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*is stored in the type pool ABAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;type-pools abap.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*This is the name of the function you want to call.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data NAME type STRING value `READ_SPFLI_INTO_TABLE`.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Parameter table, where you store all parameters, importing, exporting &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;and changing data PARA_TAB type ABAP_FUNC_PARMBIND_TAB. data PARA_LINE like line of PARA_TAB.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Exception table to handle the exception that can occur during the&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;execution of the function&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data EXCP_TAB type ABAP_FUNC_EXCPBIND_TAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data EXCP_LINE like line of EXCP_TAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data CARRIER type SPFLI-CARRID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data JTAB type SPFLI_TAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CARRIER = 'XYZ'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Name of the first parameter&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARA_LINE-NAME = 'ID'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;type of the first parameter, could be :&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;abap_func_exporting value 10,&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;abap_func_importing value 20,&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;abap_func_tables value 30,&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;abap_func_changing value 40.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARA_LINE-KIND = ABAP_FUNC_EXPORTING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*We need the datatype of the parameter to pass&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;get reference of CARRIER into PARA_LINE-VALUE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append PARA_LINE to PARA_TAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Same thing for parameter 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARA_LINE-NAME = 'ITAB'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARA_LINE-KIND = ABAP_FUNC_IMPORTING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;get reference of JTAB into PARA_LINE-VALUE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append PARA_LINE to PARA_TAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Now we create the possible exceptions&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXCP_LINE-NAME = 'NOT_FOUND'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXCP_LINE-VALUE = 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;insert EXCP_LINE into table EXCP_TAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXCP_LINE-NAME = 'OTHERS'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXCP_LINE-VALUE = 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;insert EXCP_LINE into table EXCP_TAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*... and we dynamically call the function with the parameter-table and&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;exception-table addition&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function NAME   parameter-table      PARA_TAB   exception-table      EXCP_TAB.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;We check the result codecase 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;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward ponits if helpful..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Goutham.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Jan 2008 07:57:12 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-01-29T07:57:12Z</dc:date>
    <item>
      <title>dynamic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic/m-p/3342937#M801468</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;how can i call dynamically function module and subroutine&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2008 07:53:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic/m-p/3342937#M801468</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-29T07:53:22Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic/m-p/3342938#M801469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi sivaranjhani,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is an example of how to call a function dynamically (note: comments were added to an existing example from the standard help)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT ZDANY_DYN_FM_CALL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*The constants and structures required to use the dynamic function call&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*is stored in the type pool ABAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;type-pools abap.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*This is the name of the function you want to call.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data NAME type STRING value `READ_SPFLI_INTO_TABLE`.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Parameter table, where you store all parameters, importing, exporting &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;and changing data PARA_TAB type ABAP_FUNC_PARMBIND_TAB. data PARA_LINE like line of PARA_TAB.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Exception table to handle the exception that can occur during the&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;execution of the function&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data EXCP_TAB type ABAP_FUNC_EXCPBIND_TAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data EXCP_LINE like line of EXCP_TAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data CARRIER type SPFLI-CARRID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data JTAB type SPFLI_TAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CARRIER = 'XYZ'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Name of the first parameter&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARA_LINE-NAME = 'ID'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;type of the first parameter, could be :&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;abap_func_exporting value 10,&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;abap_func_importing value 20,&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;abap_func_tables value 30,&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;abap_func_changing value 40.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARA_LINE-KIND = ABAP_FUNC_EXPORTING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*We need the datatype of the parameter to pass&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;get reference of CARRIER into PARA_LINE-VALUE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append PARA_LINE to PARA_TAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Same thing for parameter 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARA_LINE-NAME = 'ITAB'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARA_LINE-KIND = ABAP_FUNC_IMPORTING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;get reference of JTAB into PARA_LINE-VALUE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append PARA_LINE to PARA_TAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Now we create the possible exceptions&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXCP_LINE-NAME = 'NOT_FOUND'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXCP_LINE-VALUE = 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;insert EXCP_LINE into table EXCP_TAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXCP_LINE-NAME = 'OTHERS'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXCP_LINE-VALUE = 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;insert EXCP_LINE into table EXCP_TAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*... and we dynamically call the function with the parameter-table and&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;exception-table addition&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function NAME   parameter-table      PARA_TAB   exception-table      EXCP_TAB.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;We check the result codecase 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;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward ponits if helpful..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Goutham.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2008 07:57:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic/m-p/3342938#M801469</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-29T07:57:12Z</dc:date>
    </item>
  </channel>
</rss>

