<?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: Split internal table into 2 internal table based on a condition in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/split-internal-table-into-2-internal-table-based-on-a-condition/m-p/4737839#M1111604</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Arun,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With out using LOOP you can do it as below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Declare tow internal tables, ITAB1 and ITAB2.&lt;/P&gt;&lt;P&gt;2. You have your records in ITAB1. Now use the statement&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;ITAB1[] = ITAB2&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;. This will replicate the records in both internal tables.&lt;/P&gt;&lt;P&gt;3. Now SORT the tables based on the field. As per your e.g. based on the FLAG.&lt;/P&gt;&lt;P&gt;4. Now, delete the records that you done want.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DELETE ITAB1 WHERE FLAG = 'X'.
         DELETE ITAB2 WHERE FLAG NE 'X'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This should helpyou acheive the results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Ram.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 31 Oct 2008 08:51:33 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-10-31T08:51:33Z</dc:date>
    <item>
      <title>Split internal table into 2 internal table based on a condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/split-internal-table-into-2-internal-table-based-on-a-condition/m-p/4737835#M1111600</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 have a requirement where in a single internal table has to be split into 2 internal table based on  value of a field present in that internal table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;eg: All records having cleared flag =' X' then it should be put into 1 internal table and all other records should be put into another internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since the internal table has about 5 million records , I want to avoid loop....endloop to do this task.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have any solution which will not use loop...endloop to split internal table, please post your comments.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;Arun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Oct 2008 08:47:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/split-internal-table-into-2-internal-table-based-on-a-condition/m-p/4737835#M1111600</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-31T08:47:06Z</dc:date>
    </item>
    <item>
      <title>Re: Split internal table into 2 internal table based on a condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/split-internal-table-into-2-internal-table-based-on-a-condition/m-p/4737836#M1111601</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;Hope the following similar Thread will help you regarding your problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="1106862"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nitesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Oct 2008 08:50:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/split-internal-table-into-2-internal-table-based-on-a-condition/m-p/4737836#M1111601</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-31T08:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: Split internal table into 2 internal table based on a condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/split-internal-table-into-2-internal-table-based-on-a-condition/m-p/4737837#M1111602</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;Check following steps:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Create a temporary table say itab_temp. Move original data to this table :&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;itab_temp[] = itab_main[].&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Delete itab_temp where variable = 'X'.
    itab_1[] = itab_temp[].&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;refresh itab_temp.
   itab_temp[] = itab_main[].
   Delete itab_temp where variable = space.
   itab_2[] = itab_temp[].&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab1_1 contains data with space value and itab_2 contains data with value 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Navneeth K.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Oct 2008 08:50:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/split-internal-table-into-2-internal-table-based-on-a-condition/m-p/4737837#M1111602</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-31T08:50:57Z</dc:date>
    </item>
    <item>
      <title>Re: Split internal table into 2 internal table based on a condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/split-internal-table-into-2-internal-table-based-on-a-condition/m-p/4737838#M1111603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if u dont want to use loop concept &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While Selecting &amp;amp; populating the table &lt;/P&gt;&lt;P&gt;"populate it seperately" changing ur where clause&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Oct 2008 08:51:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/split-internal-table-into-2-internal-table-based-on-a-condition/m-p/4737838#M1111603</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2008-10-31T08:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: Split internal table into 2 internal table based on a condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/split-internal-table-into-2-internal-table-based-on-a-condition/m-p/4737839#M1111604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Arun,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With out using LOOP you can do it as below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Declare tow internal tables, ITAB1 and ITAB2.&lt;/P&gt;&lt;P&gt;2. You have your records in ITAB1. Now use the statement&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;ITAB1[] = ITAB2&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;. This will replicate the records in both internal tables.&lt;/P&gt;&lt;P&gt;3. Now SORT the tables based on the field. As per your e.g. based on the FLAG.&lt;/P&gt;&lt;P&gt;4. Now, delete the records that you done want.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DELETE ITAB1 WHERE FLAG = 'X'.
         DELETE ITAB2 WHERE FLAG NE 'X'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This should helpyou acheive the results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Ram.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Oct 2008 08:51:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/split-internal-table-into-2-internal-table-based-on-a-condition/m-p/4737839#M1111604</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-31T08:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: Split internal table into 2 internal table based on a condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/split-internal-table-into-2-internal-table-based-on-a-condition/m-p/4737840#M1111605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Delete statements on such huge amount of records will be a problem.&lt;/P&gt;&lt;P&gt;because it must rebuild the  index once again.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Oct 2008 08:52:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/split-internal-table-into-2-internal-table-based-on-a-condition/m-p/4737840#M1111605</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2008-10-31T08:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: Split internal table into 2 internal table based on a condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/split-internal-table-into-2-internal-table-based-on-a-condition/m-p/4737841#M1111606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Arun,&lt;/P&gt;&lt;P&gt;First assign value to another internal table and then delete where flag = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
itab1[] = itab2[].
delete from itab2[] where flag = 'X'.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Chidanand&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Oct 2008 08:55:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/split-internal-table-into-2-internal-table-based-on-a-condition/m-p/4737841#M1111606</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-31T08:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: Split internal table into 2 internal table based on a condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/split-internal-table-into-2-internal-table-based-on-a-condition/m-p/4737842#M1111607</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;  Navneeth and Ram have provided the same solution. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Keshu has raised concern over the use of delete statments which will impact on the performance. If any one can resolve this issue, it would be great.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Oct 2008 09:09:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/split-internal-table-into-2-internal-table-based-on-a-condition/m-p/4737842#M1111607</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-31T09:09:01Z</dc:date>
    </item>
    <item>
      <title>Re: Split internal table into 2 internal table based on a condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/split-internal-table-into-2-internal-table-based-on-a-condition/m-p/4737843#M1111608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Using index while deleting can be faster  ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example say your table name is itab1 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT itab1 BY 'condition field' .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DESCRIBE TABLE itab1 lines l_lines .&lt;/P&gt;&lt;P&gt;READ TABLE itab1 WITH KEY 'condition field' = 'X' &lt;/P&gt;&lt;P&gt;l_record = sy-tabix . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab2 = itab1 .&lt;/P&gt;&lt;P&gt;DELETE itab1 FROM 1 TO l_record .&lt;/P&gt;&lt;P&gt;DELETE itab2 FROM l_record TO l_lines.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think this will be best in terms of performance .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Oct 2008 09:42:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/split-internal-table-into-2-internal-table-based-on-a-condition/m-p/4737843#M1111608</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-31T09:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: Split internal table into 2 internal table based on a condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/split-internal-table-into-2-internal-table-based-on-a-condition/m-p/4737844#M1111609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just show how ur filling the data to the itab....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Oct 2008 09:58:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/split-internal-table-into-2-internal-table-based-on-a-condition/m-p/4737844#M1111609</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2008-10-31T09:58:18Z</dc:date>
    </item>
    <item>
      <title>Re: Split internal table into 2 internal table based on a condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/split-internal-table-into-2-internal-table-based-on-a-condition/m-p/4737845#M1111610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just show how ur filling the data to the itab....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Oct 2008 09:58:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/split-internal-table-into-2-internal-table-based-on-a-condition/m-p/4737845#M1111610</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2008-10-31T09:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: Split internal table into 2 internal table based on a condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/split-internal-table-into-2-internal-table-based-on-a-condition/m-p/4737846#M1111611</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think keeping the current scenario, delete is much better in performance than any other like looping.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Oct 2008 10:00:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/split-internal-table-into-2-internal-table-based-on-a-condition/m-p/4737846#M1111611</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-31T10:00:57Z</dc:date>
    </item>
    <item>
      <title>Re: Split internal table into 2 internal table based on a condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/split-internal-table-into-2-internal-table-based-on-a-condition/m-p/4737847#M1111612</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Might b usefull !!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you delete an entry from an internal table in ABAP, the system has to re-generate the index for all entries after your delete, slowing the report if you have many records to eliminate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is much quicker to do an insert of the correct records into a second table than to delete entries from the first. The reason for this is because the index is only generated for the newest element. &lt;/P&gt;&lt;P&gt;I've included the code below as an example where we achieved a 150X speed improvement. By removing the code that performs a delete on table th_vlpma and replacing it with an append to th_vlpmatmp, we were able to get these type of gains.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; *--- D01K919273 Begin delete &lt;/P&gt;&lt;P&gt;*--- Delete deliveries not to be processed&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; loop at th_vbuk.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   delete th_vlpma where vbeln eq th_vbuk-vbeln.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; endloop.                             " th_vbuk.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*--- D01K919273 End delete&lt;/P&gt;&lt;P&gt;*--- Begin add D01K919273&lt;/P&gt;&lt;P&gt;   loop at th_vlpma into th_vlpmatmp.&lt;/P&gt;&lt;P&gt;      read table th_vbuk with key vbeln = th_vlpmatmp-vbeln&lt;/P&gt;&lt;P&gt;         binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      check sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;      append th_vlpmatmp.&lt;/P&gt;&lt;P&gt;   endloop.    &lt;/P&gt;&lt;P&gt;*--- End add D01K919273      &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Delete should be correct in this situation .... because it happens in a single step.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Oct 2008 10:16:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/split-internal-table-into-2-internal-table-based-on-a-condition/m-p/4737847#M1111612</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2008-10-31T10:16:47Z</dc:date>
    </item>
    <item>
      <title>Re: Split internal table into 2 internal table based on a condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/split-internal-table-into-2-internal-table-based-on-a-condition/m-p/4737848#M1111613</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I use select query from table DFKKKO to populate the internal table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Oct 2008 11:36:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/split-internal-table-into-2-internal-table-based-on-a-condition/m-p/4737848#M1111613</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-31T11:36:04Z</dc:date>
    </item>
  </channel>
</rss>

