<?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: Deletion from multiple tables...? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/deletion-from-multiple-tables/m-p/1043314#M87144</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there a sample code which can be used as a guideline for the same.&lt;/P&gt;&lt;P&gt;What will be the exporting importing parameters for this function module.How will the exceptions be handled ?&lt;/P&gt;&lt;P&gt;Ankur&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Dec 2005 11:57:24 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-12-21T11:57:24Z</dc:date>
    <item>
      <title>Deletion from multiple tables...?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/deletion-from-multiple-tables/m-p/1043308#M87138</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have 1 Master table and 10 child tables. I need to delete entries from these tables. I want to be sure that if there is some problem in the database then I should be able to roll back my deletion. I cannot check for sy-subrc after every delete as there may be some child tables which will not have corresponding entries. Any ideas how we can achieve the optimal design for the same, using commit work. The no of entries which needs to be deleted is huge around 5-6 millions of records need to be deleted. Should we use enqueue deque  fn modules?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at itab,&lt;/P&gt;&lt;P&gt;   Delete child table1 where key = itab-key.&lt;/P&gt;&lt;P&gt;   Delete child table2 where key = itab-key.&lt;/P&gt;&lt;P&gt;   .&lt;/P&gt;&lt;P&gt;   .&lt;/P&gt;&lt;P&gt;   .&lt;/P&gt;&lt;P&gt;   Delete child table 10 where key = itab-key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   Delete master table where key = itab-key.&lt;/P&gt;&lt;P&gt;Endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ankur Bhandari&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2005 10:44:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/deletion-from-multiple-tables/m-p/1043308#M87138</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-21T10:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: Deletion from multiple tables...?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/deletion-from-multiple-tables/m-p/1043309#M87139</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ankur,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Exactly for such purposes,&lt;/P&gt;&lt;P&gt;   there is the concept of UPDATE MODULE (Update FM)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Create a new FM.&lt;/P&gt;&lt;P&gt;   In the atriburtes,&lt;/P&gt;&lt;P&gt;   mark it as UPDATE MODULE (Start Immed)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Bunch all your sqls in this FM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. When calling the FM&lt;/P&gt;&lt;P&gt;    use the syntax&lt;/P&gt;&lt;P&gt;    CALL FUNCTION func IN UPDATE TASK   &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;Regards,&lt;/P&gt;&lt;P&gt;Amit M.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2005 10:50:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/deletion-from-multiple-tables/m-p/1043309#M87139</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-21T10:50:59Z</dc:date>
    </item>
    <item>
      <title>Re: Deletion from multiple tables...?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/deletion-from-multiple-tables/m-p/1043310#M87140</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ankur,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One way of achieveing this is,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While looping on itab, select the record from table1 into itab1. And then, use statement,&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;DELETE table1 FROM TABLE itab1.&amp;lt;/b&amp;gt; , To delete the entries from table1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Similarly, for all tables(child), and at the last use same procedure to delete master table record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dont forget to refresh these internal table contents at each loop pass.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2005 10:53:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/deletion-from-multiple-tables/m-p/1043310#M87140</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-21T10:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: Deletion from multiple tables...?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/deletion-from-multiple-tables/m-p/1043311#M87141</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Any sample code would be helpful.How will this ensure my objective.&lt;/P&gt;&lt;P&gt;Ankur Bhandari&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2005 10:56:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/deletion-from-multiple-tables/m-p/1043311#M87141</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-21T10:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: Deletion from multiple tables...?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/deletion-from-multiple-tables/m-p/1043312#M87142</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Where do I need to do a commit in this case ? &lt;/P&gt;&lt;P&gt;Will it still work if there are no entries in the child table.In that scenario we dont require a roll back?&lt;/P&gt;&lt;P&gt;Please clarify in detail.&lt;/P&gt;&lt;P&gt;Ankur bhandari&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2005 11:16:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/deletion-from-multiple-tables/m-p/1043312#M87142</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-21T11:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: Deletion from multiple tables...?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/deletion-from-multiple-tables/m-p/1043313#M87143</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi again,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1 Where do I need to do a commit in this case ? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  in the FM itself.&lt;/P&gt;&lt;P&gt;  write this statement of commit&lt;/P&gt;&lt;P&gt;  as the last statement.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; OR U CAN USE THIS STATEMENT&lt;/P&gt;&lt;P&gt;  IN UR CALLING PROGRAM ALSO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Will it still work if there are no entries in the child table.&lt;/P&gt;&lt;P&gt;  If there are not entries in child table,&lt;/P&gt;&lt;P&gt;  then no need to worry!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. In that scenario we dont require a roll back?&lt;/P&gt;&lt;P&gt;   Rollback not required.&lt;/P&gt;&lt;P&gt;   If any error occurs in betwee,&lt;/P&gt;&lt;P&gt;   the system will take care of rollback by itself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  (THE Update FM concept is designed for this purpose only)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it helps.&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;amit m.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Amit Mittal&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2005 11:35:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/deletion-from-multiple-tables/m-p/1043313#M87143</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-21T11:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: Deletion from multiple tables...?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/deletion-from-multiple-tables/m-p/1043314#M87144</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there a sample code which can be used as a guideline for the same.&lt;/P&gt;&lt;P&gt;What will be the exporting importing parameters for this function module.How will the exceptions be handled ?&lt;/P&gt;&lt;P&gt;Ankur&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2005 11:57:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/deletion-from-multiple-tables/m-p/1043314#M87144</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-21T11:57:24Z</dc:date>
    </item>
    <item>
      <title>Re: Deletion from multiple tables...?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/deletion-from-multiple-tables/m-p/1043315#M87145</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi again,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. What will be the exporting importing parameters for this function m&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   The IMPORTING  parameter&lt;/P&gt;&lt;P&gt;   will be just the PRIMARY KEY value&lt;/P&gt;&lt;P&gt;   of the Main Table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Using this key in your sqls&lt;/P&gt;&lt;P&gt;  u can delte the tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt;2 How will the exceptions be handled ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   Since it is Update FM,&lt;/P&gt;&lt;P&gt;  it is not executed immediately but later.&lt;/P&gt;&lt;P&gt;  so i don't think exceptiosn will be of any help.&lt;/P&gt;&lt;P&gt;  (i may be wrong here)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;amit m.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2005 12:02:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/deletion-from-multiple-tables/m-p/1043315#M87145</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-21T12:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: Deletion from multiple tables...?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/deletion-from-multiple-tables/m-p/1043316#M87146</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi please refer the following program which does the same functionality as ur requirement. COM_HIERARCHY_DELETE_ALL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just use commit work after the last delete statement in ur code. It will do the needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Satish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2005 12:46:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/deletion-from-multiple-tables/m-p/1043316#M87146</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-21T12:46:35Z</dc:date>
    </item>
    <item>
      <title>Re: Deletion from multiple tables...?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/deletion-from-multiple-tables/m-p/1043317#M87147</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Suppose I implement this functionality, How do I find out the total no of records which have been deleted. Earlier I could use sy-dbcnt after every delete statement.&lt;/P&gt;&lt;P&gt;*********************************************************&lt;/P&gt;&lt;P&gt;Loop at itab.&lt;/P&gt;&lt;P&gt;call function zfum in update task.&lt;/P&gt;&lt;P&gt;commit work.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;function module zfum.&lt;/P&gt;&lt;P&gt; delete child table 1&lt;/P&gt;&lt;P&gt; delete child table 2.&lt;/P&gt;&lt;P&gt; delete master table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jan 2006 11:43:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/deletion-from-multiple-tables/m-p/1043317#M87147</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-09T11:43:11Z</dc:date>
    </item>
    <item>
      <title>Re: Deletion from multiple tables...?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/deletion-from-multiple-tables/m-p/1043318#M87148</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ankur,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Since it is a update FM,&lt;/P&gt;&lt;P&gt;    we cannot return / export back any parameter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Hence, there is no direct way &lt;/P&gt;&lt;P&gt;   to achieve what u require.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;amit m.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jan 2006 12:22:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/deletion-from-multiple-tables/m-p/1043318#M87148</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-09T12:22:10Z</dc:date>
    </item>
  </channel>
</rss>

