<?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 Optimization Issue in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-issue/m-p/10607981#M1862564</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, I have an internal table which has a only four fields in it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Material&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;GL_Account&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Amount&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Customer.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to update a standard database table with data that is in my internal table, the problem&amp;nbsp; is that standard database table's structure is different than my internal table. so i created another internal table which is TYPE my database table and work area. ok&lt;/P&gt;&lt;P&gt;then I did a loop from Internal table into Workarea.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;INT_TAB has four fields above.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WA_INT is INT_TAB's work area&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;STD TABLE is a standard database table&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WA_STD_TAB is work area of STD_TAB which is TYPE STANDARD TABLE OF standard database table.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is my code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Loop at Int_Tab into WA_INT.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WA_std_tab-ZZMATERIAL = WA_INT-ZZMATERIAL.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WA_std_tab-ZZGL_ACCOUNT = WA_INT-ZZGL_ACCOUNT.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WA_std_tab-ZZAMOUNT = WA_INT-ZZAMOUNT.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WA_std_tab-ZZCUSTOMER = WA_INT-ZZCUSTOMER.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;UPDATE STD_TAB from WA_STD_TAB.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ENDLOOP.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My code compiled okay but this is very very slow and times out after 40 mins. I am only pulling 1 million records. I am looking and see how to optimize this better.&amp;nbsp; This should be done in a few minutes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please suggest me what to do here,&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;locked by moderator, spoonfeeding&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Manish Kumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Oct 2014 22:50:51 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2014-10-01T22:50:51Z</dc:date>
    <item>
      <title>Optimization Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-issue/m-p/10607981#M1862564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, I have an internal table which has a only four fields in it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Material&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;GL_Account&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Amount&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Customer.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to update a standard database table with data that is in my internal table, the problem&amp;nbsp; is that standard database table's structure is different than my internal table. so i created another internal table which is TYPE my database table and work area. ok&lt;/P&gt;&lt;P&gt;then I did a loop from Internal table into Workarea.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;INT_TAB has four fields above.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WA_INT is INT_TAB's work area&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;STD TABLE is a standard database table&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WA_STD_TAB is work area of STD_TAB which is TYPE STANDARD TABLE OF standard database table.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is my code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Loop at Int_Tab into WA_INT.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WA_std_tab-ZZMATERIAL = WA_INT-ZZMATERIAL.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WA_std_tab-ZZGL_ACCOUNT = WA_INT-ZZGL_ACCOUNT.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WA_std_tab-ZZAMOUNT = WA_INT-ZZAMOUNT.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WA_std_tab-ZZCUSTOMER = WA_INT-ZZCUSTOMER.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;UPDATE STD_TAB from WA_STD_TAB.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ENDLOOP.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My code compiled okay but this is very very slow and times out after 40 mins. I am only pulling 1 million records. I am looking and see how to optimize this better.&amp;nbsp; This should be done in a few minutes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please suggest me what to do here,&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;locked by moderator, spoonfeeding&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Manish Kumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Oct 2014 22:50:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-issue/m-p/10607981#M1862564</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-10-01T22:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-issue/m-p/10607982#M1862565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Consider using &lt;SPAN style="font-family: 'courier new', courier;"&gt;UPDATE dbtab FROM TABLE itab&lt;/SPAN&gt; syntax. As far as I understand, it groups updates into packages instead of sending them one by one, so this should reduce the overall number of database calls.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code will be something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;DATA: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; it_std_tab TYPE TABLE OF &amp;lt;DB table type&amp;gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; l_count&amp;nbsp;&amp;nbsp;&amp;nbsp; TYPE i VALUE 0.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;LOOP AT int_tab INTO wa_int.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; wa_std_tab-zzmaterial = ... " Copy the fields&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; ...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; APPEND wa_std_tab TO it_std_tab.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; l_count = l_count + 1.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; " Let's partition the source itab to prevent updates from being too huge&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; IF l_count = 1000.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; " Chunk is full, write to DB&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UPDATE std_tab FROM TABLE it_std_tab.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CLEAR it_std_tab.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; " Committing transaction with 1 mln changes may cause timeouts itself, so let's do it in chunks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; COMMIT WORK. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; ENDIF.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;ENDLOOP.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another option to try is to use UPDATE ... SET syntax, thus eliminating the need of intermediate tables/structures:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;LOOP AT int_tab INTO wa_int.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; UPDATE std_tab&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; SET &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; zzmaterial = wa_int-zzmaterial&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; WHERE ...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;ENDLOOP.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Important: in both cases you need to make sure that &lt;SPAN style="font-family: 'courier new', courier;"&gt;UPDATE&lt;/SPAN&gt; statements issued to the DB are supplied with &lt;SPAN style="font-family: 'courier new', courier;"&gt;STD_TAB&lt;/SPAN&gt; primary key (or other index) values. So you need to either include them into &lt;SPAN style="font-family: 'courier new', courier;"&gt;it_std_tab&lt;/SPAN&gt; (1st option) or provide explicitly in &lt;SPAN style="font-family: 'courier new', courier;"&gt;WHERE&lt;/SPAN&gt; clause (2nd option).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Oct 2014 05:19:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-issue/m-p/10607982#M1862565</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-10-02T05:19:32Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-issue/m-p/10607983#M1862566</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;After updating your database table, &lt;STRONG&gt;if you are not accessing same data in this program&lt;/STRONG&gt; then use UPDATE function module to finish your task.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create one function module and pass your local internal table to that FM via tables or exporting parameter. Now LOOP your data inside the update function module and update the table. Call your UPDATE function module like below in program:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;call &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;function &lt;/SPAN&gt;&lt;SPAN class="L0S33"&gt;'ZUPDATE_MY_TABLE' &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;in &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;update &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;task&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tables &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN class="L0S52"&gt; &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN class="L0S52"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Int_Tab =&amp;nbsp; Int_Tab.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN class="L0S52"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;This will be executed as asynchronous task and you can see this update process in SM13 transaction code. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;Naveen &lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN class="L0S52"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Oct 2014 05:34:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-issue/m-p/10607983#M1862566</guid>
      <dc:creator>naveen_inuganti2</dc:creator>
      <dc:date>2014-10-02T05:34:13Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-issue/m-p/10607984#M1862567</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mr. Alex. I was trying to update from work area to internal table but did not work how to do that. i think thi statement will let me do that. right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;APPEND wa_std_tab TO it_std_tab.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I will try this and let you know if it works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Oct 2014 11:52:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-issue/m-p/10607984#M1862567</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-10-02T11:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-issue/m-p/10607985#M1862568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can optimize your code if you use a field symbol to loop through your internal table. Field symbols work like dereferenced pointers, i.e. they do not create an additional work area. Right now, your code copies from the internal table int_tab to the work area wa_int and then it copies from wa_int to wa_std_tab. You can bypass the first step by using field symbols.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; LOOP AT int_tab ASSIGNING FIELD-SYMBOL(&amp;lt;fs_int&amp;gt;).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="qtext"&gt;MOVE-CORRESPONDING &amp;lt;fs_int&amp;gt; TO wa_std_tab.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; UPDATE std_tab FROM wa_std_tab.&lt;/P&gt;&lt;P&gt;&amp;nbsp; ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you can afford to make a gigantic new internal table, you can eliminate the loop and just make a MOVE-CORRESPONDING from your old table to the new internal table, then use the db UPDATE dbtab FROM TABLE itab syntax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Serban&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Oct 2014 13:24:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-issue/m-p/10607985#M1862568</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-10-02T13:24:47Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-issue/m-p/10607986#M1862569</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Serban, thank you. can you please tell me how to declare field symbols. i think you are right field symbols will make my loop go fast. Please help me declaring them.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Oct 2014 00:31:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-issue/m-p/10607986#M1862569</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-10-03T00:31:58Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-issue/m-p/10607987#M1862570</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mr. Alex, it worked but the performance is still slow. it is definitely better than before. can i use field symbol to make it even faster. can you please tell me how to declare field symbol please? i tried searching online but i couldn't understand.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another question is where do i clear the count?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, what if I get 1024 records, it will update my standard table for the first 1000 rows but what about the rest of 24 records? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Oct 2014 00:34:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-issue/m-p/10607987#M1862570</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-10-03T00:34:01Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-issue/m-p/10607988#M1862571</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;can you please tell me how to declare field symbol please?&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;Like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 12px; font-family: 'courier new', courier;"&gt;FIELD-SYMBOLS: &amp;lt;fs_row&amp;gt; TYPE int_tab_row_type.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;Unfortunately, I really doubt this will help a lot since your main bottleneck is the &lt;SPAN style="font-family: 'courier new', courier;"&gt;UPDATE&lt;/SPAN&gt; operation.&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;Another question is where do i clear the count?&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Oops, missed that one. Eventually, the LOOP should look like the below. Please note, that the problem with the remaining 24 rows is also solved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier; background: transparent;"&gt;LOOP AT int_tab INTO wa_int.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier; background: transparent;"&gt;&amp;nbsp; wa_std_tab-zzmaterial = ... " Copy the fields&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier; background: transparent;"&gt;&amp;nbsp;&amp;nbsp; ...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier; background: transparent;"&gt;&amp;nbsp; APPEND wa_std_tab TO it_std_tab.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier; background: transparent;"&gt;&amp;nbsp; l_count = l_count + 1.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier; background: transparent;"&gt;&amp;nbsp; " Let's partition the source itab to prevent updates from being too huge&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier; background: transparent;"&gt;&amp;nbsp; IF l_count = 1000.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier; background: transparent;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; " Chunk is full, write to DB&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier; background: transparent;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UPDATE std_tab FROM TABLE it_std_tab.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier; background: transparent;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CLEAR: it_std_tab, l_count. " &amp;lt;-- clear l_count as well&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier; background: transparent;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; " Committing transaction with 1 mln changes may cause timeouts itself, so let's do it in chunks&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier; background: transparent;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; COMMIT WORK.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier; background: transparent;"&gt;&amp;nbsp; ENDIF.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier; background: transparent;"&gt;ENDLOOP.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier; background: transparent;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier; background: transparent;"&gt;" Update the remaining records if any (the 1024 rows issue)&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier; background: transparent;"&gt;IF it_std_tab IS NOT INITIAL.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier; background: transparent;"&gt;&amp;nbsp; &lt;SPAN style="color: #333333; font-family: 'courier new', courier; font-size: 12px;"&gt;UPDATE std_tab FROM TABLE it_std_tab.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&lt;SPAN style="color: #333333; font-style: inherit; background: transparent; font-size: 12px; font-family: 'courier new', courier; font-weight: inherit;"&gt;&amp;nbsp; CLEAR &lt;SPAN style="color: #333333; font-family: 'courier new', courier; font-size: 12px;"&gt;it_std_tab.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier; background: transparent;"&gt;ENDIF.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier; background: transparent;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;the performance is still slow&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; background: transparent; font-family: arial, helvetica, sans-serif; font-weight: inherit;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier; background: transparent;"&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Well, you are doing around 1.000.000 updates, this just takes time, no matter what you. Check the all the indexes created for the &lt;SPAN style="font-family: 'courier new', courier;"&gt;std_tab&lt;/SPAN&gt;: you may need to create or alter one to fit the WHERE condition of your updates. This should also help, but don't expect miracles to happen &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_emote jive_macro" src="https://community.sap.com/1024/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Oct 2014 04:43:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-issue/m-p/10607988#M1862571</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-10-03T04:43:41Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-issue/m-p/10607989#M1862572</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Alex sir, thank you. I think this will work but one thing can you also do for me...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you do declaration of field symbols how it needs to be done with my scenario please?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Also, Material is the only key that I have in my standard database table ok. so, i don't know how to use this WHERE clause for ZZMATERIAL and where.&amp;nbsp; I have not created any index on my standard database table, do you think i should create the index for ZZMATERIAL?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Oct 2014 13:23:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-issue/m-p/10607989#M1862572</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-10-03T13:23:15Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-issue/m-p/10607990#M1862573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;Can you do declaration of field symbols how it needs to be done with my scenario please?&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;It will be something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;FIELD-SYMBOLS: &amp;lt;fs_int&amp;gt; LIKE LINE OF int_tab. " or use actual type of the int_tab work area&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;LOOP AT int_tab ASSIGNING &amp;lt;fs_int&amp;gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; ... " Use &amp;lt;fs_int&amp;gt; instead of wa_int, the rest of the code is the same&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;ENDLOOP.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;Also, Material is the only key that I have in my standard database table ok. so, i don't know how to use this WHERE clause for ZZMATERIAL and where.&amp;nbsp; I have not created any index on my standard database table, do you think i should create the index for ZZMATERIAL?&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If ZZMATERIAL is a part of the primary key, then it's already included in the index. I believe SAP OpenSQL subsystem should be wise enough to generate a proper WHERE clause that will make use of that index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just in case, you may check the SQL queries actually issued when updates are performed. To do this, just run the SQL tracing from the debugger as described &lt;A _jive_internal="true" href="https://answers.sap.com/community/abap/blog/2014/06/12/easy-trace-in-new-abap-debugger"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Oct 2014 17:27:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-issue/m-p/10607990#M1862573</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-10-03T17:27:37Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-issue/m-p/10607991#M1862574</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Sir Alex, I will try this and let you know how it works. also, i have another internal table in which I have a field called ZZSTORE. In that table which is called "int_tab_str" which has a work are as well. I have ZZMATERIAL and ZZSTORE as fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In that second internal table, my data lies like this:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ZZMATERIAL&amp;nbsp;&amp;nbsp;&amp;nbsp; ZZSTORE&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;101&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CTDPS&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;102&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CRGPD&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;103&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SEHTY&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;104&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CAUFG&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to merge that table to int_tab so I can bring ZZSTORE field in my int_tab.&amp;nbsp; From there I can take all these fields and send them to &lt;SPAN style="font-family: 'courier new', courier;"&gt;it_std_tab and finally append to my final standard database table. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;I am thinking about creating third final table in which I will have fields from Internal Table 1 and Internal Table 2 (ZZSTORE).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;then I will do &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new',courier;"&gt;SELECT * FROM INTERNAL TABLE 2 &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new',courier;"&gt;FOR ALL ENTRIES IN INTERNAL TABLE 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new',courier;"&gt;WHERE ZZMATERIAL = INTERNAL TABLE 1-ZZMATERIAL.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new',courier;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new',courier;"&gt;LOOP AT INTERNAL TABLE 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new',courier;"&gt;LOOP AT INTERNAL TABLE 2 WHERE ZZMATERIAL = ITAB1-ZZMATERIAL.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new',courier;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new',courier;"&gt;Here i think i will have to fill my third table but i do not know how.&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new',courier;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new',courier;"&gt;ENDLOOP.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;ENDLOOP.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Once this code is good then i need to know where to place this code in my scenario code. Please let me know.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Thanks.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Oct 2014 02:13:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-issue/m-p/10607991#M1862574</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-10-04T02:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-issue/m-p/10607992#M1862575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As far as I understand, the relation between store and material is 1:M. In this case I would just add a ZZSTORE field to the 1st table definition and then just fetch stores while looping over it. See the sample code below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'courier new', courier; font-size: 12px;"&gt;DATA l_wa_store LIKE LINE OF int_tab_2.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'courier new', courier; font-size: 12px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'courier new', courier; font-size: 12px;"&gt;SORT int_tab_2 BY zzmaterial.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'courier new', courier; font-size: 12px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'courier new', courier; font-size: 12px;"&gt;LOOP AT int_tab ASSIGNING &amp;lt;fs_int&amp;gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'courier new', courier; font-size: 12px;"&gt;&amp;nbsp; READ TABLE int_tab_2 INTO l_wa_store &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'courier new', courier; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; WITH KEY zzmaterial = &amp;lt;fs_mseg&amp;gt;-zzmaterial BINARY SEARCH.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'courier new', courier; font-size: 12px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'courier new', courier; font-size: 12px;"&gt;&amp;nbsp; IF sy-subrc = 0.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'courier new', courier; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;fs_int&amp;gt;-zzstore = l_wa_store-zzstore.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'courier new', courier; font-size: 12px;"&gt;&amp;nbsp; ENDIF.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'courier new', courier; font-size: 12px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'courier new', courier; font-size: 12px;"&gt;&amp;nbsp; " The code we've discussed earlier goes below&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'courier new', courier; font-size: 12px;"&gt;&amp;nbsp; ...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'courier new', courier; font-size: 12px;"&gt;ENDLOOP.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Oct 2014 04:49:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-issue/m-p/10607992#M1862575</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-10-06T04:49:39Z</dc:date>
    </item>
  </channel>
</rss>

