<?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 FROM dbtab with functionality of MODIFY ? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-from-dbtab-with-functionality-of-modify/m-p/3596818#M866174</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;not possible, you need to set a delete Statement on you second table as well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 17 Mar 2008 09:37:03 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-03-17T09:37:03Z</dc:date>
    <item>
      <title>DELETE FROM dbtab with functionality of MODIFY ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-from-dbtab-with-functionality-of-modify/m-p/3596817#M866173</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 two tables that i want to keep synchronized, that means if in left table something is inserted or modified, this also has to be done in right table - i have done this with MODIFY statement and it works.&lt;/P&gt;&lt;P&gt;now i have to deal with entries that were deleted in left table and here is the problem:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i do loop right table and i check, wheter left table has this entry too or not. if it doesnt have, &lt;/P&gt;&lt;P&gt;then i delete the entry from right internal table and do MODIFY dbtab from internaltable, but nothing happens on db table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i read that MODIFY works like UPDATE and INSERT , what i need is UPDATE and DELETE...does this work ?&lt;/P&gt;&lt;P&gt;is there an alternative to do it ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i will give points immediately, as this is very important for me to be solved!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Mar 2008 09:30:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-from-dbtab-with-functionality-of-modify/m-p/3596817#M866173</guid>
      <dc:creator>former_member5350</dc:creator>
      <dc:date>2008-03-17T09:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: DELETE FROM dbtab with functionality of MODIFY ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-from-dbtab-with-functionality-of-modify/m-p/3596818#M866174</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;not possible, you need to set a delete Statement on you second table as well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Mar 2008 09:37:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-from-dbtab-with-functionality-of-modify/m-p/3596818#M866174</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-17T09:37:03Z</dc:date>
    </item>
    <item>
      <title>Re: DELETE FROM dbtab with functionality of MODIFY ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-from-dbtab-with-functionality-of-modify/m-p/3596819#M866175</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 this.&lt;/P&gt;&lt;P&gt;1. Select all record from table B which are not in table A.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SELECT B.key_fields A.some_field_that_is_always_filled 
  INTO TABALE table_of_fields
  FROM B
  LEFT JOIN A
    ON A.key_fields = B.key_fields
  WHERE A.some_field_that_is_always_filled = ''. "if there won't be a record in A table this field will be empty
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Delete record from the B table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DELETE b FROM TABLE table_of_fields.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That is the general idea.&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>Mon, 17 Mar 2008 09:37:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-from-dbtab-with-functionality-of-modify/m-p/3596819#M866175</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-17T09:37:41Z</dc:date>
    </item>
    <item>
      <title>Re: DELETE FROM dbtab with functionality of MODIFY ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-from-dbtab-with-functionality-of-modify/m-p/3596820#M866176</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Refer this code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab into wa.&lt;/P&gt;&lt;P&gt; delete itab1 where f1 &amp;lt;&amp;gt; wa-f1.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;update DB from table itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Ramya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Mar 2008 09:44:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-from-dbtab-with-functionality-of-modify/m-p/3596820#M866176</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-17T09:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: DELETE FROM dbtab with functionality of MODIFY ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-from-dbtab-with-functionality-of-modify/m-p/3596821#M866177</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 per ur requirement,&lt;/P&gt;&lt;P&gt;Consider two itabs  itab_L and itab_R.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create one new itab: itab_Del_Recrds.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Get the records from itab_R which are not available in itab_L..&lt;/P&gt;&lt;P&gt;Collect all those records in itab_Del_Recrds. by checking like this,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at itab_R.&lt;/P&gt;&lt;P&gt;   Read itab_L into wa_itab_L where itab_L-field  = itab_R-field.&lt;/P&gt;&lt;P&gt;   If sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;      Append WA_itab_L to itab_Del_Recrds.&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;Now  u get all the unavailable records(to be deleted) in this new itab itab_Del_Recrds.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now use DELETE itab_R from itab_Del_Recrds.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it will work fine.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Mar 2008 09:48:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-from-dbtab-with-functionality-of-modify/m-p/3596821#M866177</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-17T09:48:33Z</dc:date>
    </item>
    <item>
      <title>Re: DELETE FROM dbtab with functionality of MODIFY ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-from-dbtab-with-functionality-of-modify/m-p/3596822#M866178</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Through &lt;STRONG&gt;MODIFY&lt;/STRONG&gt; statement u can't delete the data in the database/internal tables. Modify will work like this.&lt;/P&gt;&lt;P&gt;If the entry already exist in the data base then it will update the data base(Same as UPDATE statement). If entry is not there in the data base then it will insert that record(Same as INSERT statement). &lt;/P&gt;&lt;P&gt;U have to use &lt;STRONG&gt;DELETE&lt;/STRONG&gt; statement for your requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT righttab INTO waright.&lt;/P&gt;&lt;P&gt;READ TABLE lefttab INTO waleft WITH KEY (Specify ur key fields).&lt;/P&gt;&lt;P&gt;IF NOT sy-subrc IS INITIAL.&lt;/P&gt;&lt;P&gt;DELETE rightdatabasetable FROM waright.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Do ur processing for INSER/UPDATE as usual.&lt;/STRONG&gt;&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;Hope this will solve ur problem. Make sure that your wa has all the key fields of the database table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vinod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Vinod Kumar Vemuru on Mar 17, 2008 3:22 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Mar 2008 09:50:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-from-dbtab-with-functionality-of-modify/m-p/3596822#M866178</guid>
      <dc:creator>vinod_vemuru2</dc:creator>
      <dc:date>2008-03-17T09:50:26Z</dc:date>
    </item>
  </channel>
</rss>

