<?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: delete rows based on condition in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-rows-based-on-condition/m-p/2753450#M640530</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi megan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       go through this code, this code will be helpfull to u.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at I_VBAP.&lt;/P&gt;&lt;P&gt;Read table I_VBAK where VBELN = I_VBAP-VBELN.&lt;/P&gt;&lt;P&gt;If sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;delete i_vbak.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;Endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;please reward points if helpfull.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with regards,&lt;/P&gt;&lt;P&gt;radhika kolluru.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Sep 2007 04:46:16 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-09-07T04:46:16Z</dc:date>
    <item>
      <title>delete rows based on condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-rows-based-on-condition/m-p/2753441#M640521</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I extract VBAK data, then I extract VBAP data with condition. Then I need to delete all orders from I_VBAK that dont exist in I_VBAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  SELECT vbeln auart augru lifsk faksk vkorg vtweg spart vsbed kunnr
    FROM vbak
    UP TO 10 ROWS
    INTO TABLE i_vbak
    WHERE vkorg IN s_vkorg
      AND vtweg IN s_vtweg
      AND spart IN s_spart
      AND erdat IN s_erdat
      AND vbeln IN s_vbeln
      AND kunnr IN s_kunnr
      AND lifsk IN s_lifsk
      AND faksk IN s_faksk
      AND augru IN s_augru.

  IF i_vbak[] IS NOT INITIAL.
    SELECT vbeln posnr matnr pstyv vrkme
      FROM vbap
      INTO TABLE i_vbap
      FOR ALL ENTRIES IN i_vbak
      WHERE vbeln = i_vbak-vbeln
      AND matnr IN s_matnr
      AND werks IN s_werks
      AND pstyv IN s_pstyv
      AND abgru = ' '.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2007 12:52:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-rows-based-on-condition/m-p/2753441#M640521</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-06T12:52:31Z</dc:date>
    </item>
    <item>
      <title>Re: delete rows based on condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-rows-based-on-condition/m-p/2753442#M640522</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Megan,&lt;/P&gt;&lt;P&gt;               Refer this code :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at I_VBAP.&lt;/P&gt;&lt;P&gt;Read table I_VBAK where VBELN = I_VBAP-VBELN.&lt;/P&gt;&lt;P&gt;If sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;delete i_vbak.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;Endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Hemant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2007 12:56:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-rows-based-on-condition/m-p/2753442#M640522</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-06T12:56:17Z</dc:date>
    </item>
    <item>
      <title>Re: delete rows based on condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-rows-based-on-condition/m-p/2753443#M640523</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This can be done in this way. first Loop on I_vbak record and then read the I_VBAP record with the order number as the key. If record is read then keep it otherwise delete the record from the I_VBAK table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Amit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2007 12:57:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-rows-based-on-condition/m-p/2753443#M640523</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-06T12:57:38Z</dc:date>
    </item>
    <item>
      <title>Re: delete rows based on condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-rows-based-on-condition/m-p/2753444#M640524</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why don't you use inner join.  This is better performancewise and also simple.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT a&lt;SUB&gt;vbeln a&lt;/SUB&gt;auart a&lt;SUB&gt;augru a&lt;/SUB&gt;lifsk a&lt;SUB&gt;faksk a&lt;/SUB&gt;vkorg a&lt;SUB&gt;vtweg a&lt;/SUB&gt;spart a&lt;SUB&gt;vsbed a&lt;/SUB&gt;kunnr  b&lt;SUB&gt;posnr b&lt;/SUB&gt;matnr b&lt;SUB&gt;pstyv b&lt;/SUB&gt;vrkme into table itab from vbak as a inner join vbap as b where WHERE a~vkorg IN s_vkorg&lt;/P&gt;&lt;P&gt;      AND a~vtweg IN s_vtweg&lt;/P&gt;&lt;P&gt;      AND a~spart IN s_spart&lt;/P&gt;&lt;P&gt;      AND a~erdat IN s_erdat&lt;/P&gt;&lt;P&gt;      AND a~vbeln IN s_vbeln&lt;/P&gt;&lt;P&gt;      AND a~kunnr IN s_kunnr&lt;/P&gt;&lt;P&gt;      AND a~lifsk IN s_lifsk&lt;/P&gt;&lt;P&gt;      AND a~faksk IN s_faksk&lt;/P&gt;&lt;P&gt;      AND a~augru IN s_augru &lt;/P&gt;&lt;P&gt;     AND b~matnr IN s_matnr&lt;/P&gt;&lt;P&gt;      AND b~werks IN s_werks&lt;/P&gt;&lt;P&gt;      AND b~pstyv IN s_pstyv&lt;/P&gt;&lt;P&gt;      AND b~abgru = ' '.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You need to create a new internal table with rows in same sequence as mentioned in select statement above.  This statement gives only records which have entries in both VBAK and VBAP tables.&lt;/P&gt;&lt;P&gt;Let me know if you need any more details.&lt;/P&gt;&lt;P&gt;Award points if you find this hint helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2007 12:59:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-rows-based-on-condition/m-p/2753444#M640524</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-06T12:59:20Z</dc:date>
    </item>
    <item>
      <title>Re: delete rows based on condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-rows-based-on-condition/m-p/2753445#M640525</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data:v_index type sy-tabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at i_vbak into s_vbak.&lt;/P&gt;&lt;P&gt;  v_index = sy-tabix.&lt;/P&gt;&lt;P&gt;  read table i_vbap with key vbeln = s_vbak-vbeln.&lt;/P&gt;&lt;P&gt;  if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    delete i_vbak index v_index.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2007 13:00:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-rows-based-on-condition/m-p/2753445#M640525</guid>
      <dc:creator>former_member799868</dc:creator>
      <dc:date>2007-09-06T13:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: delete rows based on condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-rows-based-on-condition/m-p/2753446#M640526</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SUDHAKER gogula - Join will not give better performance. The filters are all selection criteria.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Megan Flores&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2007 13:26:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-rows-based-on-condition/m-p/2753446#M640526</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-06T13:26:49Z</dc:date>
    </item>
    <item>
      <title>Re: delete rows based on condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-rows-based-on-condition/m-p/2753447#M640527</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Meghan Flores -  a Quick question&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Question 1&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------" /&gt;&lt;P&gt;Which one gives better performance  from below 2 statements.&lt;/P&gt;&lt;P&gt;Getting data from VBAK and using FOR ALL ENTRIES getting data from VBAP.&lt;/P&gt;&lt;P&gt;OR&lt;/P&gt;&lt;P&gt; get data using INTO TABLE using inner joins.  Which one do you think is better performance wise.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You also said that filters are selection criteria.  Is there limit for number of filters below which inner join is better.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2007 13:39:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-rows-based-on-condition/m-p/2753447#M640527</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-06T13:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: delete rows based on condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-rows-based-on-condition/m-p/2753448#M640528</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SUDHAKER gogula  - I believe JOINs dont give good performance. I may or may not be passing keys in this join. If they are entered in the selection criteria then they may be passed else they wont be and this will be poor performance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2007 13:54:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-rows-based-on-condition/m-p/2753448#M640528</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-06T13:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: delete rows based on condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-rows-based-on-condition/m-p/2753449#M640529</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please go though these links:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;JOINS vs. FOR ALL ENTRIES - Which Performs Better?&lt;/P&gt;&lt;P&gt;/people/rob.burbank/blog/2007/03/19/joins-vs-for-all-entries--which-performs-better&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;these are the outcomes:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are other considerations that come into play as well: &lt;/P&gt;&lt;P&gt;1. INNER JOINs only look at the intersection of the results that meet the WHERE clause. &lt;/P&gt;&lt;P&gt;2. FOR ALL ENTRIES eliminates duplicates from the results. &lt;/P&gt;&lt;P&gt;3. I find JOINs to be more time consuming to code. (I can never find the &amp;#147;~&amp;#148; key.) &lt;/P&gt;&lt;P&gt;4. When using FOR ALL ENTRIES you generally end up with at least two internal tables. This may    or may not be a good thing. &lt;/P&gt;&lt;P&gt;5. The example I have shown uses the full primary key. Some preliminary testing I have done      comparing JOINs with FOR ALL ENTRIES show that FOR ALL ENTRIES can give better performance    in that case. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/people/rob.burbank/blog/2006/11/16/performance--what-will-kill-you-and-what-will-leave-you-with-only-a-flesh-wound&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://blogs.ittoolbox.com/sap/db2/archives/for-all-entries-vs-db2-join-8912" target="test_blank"&gt;http://blogs.ittoolbox.com/sap/db2/archives/for-all-entries-vs-db2-join-8912&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally, I think it depends on the situation to decide which one is better. Its not a compile time decision, but a run time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raman.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2007 04:34:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-rows-based-on-condition/m-p/2753449#M640529</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-07T04:34:37Z</dc:date>
    </item>
    <item>
      <title>Re: delete rows based on condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-rows-based-on-condition/m-p/2753450#M640530</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi megan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       go through this code, this code will be helpfull to u.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at I_VBAP.&lt;/P&gt;&lt;P&gt;Read table I_VBAK where VBELN = I_VBAP-VBELN.&lt;/P&gt;&lt;P&gt;If sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;delete i_vbak.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;Endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;please reward points if helpfull.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with regards,&lt;/P&gt;&lt;P&gt;radhika kolluru.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2007 04:46:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-rows-based-on-condition/m-p/2753450#M640530</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-07T04:46:16Z</dc:date>
    </item>
  </channel>
</rss>

