<?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: FUNCTION_CREATE in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-create/m-p/9178071#M1712757</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;At minimum you need to check for exceptions (sy-subrc). When I can't figure out how an FM should be called, I usually use 'where-used' and see how it's done in other programs.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 14 Jan 2013 22:03:15 GMT</pubDate>
    <dc:creator>Jelena_Perfiljeva</dc:creator>
    <dc:date>2013-01-14T22:03:15Z</dc:date>
    <item>
      <title>FUNCTION_CREATE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-create/m-p/9178070#M1712756</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have to create code dynamically at runtime. So I'm going to use the function 'FUNCTION_CREATE' .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assume the FUNCTION-POOL Z_FYN_FUNC_TEST exists, but the pool is empty - no functions, no types ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My code looks like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: include TYPE RS38L-INCLUDE,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; code&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TYPE STANDARD TABLE OF char255.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;" First time&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'FUNCTION_CREATE'&lt;/P&gt;&lt;P&gt;&amp;nbsp; EXPORTING&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; funcname = 'Z_FUNC1'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; function_pool = 'Z_FYN_FUNC_TEST'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; short_text = 'Lalala'&lt;/P&gt;&lt;P&gt;&amp;nbsp; IMPORTING&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; function_include = include&lt;/P&gt;&lt;P&gt;&amp;nbsp; TABLES&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; " it doesn't matter, since the function does not receive any data or &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; " create any data ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "&lt;/P&gt;&lt;P&gt;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; "&lt;/P&gt;&lt;P&gt;&amp;nbsp; "&amp;nbsp; Create code, so it looks like&lt;/P&gt;&lt;P&gt;&amp;nbsp; " &lt;/P&gt;&lt;P&gt;&amp;nbsp; "&amp;nbsp; FUNCTION Z_FUNC1.&lt;/P&gt;&lt;P&gt;&amp;nbsp; "&amp;nbsp; *"--&lt;/P&gt;&lt;P&gt;&amp;nbsp; "&amp;nbsp; *"--&lt;/P&gt;&lt;P&gt;&amp;nbsp; "&amp;nbsp;&amp;nbsp;&amp;nbsp; any_syntax_error_free_code&lt;/P&gt;&lt;P&gt;&amp;nbsp; "&amp;nbsp; ENDFUNCTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INSERT REPORT include FROM code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;" the call processes successfully&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'Z_FUNC1'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLEAR code[].&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;" Second time&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'FUNCTION_CREATE'&lt;/P&gt;&lt;P&gt;&amp;nbsp; EXPORTING&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; funcname = 'Z_FUNC2'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; function_pool = 'Z_FYN_FUNC_TEST'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; short_text = 'Lalala'&lt;/P&gt;&lt;P&gt;&amp;nbsp; IMPORTING&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; function_include = include&lt;/P&gt;&lt;P&gt;&amp;nbsp; TABLES&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; " it doesn't matter, since the function does not receive any data or &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; " create any data ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "&lt;/P&gt;&lt;P&gt;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; "&lt;/P&gt;&lt;P&gt;&amp;nbsp; "&amp;nbsp; Create code, so it looks like&lt;/P&gt;&lt;P&gt;&amp;nbsp; " &lt;/P&gt;&lt;P&gt;&amp;nbsp; "&amp;nbsp; FUNCTION Z_FUNC2.&lt;/P&gt;&lt;P&gt;&amp;nbsp; "&amp;nbsp; *"--&lt;/P&gt;&lt;P&gt;&amp;nbsp; "&amp;nbsp; *"--&lt;/P&gt;&lt;P&gt;&amp;nbsp; "&amp;nbsp;&amp;nbsp;&amp;nbsp; any_syntax_error_free_code&lt;/P&gt;&lt;P&gt;&amp;nbsp; "&amp;nbsp; ENDFUNCTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INSERT REPORT include FROM code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;" Runtime error like The Function 'Z_FUNC2' could not be found "&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'Z_FUNC2'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any idea ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Kind regards &lt;/P&gt;&lt;P&gt;&amp;nbsp; Ralf&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Jan 2013 10:48:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-create/m-p/9178070#M1712756</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-01-14T10:48:53Z</dc:date>
    </item>
    <item>
      <title>Re: FUNCTION_CREATE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-create/m-p/9178071#M1712757</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;At minimum you need to check for exceptions (sy-subrc). When I can't figure out how an FM should be called, I usually use 'where-used' and see how it's done in other programs.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Jan 2013 22:03:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-create/m-p/9178071#M1712757</guid>
      <dc:creator>Jelena_Perfiljeva</dc:creator>
      <dc:date>2013-01-14T22:03:15Z</dc:date>
    </item>
    <item>
      <title>Re: FUNCTION_CREATE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-create/m-p/9178072#M1712758</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK - I forgot to post in the code above the sy-subrc-check (this code is a reduced fragment). In both cases the function returns sy-subrc = 0, so the code should be inserted in the includes.&lt;/P&gt;&lt;P&gt;The behaviour is always the same. The first dynamically function runs successfully and the next created function-call fails&amp;nbsp; :-(((&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Kind regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Jan 2013 08:57:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-create/m-p/9178072#M1712758</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-01-15T08:57:47Z</dc:date>
    </item>
    <item>
      <title>Re: FUNCTION_CREATE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-create/m-p/9178073#M1712759</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;The first function runs successfully, could you try to insert a WAIT UNTIL 2 SECONDS and then call the second function call. However how the second function returns SY-SUBRC = 0 and does not insert the code. Also include exceptions when you call the function 'FUNCTION_CREATE'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if any info is required.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Tooshar Bendale&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Jan 2013 09:41:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-create/m-p/9178073#M1712759</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-01-15T09:41:50Z</dc:date>
    </item>
    <item>
      <title>Re: FUNCTION_CREATE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-create/m-p/9178074#M1712760</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;this works fine - thank you !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Kind regards &lt;/P&gt;&lt;P&gt;&amp;nbsp; Ralf&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2013 07:58:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-create/m-p/9178074#M1712760</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-01-23T07:58:25Z</dc:date>
    </item>
  </channel>
</rss>

