<?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: Performance issue: CALL FUNCTION inside a Loop. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-call-function-inside-a-loop/m-p/3188814#M759583</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;You can read datas from database table(mdkp,mdtb). don't use FM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;L.Velu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 31 Dec 2007 07:16:01 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-12-31T07:16:01Z</dc:date>
    <item>
      <title>Performance issue: CALL FUNCTION inside a Loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-call-function-inside-a-loop/m-p/3188804#M759573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Friends&lt;/P&gt;&lt;P&gt;I have a Performance Issue. That is, inside a loop...endloop a CALL FUNCTION has been used which gets data from another database table. Finally it's appended into another internal table. Please see this :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT i_mdkp.&lt;/P&gt;&lt;P&gt;    REFRESH lt_mdtbx.&lt;/P&gt;&lt;P&gt;    CLEAR lt_mdtbx.&lt;/P&gt;&lt;P&gt;    CALL FUNCTION 'READ_MRP_LIST'&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        idtnum        = i_mdkp-dtnum&lt;/P&gt;&lt;P&gt;        icflag        = 'X'&lt;/P&gt;&lt;P&gt;      tables&lt;/P&gt;&lt;P&gt;        mdtbx         = lt_mdtbx&lt;/P&gt;&lt;P&gt;              .&lt;/P&gt;&lt;P&gt;    APPEND LINES OF lt_mdtbx TO i_mdtb.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;It happens for each record available in i_mdkp. Suppose, i_mdkp have around 50000 records, it needs to call the function module till that much time.&lt;/P&gt;&lt;P&gt;So, I want to split it. Can I?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please give me your valueable suggestions.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Senthil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Dec 2007 09:00:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-call-function-inside-a-loop/m-p/3188804#M759573</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-28T09:00:37Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue: CALL FUNCTION inside a Loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-call-function-inside-a-loop/m-p/3188805#M759574</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;store the fm value results into the internal table and use that internal table instead of calling FM &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Simply write the FM out side the loop store the result in one internal table and then &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at that put read condition for that FM internal table &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it will work fastly&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Dec 2007 09:04:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-call-function-inside-a-loop/m-p/3188805#M759574</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-28T09:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue: CALL FUNCTION inside a Loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-call-function-inside-a-loop/m-p/3188806#M759575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; store the fm value results into the internal table and use that internal table instead of calling FM &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;that is exactly what this coding is doing!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is no general answer, if the details of the function call are not known.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try to change the function call so that it can work with the whole table i_mdkp and not only with one line!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Dec 2007 09:10:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-call-function-inside-a-loop/m-p/3188806#M759575</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-28T09:10:14Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue: CALL FUNCTION inside a Loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-call-function-inside-a-loop/m-p/3188807#M759576</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Siegfried&lt;/P&gt;&lt;P&gt;Thank you very much for your reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, I couldn't get your answer. &lt;/P&gt;&lt;P&gt;Could you please explain me?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Senthil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Dec 2007 09:59:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-call-function-inside-a-loop/m-p/3188807#M759576</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-28T09:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue: CALL FUNCTION inside a Loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-call-function-inside-a-loop/m-p/3188808#M759577</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Senthil Vadivel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;He said to you change the usage, the calling of the FM.&lt;/P&gt;&lt;P&gt;With the currently usage, the FM return only one line. You need to get all values  with only one call to get best performance. Try to do this, and post the results here.&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;Try something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'READ_MRP_LIST'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;idtnum = i_mdkp-dtnum&lt;/P&gt;&lt;P&gt;icflag = 'X'&lt;/P&gt;&lt;P&gt;tables&lt;/P&gt;&lt;P&gt;mdtbx = lt_mdtbx&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT i_mdkp.&lt;/P&gt;&lt;P&gt;REFRESH lt_mdtbx.&lt;/P&gt;&lt;P&gt;CLEAR lt_mdtbx.&lt;/P&gt;&lt;P&gt;APPEND LINES OF lt_mdtbx TO i_mdtb.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;I&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Rodrigo Paisante on Dec 28, 2007 8:29 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Dec 2007 10:27:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-call-function-inside-a-loop/m-p/3188808#M759577</guid>
      <dc:creator>rodrigo_paisante3</dc:creator>
      <dc:date>2007-12-28T10:27:29Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue: CALL FUNCTION inside a Loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-call-function-inside-a-loop/m-p/3188809#M759578</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Rodrigo&lt;/P&gt;&lt;P&gt;The FM "'READ_MRP_LIST'" accepts the "dtnum" values one by one.&lt;/P&gt;&lt;P&gt;So, if I place the FM before the loop, it doesn't fetch any record and gives the runtime error.&lt;/P&gt;&lt;P&gt;could you please suggest me an alternative?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Senthil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Dec 2007 10:55:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-call-function-inside-a-loop/m-p/3188809#M759578</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-28T10:55:43Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue: CALL FUNCTION inside a Loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-call-function-inside-a-loop/m-p/3188810#M759579</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry friend but i haven't any sugestion. I dont know if exist other FM that you can use, to read all values. &lt;/P&gt;&lt;P&gt;Reading record by record, yes, you need to call the FM 50000 times. Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rodrigo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Dec 2007 11:25:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-call-function-inside-a-loop/m-p/3188810#M759579</guid>
      <dc:creator>rodrigo_paisante3</dc:creator>
      <dc:date>2007-12-28T11:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue: CALL FUNCTION inside a Loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-call-function-inside-a-loop/m-p/3188811#M759580</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if you can not change the function READ_MRP_LIST then you can not any better.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you can change the function then you should program it in a way, that the function can take the whole table i_mdkp and not only lines of the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, are you really sure that this is your performance issue?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try the SE30, what is the total time of your program, how often is the function call and what is total time for the function and so on..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See how to use the SE30&lt;/P&gt;&lt;P&gt;/people/siegfried.boes/blog/2007/11/13/the-abap-runtime-trace-se30--quick-and-easy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Dec 2007 12:33:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-call-function-inside-a-loop/m-p/3188811#M759580</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-28T12:33:22Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue: CALL FUNCTION inside a Loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-call-function-inside-a-loop/m-p/3188812#M759581</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you will have to debug FM READ_MRP_LIST and write some code yourself that does what the FM does, but for the entire internal table, not just one record of the table. For example, you may find that the FM does something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT * FROM sometable
  WHERE some_key = idtnum.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You need it to do something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT * FROM sometable
  FOR ALL ENTRIES IN i_mdkp
  WHERE some_key = i_mdkp-dtnum.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Dec 2007 17:13:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-call-function-inside-a-loop/m-p/3188812#M759581</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-28T17:13:34Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue: CALL FUNCTION inside a Loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-call-function-inside-a-loop/m-p/3188813#M759582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If internal table i_mdkp has 50,000 records it does not mean that you need to run 50,000 iterations. You just need dtnum from internal table i_mdkp so you number of iterations should be eqaul to the unique number of dtnum in the internal table. Sort the internal table by dtnum and delete adjacent duplicates from the internal table comparing dtnum before looping. Look at the code below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA i_mdkp_tmp LIKE TABLE OF i_mdkp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT i_mdkp[] IS INITIAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  i_mdkp_tmp[] = i_mdkp[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SORT i_mdkp BY dtnum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DELETE ADJACENT DUPLICATES FROM i_mdkp COMPARING dtnum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  REFRESH i_mdtb.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT i_mdkp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL FUNCTION 'READ_MRP_LIST'&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        idtnum = i_mdkp-dtnum&lt;/P&gt;&lt;P&gt;        icflag = 'X'&lt;/P&gt;&lt;P&gt;      TABLES&lt;/P&gt;&lt;P&gt;        mdtbx = lt_mdtbx.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    APPEND LINES OF lt_mdtbx TO i_mdtb.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    REFRESH lt_mdtbx.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  i_mdkp[] = i_mdkp_tmp[]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Dec 2007 18:16:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-call-function-inside-a-loop/m-p/3188813#M759582</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-28T18:16:00Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue: CALL FUNCTION inside a Loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-call-function-inside-a-loop/m-p/3188814#M759583</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;You can read datas from database table(mdkp,mdtb). don't use FM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;L.Velu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Dec 2007 07:16:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-call-function-inside-a-loop/m-p/3188814#M759583</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-31T07:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue: CALL FUNCTION inside a Loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-call-function-inside-a-loop/m-p/3188815#M759584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Answered.&lt;/P&gt;&lt;P&gt;Thanks to all of you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Mar 2009 11:12:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-call-function-inside-a-loop/m-p/3188815#M759584</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-03T11:12:27Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue: CALL FUNCTION inside a Loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-call-function-inside-a-loop/m-p/3188816#M759585</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;it can not be answered you did not distribute points!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am always interested what people take as an answer, it is not always the correct one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Mar 2009 11:48:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-call-function-inside-a-loop/m-p/3188816#M759585</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-03T11:48:38Z</dc:date>
    </item>
  </channel>
</rss>

