<?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: Append with where condition in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-with-where-condition/m-p/3541258#M851984</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 would do it like you did it.&lt;/P&gt;&lt;P&gt;But if it is not fast enough then try this (I;m not sure if this will be faster though - think not):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SORT itab1 BY &amp;lt;material type&amp;gt;.
LOOP AT itab1 INTO lwa_itab1.
  IF lwa_itab1-&amp;lt;material type&amp;gt; &amp;lt;&amp;gt; 'X'.
    APPEND lwa_itab1 TO lwa_itab2.
  ENDIF.
  IF lwa_itab1-&amp;lt;material type&amp;gt; &amp;lt;&amp;gt; 'Y'.
    APPEND lwa_itab1 TO lwa_itab3.
  ENDIF.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway, what do you want to do? Maybe you should change your SELECT?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds&lt;/P&gt;&lt;P&gt;Mat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 14 Mar 2008 14:08:29 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-03-14T14:08:29Z</dc:date>
    <item>
      <title>Append with where condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-with-where-condition/m-p/3541255#M851981</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the sake of performance i'm want to get the requirement as below.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have three internal tables for example...itab1 itab2 and itab3....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab1 has all the records......for some reason i need to split this itab1 records material type wise into itab2 and itab3...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for this sake i'm using....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append lines of itab1 to itab2.&lt;/P&gt;&lt;P&gt;append lines of itab1 to itab3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;delete itab2 where &amp;lt;material type&amp;gt; NE 'X''.&lt;/P&gt;&lt;P&gt;delete itab3 where &amp;lt;material type&amp;gt; NE 'Y'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works fine for  few entries but for the sake of performance can append lines of itab1 to itab2 with some conditions of reference or with fieldsymbols so that i would have to write the delete statement.......and i should achieve the same requirement as above........Correct answere will be awarded........&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Mar 2008 13:47:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-with-where-condition/m-p/3541255#M851981</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-14T13:47:19Z</dc:date>
    </item>
    <item>
      <title>Re: Append with where condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-with-where-condition/m-p/3541256#M851982</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can do something like this......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table itab1 with key field1 = ' gfgf'&lt;/P&gt;&lt;P&gt;                                    field 2 = 'fgfd'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;move itab1-field1 to  itab2 -field2.&lt;/P&gt;&lt;P&gt;move &lt;/P&gt;&lt;P&gt;move..&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;loop at itab1.&lt;/P&gt;&lt;P&gt;read table itab1 with key field 1 = 'fgdf'&lt;/P&gt;&lt;P&gt;                                     field 2 =fgff.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;move itab1-field1 to itab3 -fiel1.&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 hope it helps.&lt;/P&gt;&lt;P&gt;&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, 14 Mar 2008 13:53:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-with-where-condition/m-p/3541256#M851982</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-14T13:53:39Z</dc:date>
    </item>
    <item>
      <title>Re: Append with where condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-with-where-condition/m-p/3541257#M851983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;As long as u r not using the &lt;STRONG&gt;delete&lt;/STRONG&gt; statement in side the loop it is ok to use.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But i have 2 ideas to make the ur &lt;STRONG&gt;delete statement&lt;/STRONG&gt; more effective.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. SORT: itab1 BY &amp;lt;material type&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab2[] = itab3[] = itab1[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;delete itab2 where &amp;lt;material type&amp;gt; NE 'X''.&lt;/P&gt;&lt;P&gt;delete itab3 where &amp;lt;material type&amp;gt; NE 'Y'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If u r not able to sort itab1 then dort itab2 and itab3 and then delete the records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have one addition for APPEND LINES OF itab&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;i.e From INDEX 1 to n.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT itab1 BY material type.&lt;/P&gt;&lt;P&gt;Find the starting and ending positions for material type X in itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND LINES OF itab1 to itab2 FROM 1 TO n(high value for material type X).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND LINES OF itab1 to itab2 FROM (n+1) to end position.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Start position will be 1 and end position u can get from DESCRIBE TABLE statement. Middle position u have to use some logic based on ur requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suggest u to use first solution which will be easier and effective than the second one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vinod.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Mar 2008 14:03:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-with-where-condition/m-p/3541257#M851983</guid>
      <dc:creator>vinod_vemuru2</dc:creator>
      <dc:date>2008-03-14T14:03:00Z</dc:date>
    </item>
    <item>
      <title>Re: Append with where condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-with-where-condition/m-p/3541258#M851984</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 would do it like you did it.&lt;/P&gt;&lt;P&gt;But if it is not fast enough then try this (I;m not sure if this will be faster though - think not):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SORT itab1 BY &amp;lt;material type&amp;gt;.
LOOP AT itab1 INTO lwa_itab1.
  IF lwa_itab1-&amp;lt;material type&amp;gt; &amp;lt;&amp;gt; 'X'.
    APPEND lwa_itab1 TO lwa_itab2.
  ENDIF.
  IF lwa_itab1-&amp;lt;material type&amp;gt; &amp;lt;&amp;gt; 'Y'.
    APPEND lwa_itab1 TO lwa_itab3.
  ENDIF.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway, what do you want to do? Maybe you should change your SELECT?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds&lt;/P&gt;&lt;P&gt;Mat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Mar 2008 14:08:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-with-where-condition/m-p/3541258#M851984</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-14T14:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: Append with where condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-with-where-condition/m-p/3541259#M851985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've resolved it&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jun 2010 06:20:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-with-where-condition/m-p/3541259#M851985</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-30T06:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: Append with where condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-with-where-condition/m-p/13595958#M2026400</link>
      <description>&lt;P&gt;You can use VALUE...FOR operator:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;itab2 = VALUE #( FOR &amp;lt;i&amp;gt; IN itab1 WHERE ( material_type EQ 'X' ) ( &amp;lt;i&amp;gt; ) ).&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 06 Feb 2024 08:12:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-with-where-condition/m-p/13595958#M2026400</guid>
      <dc:creator>javier_alonso63</dc:creator>
      <dc:date>2024-02-06T08:12:51Z</dc:date>
    </item>
  </channel>
</rss>

