<?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 program generation problem in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-program-generation-problem/m-p/1601657#M270122</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;From SAP help:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notes &lt;/P&gt;&lt;P&gt;1- Temporary subroutine pools belong to the runtime context of the generating program, i.e. to the roll area of the internal mode from which the generation is performed. They may therefore be addressed only within this context, i.e. the generated FORM routines can only be called from within the generating mode. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2- Up to 36 temporary subroutine pools can currently be managed for each roll area.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So it means you can generate max 36 subroutine, but your code generate a subroutine for every record of GT_OUTTAB, so if this table has more 36 records, the program try'll to generate more than 36 subroutine, but a dump'll occurs at 37th record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So if you want to prevent this you should generate the subroutine once and moreover you'll improve the performance because generate subroutine only once.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can prevent an eventual dump using CATCH/ENDCATCH&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT GT_OUTTAB.&lt;/P&gt;&lt;P&gt;CATCH SYSTEM-EXCEPTIONS GENERATE_SUBPOOL_DIR_FULL = 1.&lt;/P&gt;&lt;P&gt;PERFORM WRITE_DYN_CONTENT IN PROGRAM (L_PROG_NAME)  USING GT_OUTTAB.&lt;/P&gt;&lt;P&gt;ENDCATCH.&lt;/P&gt;&lt;P&gt;IF SY-SUBRC &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Other subroutines can't be called&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;EXIT.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 18 Oct 2006 09:33:08 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-10-18T09:33:08Z</dc:date>
    <item>
      <title>Dynamic program generation problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-program-generation-problem/m-p/1601652#M270117</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does subroutine in dynamically generated program can't be be invoked with parameter?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If perform dyn subroutine without any parameters, it's run well, anybody can tell me why?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT z_test.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF tp_sflight,&lt;/P&gt;&lt;P&gt;        carrid TYPE sflight-carrid,&lt;/P&gt;&lt;P&gt;        connid TYPE sflight-connid,&lt;/P&gt;&lt;P&gt;        fldate TYPE sflight-fldate,&lt;/P&gt;&lt;P&gt;        price TYPE sflight-price,&lt;/P&gt;&lt;P&gt;END OF tp_sflight.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF fld_list OCCURS 0,&lt;/P&gt;&lt;P&gt;  fld_name(20),&lt;/P&gt;&lt;P&gt;END OF fld_list.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: gt_outtab TYPE TABLE OF tp_sflight WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;DATA: source_line(72).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;P&gt;  gi_source LIKE STANDARD TABLE OF source_line,&lt;/P&gt;&lt;P&gt;  l_prog_name(30)  TYPE c,&lt;/P&gt;&lt;P&gt;  l_msg(120)       TYPE c,&lt;/P&gt;&lt;P&gt;  l_line(10)       TYPE c,&lt;/P&gt;&lt;P&gt;  l_word(10)       TYPE c,&lt;/P&gt;&lt;P&gt;  l_off(3)         TYPE c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT * FROM sflight&lt;/P&gt;&lt;P&gt;    INTO CORRESPONDING FIELDS OF TABLE gt_outtab&lt;/P&gt;&lt;P&gt;    UP TO 10 ROWS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  fld_list-fld_name = 'connid'.&lt;/P&gt;&lt;P&gt;  APPEND fld_list.&lt;/P&gt;&lt;P&gt;  fld_list-fld_name = 'price'.&lt;/P&gt;&lt;P&gt;  APPEND fld_list.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  APPEND 'PROGRAM MY_SUBPOOL.' TO gi_source.&lt;/P&gt;&lt;P&gt;  APPEND 'FORM WRITE_DYN_CONTENT USING wa TYPE sflight.' TO gi_source.&lt;/P&gt;&lt;P&gt;  LOOP AT fld_list.&lt;/P&gt;&lt;P&gt;    CLEAR source_line.&lt;/P&gt;&lt;P&gt;    CONCATENATE 'WRITE wa-' fld_list-fld_name '.' INTO source_line.&lt;/P&gt;&lt;P&gt;    APPEND source_line  TO gi_source.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;  APPEND 'ENDFORM.'  TO gi_source.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  GENERATE SUBROUTINE POOL gi_source&lt;/P&gt;&lt;P&gt;    NAME l_prog_name MESSAGE l_msg LINE l_line&lt;/P&gt;&lt;P&gt;    WORD l_word OFFSET l_off.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    WRITE : / 'Error', l_msg.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  WRITE l_prog_name.&lt;/P&gt;&lt;P&gt;  LOOP AT gt_outtab.&lt;/P&gt;&lt;P&gt;    PERFORM write_dyn_content &amp;lt;b&amp;gt;USING gt_outtab &amp;lt;/b&amp;gt; IN PROGRAM (l_prog_name).&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Tim&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: jingen tang&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Oct 2006 07:39:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-program-generation-problem/m-p/1601652#M270117</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-18T07:39:23Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic program generation problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-program-generation-problem/m-p/1601653#M270118</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 can work fine, but you have to define the parameter using the same type:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See these pieces of your code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: gt_outtab TYPE TABLE OF tp_sflight WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND 'FORM WRITE_DYN_CONTENT USING wa TYPE sflight.' TO gi_source.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So gt_outtab and wa are of different types:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try to use this declaration:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: gt_outtab TYPE TABLE OF sflight WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and your subroutine'll work fine&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Oct 2006 07:58:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-program-generation-problem/m-p/1601653#M270118</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-18T07:58:32Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic program generation problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-program-generation-problem/m-p/1601654#M270119</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Max,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have changed the code as you said, but it still can't work. when I check the program it reports that:&lt;/P&gt;&lt;P&gt;Field "IN" is unknown. It is neighter in one of the specified tables nor defined by a "DATA" statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Oct 2006 08:07:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-program-generation-problem/m-p/1601654#M270119</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-18T08:07:15Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic program generation problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-program-generation-problem/m-p/1601655#M270120</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;Make this change:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT gt_outtab.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;*PERFORM write_dyn_content USING gt_outtab IN PROGRAM &lt;/P&gt;&lt;P&gt;*(l_prog_name).&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;PERFORM write_dyn_content IN PROGRAM (l_prog_name) USING gt_outtab.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway you can create max 36 temporary subroutine pools, then a dump'll occurs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So you should check to have max 36 records in table gt_outtab, or you transfer it once:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;PERFORM write_dyn_content IN PROGRAM (l_prog_name) TABLES gt_outtab.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Oct 2006 08:09:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-program-generation-problem/m-p/1601655#M270120</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-18T08:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic program generation problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-program-generation-problem/m-p/1601656#M270121</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Max,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's run well now, thks for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;You said:&amp;lt;/b&amp;gt; &lt;/P&gt;&lt;P&gt;Anyway you can create max 36 temporary subroutine pools, then a dump'll occurs.&lt;/P&gt;&lt;P&gt;So you should check to have max 36 records in table gt_outtab, or you transfer it once&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Do you mean:&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;in a program if itab contains more than 36 records, we should transfer data once, otherwise it will affect the program performance?&lt;/P&gt;&lt;P&gt;Since I select more than 36 records and transfer them one by one, and not find any questions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tim&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: jingen tang&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Oct 2006 09:03:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-program-generation-problem/m-p/1601656#M270121</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-18T09:03:18Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic program generation problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-program-generation-problem/m-p/1601657#M270122</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;From SAP help:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notes &lt;/P&gt;&lt;P&gt;1- Temporary subroutine pools belong to the runtime context of the generating program, i.e. to the roll area of the internal mode from which the generation is performed. They may therefore be addressed only within this context, i.e. the generated FORM routines can only be called from within the generating mode. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2- Up to 36 temporary subroutine pools can currently be managed for each roll area.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So it means you can generate max 36 subroutine, but your code generate a subroutine for every record of GT_OUTTAB, so if this table has more 36 records, the program try'll to generate more than 36 subroutine, but a dump'll occurs at 37th record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So if you want to prevent this you should generate the subroutine once and moreover you'll improve the performance because generate subroutine only once.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can prevent an eventual dump using CATCH/ENDCATCH&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT GT_OUTTAB.&lt;/P&gt;&lt;P&gt;CATCH SYSTEM-EXCEPTIONS GENERATE_SUBPOOL_DIR_FULL = 1.&lt;/P&gt;&lt;P&gt;PERFORM WRITE_DYN_CONTENT IN PROGRAM (L_PROG_NAME)  USING GT_OUTTAB.&lt;/P&gt;&lt;P&gt;ENDCATCH.&lt;/P&gt;&lt;P&gt;IF SY-SUBRC &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Other subroutines can't be called&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;EXIT.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Oct 2006 09:33:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-program-generation-problem/m-p/1601657#M270122</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-18T09:33:08Z</dc:date>
    </item>
  </channel>
</rss>

