<?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: Need performance tunning on this code in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270783#M1386578</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I suppose you want some where-conditions for the inner loop that limit the loop to the items belonging to the corresponding header entry. Also make sure the inner table is a sorted table with key fields as used in that where-condition.&lt;/P&gt;&lt;P&gt;&lt;SPAN __jive_macro_name="thread" id="1283414"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 30 Oct 2009 07:59:39 GMT</pubDate>
    <dc:creator>ThomasZloch</dc:creator>
    <dc:date>2009-10-30T07:59:39Z</dc:date>
    <item>
      <title>Need performance tunning on this code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270782#M1386577</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 hve issue with the code where loop inside loop logic has been written, where first loop is header and second loop for item of BOM data. First table is fetching data for material and second table item level data. There are more than 50 thousand records in first table so its showing dump as time out error. Please give the better option for the same code which i have mentioned below. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; LOOP AT gt_mast.   ---&amp;gt; this is header table&lt;/P&gt;&lt;P&gt;          CALL FUNCTION 'CSAP_MAT_BOM_ITEM_SELECT'   &lt;/P&gt;&lt;P&gt;          EXPORTING&lt;/P&gt;&lt;P&gt;          material = gt_mast-matnr&lt;/P&gt;&lt;P&gt;          plant = gt_mast-werks&lt;/P&gt;&lt;P&gt;          bom_usage = gt_mast-stlan&lt;/P&gt;&lt;P&gt;          alternative = gt_mast-stlal&lt;/P&gt;&lt;P&gt;          TABLES&lt;/P&gt;&lt;P&gt;          t_stpo = gt_stpo&lt;/P&gt;&lt;P&gt;          EXCEPTIONS&lt;/P&gt;&lt;P&gt;          error = 1&lt;/P&gt;&lt;P&gt;          OTHERS = 2.&lt;/P&gt;&lt;P&gt;                  &lt;/P&gt;&lt;P&gt;          LOOP AT gt_stpo.&lt;/P&gt;&lt;P&gt;            gv_comp_qty = gt_stpo-comp_qty.&lt;/P&gt;&lt;P&gt;            REPLACE ALL OCCURRENCES OF ',' IN gv_comp_qty WITH space.&lt;/P&gt;&lt;P&gt;            CONDENSE gv_comp_qty.&lt;/P&gt;&lt;P&gt;            gv_qty = gv_comp_qty.&lt;/P&gt;&lt;P&gt;            MOVE gt_mast-matnr TO ycps_bom_tab-matnr.&lt;/P&gt;&lt;P&gt;            MOVE gt_mast-werks TO ycps_bom_tab-werks.&lt;/P&gt;&lt;P&gt;            MOVE gt_mast-stlan TO ycps_bom_tab-stlan.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Individual mapping is done as the valid to and from date is not in BW format&lt;/P&gt;&lt;P&gt;            ycps_bom_tab-stlkn = gt_stpo-item_node.&lt;/P&gt;&lt;P&gt;            ycps_bom_tab-stpoz = gt_stpo-item_count.&lt;/P&gt;&lt;P&gt;            ycps_bom_tab-sanin = gt_stpo-rel_pmaint.&lt;/P&gt;&lt;P&gt;            ycps_bom_tab-rekri = gt_stpo-recursive.&lt;/P&gt;&lt;P&gt;            ycps_bom_tab-alekz = gt_stpo-ale_ind.&lt;/P&gt;&lt;P&gt;          ENDLOOP.&lt;/P&gt;&lt;P&gt;          REFRESH gt_stpo.&lt;/P&gt;&lt;P&gt;        ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Oct 2009 07:49:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270782#M1386577</guid>
      <dc:creator>former_member779991</dc:creator>
      <dc:date>2009-10-30T07:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: Need performance tunning on this code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270783#M1386578</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I suppose you want some where-conditions for the inner loop that limit the loop to the items belonging to the corresponding header entry. Also make sure the inner table is a sorted table with key fields as used in that where-condition.&lt;/P&gt;&lt;P&gt;&lt;SPAN __jive_macro_name="thread" id="1283414"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Oct 2009 07:59:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270783#M1386578</guid>
      <dc:creator>ThomasZloch</dc:creator>
      <dc:date>2009-10-30T07:59:39Z</dc:date>
    </item>
    <item>
      <title>Re: Need performance tunning on this code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270784#M1386579</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;your inner loop does only a loop but no change or write .... nobody will notice if you drop it &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Oct 2009 08:18:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270784#M1386579</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-30T08:18:19Z</dc:date>
    </item>
    <item>
      <title>Re: Need performance tunning on this code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270785#M1386580</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I stopped looking after I saw the unconditional inner loop...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Oct 2009 08:21:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270785#M1386580</guid>
      <dc:creator>ThomasZloch</dc:creator>
      <dc:date>2009-10-30T08:21:37Z</dc:date>
    </item>
    <item>
      <title>Re: Need performance tunning on this code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270786#M1386581</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thomas, gt_stpo is calculated just before the loop (and refreshed afterwards), so the fact that it is unconditional is ok.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reena, CSAP_MAT_BOM_ITEM_SELECT is probably doing more things than you need, so you could try to replace it with an access to STAS / STPO ( / STKO ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another option would be to rethink the logic and make only one access to the database and create one big (sorted) gt_stpo table (then, of course, you would have a conditional inner loop).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not sure if the code you have is complete, but if it is consider Siegfried's comment, because you code is doing nothing at the moment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rui Dantas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Oct 2009 09:42:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270786#M1386581</guid>
      <dc:creator>Rui_Dantas</dc:creator>
      <dc:date>2009-10-30T09:42:41Z</dc:date>
    </item>
    <item>
      <title>Re: Need performance tunning on this code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270787#M1386582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; Thomas, gt_stpo is calculated just before the loop (and refreshed afterwards), so the fact that it is unconditional is ok.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Seems I even stopped looking &lt;EM&gt;before&lt;/EM&gt; the inner loop &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Oct 2009 09:54:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270787#M1386582</guid>
      <dc:creator>ThomasZloch</dc:creator>
      <dc:date>2009-10-30T09:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: Need performance tunning on this code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270788#M1386583</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, I agree with Siegfried - I don't see what the inner loop is actually doing. Maybe the OP has omitted some code to comply with the 2,500 character limit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, the problem could be due to the call to FM CSAP_MAT_BOM_ITEM_SELECT within the loop. It may be more efficient to retrieve the data outside of the first loop and process it inside.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Oct 2009 13:21:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270788#M1386583</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-30T13:21:57Z</dc:date>
    </item>
    <item>
      <title>Re: Need performance tunning on this code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270789#M1386584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;idealy the inner loop is item level data that we need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;its like loop of header level data&lt;/P&gt;&lt;P&gt;call the fm to retrieve the item level data for the particular record&lt;/P&gt;&lt;P&gt;then loop the item level data and pass the data into custome table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i am worried why time out error is coming for 50 thousand record?&lt;/P&gt;&lt;P&gt;is there any option to split the records and do the same process.&lt;/P&gt;&lt;P&gt;please provide the logical fessible answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks alot..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Nov 2009 14:02:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270789#M1386584</guid>
      <dc:creator>former_member779991</dc:creator>
      <dc:date>2009-11-02T14:02:06Z</dc:date>
    </item>
    <item>
      <title>Re: Need performance tunning on this code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270790#M1386585</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please rethink your program logic:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;+ your inner loop has no effect, you shuffle the data, but you don't save anything &lt;/P&gt;&lt;P&gt;+ how large are the two tables ????   There are 2 tables you mjultiply the execution, and you think 50.000 is small ..&lt;/P&gt;&lt;P&gt;   if the other one is also 50.000 then your have 2.500.000.000 executions .... which is far away from being small.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Nov 2009 14:53:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270790#M1386585</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-02T14:53:04Z</dc:date>
    </item>
    <item>
      <title>Re: Need performance tunning on this code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270791#M1386586</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;&lt;/P&gt;&lt;P&gt;idealy yes, my header data is 50,000 and yes it multiplies at item level say for ex: each header have two item then 1 lakh iterartion for item level . but the code that is provided to me is like that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can u suggest, is there any other way to write the logic for the same requirement, is there any other Function module similar to 'CSAP_MAT_BOM_ITEM_SELECT'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Nov 2009 06:58:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270791#M1386586</guid>
      <dc:creator>former_member779991</dc:creator>
      <dc:date>2009-11-03T06:58:42Z</dc:date>
    </item>
    <item>
      <title>Re: Need performance tunning on this code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270792#M1386587</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is there any other alternative Function Module which will work same sa fm  'CSAP_MAT_BOM_ITEM_SELECT' ?? i ma getting performance issue (time out error) while using this FM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please suggest.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Nov 2009 07:34:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270792#M1386587</guid>
      <dc:creator>former_member779991</dc:creator>
      <dc:date>2009-11-03T07:34:49Z</dc:date>
    </item>
    <item>
      <title>Re: Need performance tunning on this code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270793#M1386588</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;it is a quite hard communiation!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT gt_mast. ---&amp;gt; this is header table
  CALL FUNCTION 'CSAP_MAT_BOM_ITEM_SELECT' 
            EXPORTING  ...
            TABLES       t_stpo = gt_stpo
            EXCEPTIONS ...

  LOOP AT gt_stpo.
     gv_comp_qty = gt_stpo-comp_qty.
     REPLACE ALL OCCURRENCES OF ',' IN gv_comp_qty WITH space.
     CONDENSE gv_comp_qty.
     gv_qty = gv_comp_qty.
* also this useless, you change an global variable, inside the loop, but only the
* last execution can have an effect.


     MOVE gt_mast-matnr TO ycps_bom_tab-matnr.
     MOVE gt_mast-werks TO ycps_bom_tab-werks.
     MOVE gt_mast-stlan TO ycps_bom_tab-stlan.

*Individual mapping is done as the valid to and from date is not in BW format
ycps_bom_tab-stlkn = gt_stpo-item_node.
ycps_bom_tab-stpoz = gt_stpo-item_count.
ycps_bom_tab-sanin = gt_stpo-rel_pmaint.
ycps_bom_tab-rekri = gt_stpo-recursive.
ycps_bom_tab-alekz = gt_stpo-ale_ind.

* here is something missing, otherwise you move and move ... completely useless!!!

  ENDLOOP.
  REFRESH gt_stpo.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;gt_mast has 2 records ????  what should be the issue with 'CSAP_MAT_BOM_ITEM_SELECT&lt;/P&gt;&lt;P&gt;gt_stpo has how many ... please use numbers and not indian words!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would say your problem is not here but somewhere else !!!&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 Nov 2009 08:46:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270793#M1386588</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-03T08:46:13Z</dc:date>
    </item>
    <item>
      <title>Re: Need performance tunning on this code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270794#M1386589</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;Please don't look on the code &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT gt_stpo.&lt;/P&gt;&lt;P&gt;     gv_comp_qty = gt_stpo-comp_qty.&lt;/P&gt;&lt;P&gt;     REPLACE ALL OCCURRENCES OF ',' IN gv_comp_qty WITH space.&lt;/P&gt;&lt;P&gt;     CONDENSE gv_comp_qty.&lt;/P&gt;&lt;P&gt;     gv_qty = gv_comp_qty.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;also this useless, you change an global variable, inside the loop, but only the&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;last execution can have an effect.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THIS GLOBAL VARIABLE IS MAPPED WITH MY FINAL INTERNAL TABLE ycps_bom_tab, WHICH IS NOT MENTIONED IN THIS CODE. SO PLEASE DON'T LOOK ON THIS..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PLEASE CONCENTRATED ON THE LOGIC PART OF THIS CODE---&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT gt_mast.  -&lt;/P&gt;&lt;HR originaltext="-----" /&gt;&lt;P&gt;&amp;gt; WHICH HAVE AROUND 50.000 THOUSAND RECORDS&lt;/P&gt;&lt;P&gt;        CALL FUNCTION 'CSAP_MAT_BOM_ITEM_SELECT'   &lt;/P&gt;&lt;P&gt;        EXPORTING&lt;/P&gt;&lt;P&gt;        material = gt_mast-matnr&lt;/P&gt;&lt;P&gt;        plant = gt_mast-werks&lt;/P&gt;&lt;P&gt;        bom_usage = gt_mast-stlan&lt;/P&gt;&lt;P&gt;        alternative = gt_mast-stlal&lt;/P&gt;&lt;P&gt;        TABLES&lt;/P&gt;&lt;P&gt;        t_stpo = gt_stpo  ---&amp;gt; THIS WILL GIVE ITEM RECORDS FOR EACH HEADER DATA (WHICH CAN HAVE 5-6 ITEMS FOR EACH MATERIAL)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        LOOP AT gt_stpo.&lt;/P&gt;&lt;P&gt;          ycps_bom_tab-stlkn = gt_stpo-item_node.&lt;/P&gt;&lt;P&gt;          ycps_bom_tab-stpoz = gt_stpo-item_count.&lt;/P&gt;&lt;P&gt;          ycps_bom_tab-lkenz = gt_stpo-fldelete.&lt;/P&gt;&lt;P&gt;          ycps_bom_tab-andat = gt_stpo-created_on.&lt;/P&gt;&lt;P&gt;          APPEND ycps_bom_tab.&lt;/P&gt;&lt;P&gt;        ENDLOOP.&lt;/P&gt;&lt;P&gt;        REFRESH gt_stpo.&lt;/P&gt;&lt;P&gt;      ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THIS ENTIRE LOGIC IS GIVING TIME OUT ERROR.&lt;/P&gt;&lt;P&gt;IS THERE ANY OPTION TO DO THE PERFORMANCE TUNNING SO THAT IT WIILL RUN SMOOTHLY WITHOUT ANY DUMP (BACKGROUND/FOREGROUND)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note:  is there any logic to split the gt_mast table records into 2-3 internal table and do the loop end loop these many times for the entire logic?? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please suggest&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Nov 2009 09:36:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270794#M1386589</guid>
      <dc:creator>former_member779991</dc:creator>
      <dc:date>2009-11-03T09:36:53Z</dc:date>
    </item>
    <item>
      <title>Re: Need performance tunning on this code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270795#M1386590</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;o.k. the append was missing, it could have been something else, the APPEND explains nothing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;50.000 header &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; have two item then &lt;/P&gt;&lt;P&gt;&amp;gt; 1 lakh iterartion for item level .&lt;/P&gt;&lt;P&gt;what does the second line mean????&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Nov 2009 10:14:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270795#M1386590</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-03T10:14:58Z</dc:date>
    </item>
    <item>
      <title>Re: Need performance tunning on this code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270796#M1386591</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Reena,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if i got you right:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT gt_mast. "------&amp;gt; WHICH HAVE AROUND 50.000 THOUSAND RECORDS
CALL FUNCTION 'CSAP_MAT_BOM_ITEM_SELECT'  "called 50000 times
EXPORTING
material = gt_mast-matnr
plant = gt_mast-werks
bom_usage = gt_mast-stlan
alternative = gt_mast-stlal
TABLES
t_stpo = gt_stpo " ---&amp;gt; THIS WILL GIVE ITEM RECORDS FOR EACH HEADER DATA (WHICH CAN HAVE 5-6 ITEMS FOR EACH MATERIAL)

LOOP AT gt_stpo. "called 100000 times (1 lakh) if each header has 2 items or even more if we have 5 - 6 items
ycps_bom_tab-stlkn = gt_stpo-item_node.
ycps_bom_tab-stpoz = gt_stpo-item_count.
ycps_bom_tab-lkenz = gt_stpo-fldelete.
ycps_bom_tab-andat = gt_stpo-created_on.
APPEND ycps_bom_tab.
ENDLOOP.
REFRESH gt_stpo.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;why don't you trace it with SE30 / ST12 to see which par of this OR OTHER code takes the majority of the time?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hermann&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Nov 2009 11:03:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270796#M1386591</guid>
      <dc:creator>HermannGahm</dc:creator>
      <dc:date>2009-11-03T11:03:35Z</dc:date>
    </item>
    <item>
      <title>Re: Need performance tunning on this code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270797#M1386592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Hermann,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, exactly, i ment the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;have any one come across performance issue or time out error while using the FM - 'CSAP_MAT_BOM_ITEM_SELECT' .  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If yes, please suggest the relevant approch the entire code, which have mentioned in the above mail chain.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Nov 2009 13:12:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270797#M1386592</guid>
      <dc:creator>former_member779991</dc:creator>
      <dc:date>2009-11-03T13:12:02Z</dc:date>
    </item>
    <item>
      <title>Re: Need performance tunning on this code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270798#M1386593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Reena,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am reposting what I said in the beginning of this thread (since apparently you guys are exchanging comments but not really making any progress). Have you even considered this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt; CSAP_MAT_BOM_ITEM_SELECT is probably doing more things than you need, so you could try to replace it with an access to STAS / STPO ( / STKO ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another option would be to rethink the logic and make only one access to the database and create one big (sorted) gt_stpo table (then, of course, you would have a conditional inner loop). &lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rui Dantas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Nov 2009 13:20:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270798#M1386593</guid>
      <dc:creator>Rui_Dantas</dc:creator>
      <dc:date>2009-11-03T13:20:10Z</dc:date>
    </item>
    <item>
      <title>Re: Need performance tunning on this code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270799#M1386594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rui,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ya, i know nothing is working out. can anybody tell which all table this FM is using to fetch the records in i_stpo, so that rather than using the whole FM we can direct the select query in program itself.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Nov 2009 13:43:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270799#M1386594</guid>
      <dc:creator>former_member779991</dc:creator>
      <dc:date>2009-11-03T13:43:23Z</dc:date>
    </item>
    <item>
      <title>Re: Need performance tunning on this code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270800#M1386595</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; can anybody tell which all table this FM is using to fetch the records in i_stpo, so that rather than using the whole FM we can direct the select query in program itself.&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MAST -&amp;gt; STAS -&amp;gt; STPO should be enough for you.&lt;/P&gt;&lt;P&gt;Try to make the join and post here the explain plan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Nov 2009 14:10:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270800#M1386595</guid>
      <dc:creator>Rui_Dantas</dc:creator>
      <dc:date>2009-11-03T14:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: Need performance tunning on this code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270801#M1386596</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;.... sometimes it makes sense to look for the layout of a question:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your first LOOP contains 50.000 records and call an FM plus some cheap internal table processing, that is something completely different.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Run a test, reduce your mast table to 1000 records, then it should not dump. Execute the SE30, get the results,&lt;/P&gt;&lt;P&gt;come back and ask again.&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 Nov 2009 14:37:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-performance-tunning-on-this-code/m-p/6270801#M1386596</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-03T14:37:43Z</dc:date>
    </item>
  </channel>
</rss>

