<?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 record in database table does not work... in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-record-in-database-table-does-not-work/m-p/6717674#M1454836</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT is_ztxx_pt9126 ASSIGNING &amp;lt;fs_ztxx_pt9126&amp;gt;.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is a database table?  If it is, this statement didn't work.  You loop at &lt;STRONG&gt;internal tables&lt;/STRONG&gt;.  So, you'd need to import the database into an internal table first....or &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at the internal table.&lt;/P&gt;&lt;P&gt;   select the corresponding, matching data from your db table.&lt;/P&gt;&lt;P&gt;   if found, then do the delete on the db table.&lt;/P&gt;&lt;P&gt;end the loop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 16 Mar 2010 11:35:41 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-03-16T11:35:41Z</dc:date>
    <item>
      <title>Delete record in database table does not work...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-record-in-database-table-does-not-work/m-p/6717668#M1454830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Experts, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am wondering why my delete statement does not work. I want to delete records in my database&lt;/P&gt;&lt;P&gt;table which is not found in my internal table. Below is my code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SORT ts_selcriteria BY zattrrulid zattrseq zattrssq.

  LOOP AT is_ztxx_pt9126 ASSIGNING &amp;lt;fs_ztxx_pt9126&amp;gt;.

*"  Check if records was deleted in selection
*"  table. If yes, then delete this in table ZTXX_PT9126
    READ TABLE ts_selcriteria
      ASSIGNING &amp;lt;fs_selcriteria&amp;gt;
      WITH KEY zattrrulid = &amp;lt;fs_ztxx_pt9126&amp;gt;-zattrrulid
               zattrseq = &amp;lt;fs_ztxx_pt9126&amp;gt;-zattrseq
               zattrssq = &amp;lt;fs_ztxx_pt9126&amp;gt;-zattrssq
      BINARY SEARCH.

    IF sy-subrc ne 0.

      DELETE ztxx_pt9126 FROM &amp;lt;fs_ztxx_pt9126&amp;gt;.

    ENDIF.

  ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Mar 2010 10:54:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-record-in-database-table-does-not-work/m-p/6717668#M1454830</guid>
      <dc:creator>aris_hidalgo</dc:creator>
      <dc:date>2010-03-16T10:54:06Z</dc:date>
    </item>
    <item>
      <title>Re: Delete record in database table does not work...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-record-in-database-table-does-not-work/m-p/6717669#M1454831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you tried not using field symbol, but normal work area instead?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Mar 2010 10:58:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-record-in-database-table-does-not-work/m-p/6717669#M1454831</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2010-03-16T10:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: Delete record in database table does not work...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-record-in-database-table-does-not-work/m-p/6717670#M1454832</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Make sure the key fields match the DB-table exactly (cannot be derived from your post)&lt;/P&gt;&lt;P&gt;Make sure the entry is lockable.&lt;/P&gt;&lt;P&gt;Do a COMMIT WORK if the delete statement was successful and a ROLLBACK WORK if it was not. Check SY-SUBRC after the delete statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Roel van den Berge&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Mar 2010 11:03:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-record-in-database-table-does-not-work/m-p/6717670#M1454832</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-16T11:03:57Z</dc:date>
    </item>
    <item>
      <title>Re: Delete record in database table does not work...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-record-in-database-table-does-not-work/m-p/6717671#M1454833</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, I also tried using work area but to no avail. Below is my updated code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
e_ztxx_pt9126 = &amp;lt;fs_ztxx_pt9126&amp;gt;.

      DELETE ztxx_pt9126 FROM e_ztxx_pt9126.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Mar 2010 11:04:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-record-in-database-table-does-not-work/m-p/6717671#M1454833</guid>
      <dc:creator>aris_hidalgo</dc:creator>
      <dc:date>2010-03-16T11:04:21Z</dc:date>
    </item>
    <item>
      <title>Re: Delete record in database table does not work...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-record-in-database-table-does-not-work/m-p/6717672#M1454834</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is your table and work area type as table/line of Z DB table? If the strcutre is diffent then this might be the issue. Try giving key of entry you want to delete instead of giving work area.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DELETE ztxx_pt9126 FROM where field = e_ztxx_pt9126-field
                                                    and field2 = e_ztxx_pt9126-field2 
                                                     ...
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Mar 2010 11:17:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-record-in-database-table-does-not-work/m-p/6717672#M1454834</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2010-03-16T11:17:08Z</dc:date>
    </item>
    <item>
      <title>Re: Delete record in database table does not work...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-record-in-database-table-does-not-work/m-p/6717673#M1454835</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;e_ztxx_pt9126 = &amp;lt;fs_ztxx_pt9126&amp;gt;.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;      DELETE ztxx_pt9126 FROM e_ztxx_pt9126.&lt;/P&gt;&lt;P&gt;in this your work area should be of same type as ztxx_pt9126.&lt;/P&gt;&lt;P&gt;and also use COMMIT WORK after delete stmt.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Mar 2010 11:32:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-record-in-database-table-does-not-work/m-p/6717673#M1454835</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-16T11:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: Delete record in database table does not work...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-record-in-database-table-does-not-work/m-p/6717674#M1454836</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT is_ztxx_pt9126 ASSIGNING &amp;lt;fs_ztxx_pt9126&amp;gt;.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is a database table?  If it is, this statement didn't work.  You loop at &lt;STRONG&gt;internal tables&lt;/STRONG&gt;.  So, you'd need to import the database into an internal table first....or &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at the internal table.&lt;/P&gt;&lt;P&gt;   select the corresponding, matching data from your db table.&lt;/P&gt;&lt;P&gt;   if found, then do the delete on the db table.&lt;/P&gt;&lt;P&gt;end the loop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Mar 2010 11:35:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-record-in-database-table-does-not-work/m-p/6717674#M1454836</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-16T11:35:41Z</dc:date>
    </item>
    <item>
      <title>Re: Delete record in database table does not work...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-record-in-database-table-does-not-work/m-p/6717675#M1454837</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; This is a database table?  If it is, this statement didn't work.  You loop at &lt;STRONG&gt;internal tables&lt;/STRONG&gt;.  So, you'd need to import the database into an internal table first....or &lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wow !!! And why do we need to select before deleting ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Mar 2010 12:41:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-record-in-database-table-does-not-work/m-p/6717675#M1454837</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2010-03-16T12:41:18Z</dc:date>
    </item>
    <item>
      <title>Re: Delete record in database table does not work...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-record-in-database-table-does-not-work/m-p/6717676#M1454838</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;First of all, please check check first the code I posted before you comment. Anyway, I tried everything and still it doesnt work. I tried deleting from worka area, field symbol, etc and putting commit work but still the record is still not deleted.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Mar 2010 12:53:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-record-in-database-table-does-not-work/m-p/6717676#M1454838</guid>
      <dc:creator>aris_hidalgo</dc:creator>
      <dc:date>2010-03-16T12:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: Delete record in database table does not work...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-record-in-database-table-does-not-work/m-p/6717677#M1454839</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why do you say it doesn't work? How do you know the record is not deleted? I don't see any checking of sy-subrc after the delete.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Mar 2010 13:19:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-record-in-database-table-does-not-work/m-p/6717677#M1454839</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-16T13:19:27Z</dc:date>
    </item>
    <item>
      <title>Re: Delete record in database table does not work...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-record-in-database-table-does-not-work/m-p/6717678#M1454840</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;

types : begin of ty_jtab,
       f1(10) type c,
       end of ty_jtab.
data : jtab type standard table of ty_jtab with header line,
       itab type standard table of ty_jtab with header line.

data : wa_jtab type  ty_jtab,
       wa_itab type  ty_jtab.


*populate itab for say db
itab-f1 = '1000'. append itab.
itab-f1 = '2000'. append itab.
itab-f1 = '3000'. append itab.
*populate jtab
jtab-f1 = '1000'. append jtab.
jtab-f1 = '4000'. append jtab.
jtab-f1 = '8000'. append jtab.
jtab-f1 = '9000'. append jtab.


sort itab by f1.
sort jtab by f1.

clear: itab, wa_itab.

loop at itab into wa_itab.
  read table jtab into wa_jtab with key f1 = wa_itab-f1
                                         binary search.
  if sy-subrc ne 0.
    delete itab from wa_itab.
    if sy-subrc ne 0.
      write :/ 'fail', wa_itab-f1.
    endif.
  endif.
endloop.

*o/p is two times fail which shows the assumption.

br, 
vijay
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Mar 2010 13:22:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-record-in-database-table-does-not-work/m-p/6717678#M1454840</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-16T13:22:40Z</dc:date>
    </item>
    <item>
      <title>Re: Delete record in database table does not work...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-record-in-database-table-does-not-work/m-p/6717679#M1454841</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
field-symbols : &amp;lt;fsi&amp;gt; type ty_jtab,
                &amp;lt;fsj&amp;gt; type ty_jtab.
loop at itab assigning &amp;lt;fsi&amp;gt;.
  read table jtab assigning &amp;lt;fsj&amp;gt; with key f1 = &amp;lt;fsi&amp;gt;-f1
                                         binary search.
  if sy-subrc ne 0.
    delete itab from &amp;lt;fsi&amp;gt;.
    if sy-subrc ne 0.
      write :/ 'fail', &amp;lt;fsi&amp;gt;-f1.
    endif.
  endif.
endloop.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;replaced with the fiedsymbols and its showing the same o/p as expected .debugging for sy-subrc after delete may lead to some help. The only thing that can go wrong is if there is any mismatch with the work area or any more key field is not included  in wa can lead fail in the delete statement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;br, &lt;/P&gt;&lt;P&gt;Vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Mar 2010 13:31:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-record-in-database-table-does-not-work/m-p/6717679#M1454841</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-16T13:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: Delete record in database table does not work...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-record-in-database-table-does-not-work/m-p/6717680#M1454842</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;       DELETE ztxx_pt9126 FROM &amp;lt;fs_ztxx_pt9126&amp;gt;.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is not the correct syntax for deleting rows from a database table. Or do you really want to delete a complete cluster?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Mar 2010 13:38:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-record-in-database-table-does-not-work/m-p/6717680#M1454842</guid>
      <dc:creator>rainer_hbenthal</dc:creator>
      <dc:date>2010-03-16T13:38:51Z</dc:date>
    </item>
    <item>
      <title>Re: Delete record in database table does not work...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-record-in-database-table-does-not-work/m-p/6717681#M1454843</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Aris (VirayLab),&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I thought your senior in ABAP.  Have you forgotten that pressing F1 to check for correct syntax to delete in a database table would have solved your issue instantly.  Or best would have been asking your teammates (BJ or Analyn) or colleagues (Ice, Pao or Rodel). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You see, your problem was so much BASIC ABAP and you took some time posting message/question in SDN.  Is this the reason why you refrain from providing timely email updates (because you are waiting for somebody from SDN to solve your issue)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also next time, please never ever share company specific/protected programs/coding/objects.  Im sure you know that this is illegal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Bully&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Mar 2010 02:48:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-record-in-database-table-does-not-work/m-p/6717681#M1454843</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-23T02:48:34Z</dc:date>
    </item>
  </channel>
</rss>

