<?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 Please help me correct this code in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-help-me-correct-this-code/m-p/4402380#M1046359</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a custom table for some application.&lt;/P&gt;&lt;P&gt;I want to write a program which can reverse the entries in that table for the given selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you guys please help me with this, I've been able to achieve following:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Note: SYSTEMTIME is one of the primary keys of the table&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Code below throws following error: &lt;/P&gt;&lt;P&gt;SAPSQL_ARRAY_INSERT_DUPREC&lt;/P&gt;&lt;P&gt;The ABAP/4 Open SQL array insert results in duplicate database records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;REPORT  ZDIFF_REVERSE                           .&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;tables: ztable1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data: itab like ztable1 occurs 0 with header line.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SELECTION-SCREEN  BEGIN OF BLOCK blk1 WITH FRAME.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;select-options: LOCATION for ztable1-LOCATION obligatory,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;               &lt;STRONG&gt;DATE for ztable1-DATE obligatory,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;               &lt;STRONG&gt;user for ztable1-user obligatory.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;parameter: test as checkbox default 'X'.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SELECTION-SCREEN END OF  BLOCK blk1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*select * from ztable1 into table itab*&lt;/P&gt;&lt;P&gt;                    &lt;STRONG&gt;where LOCATION in LOCATION&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;                       &lt;STRONG&gt;and DATE in DATE&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;                       &lt;STRONG&gt;and user in user.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Loop at itab.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;STRONG&gt;write:/ itab-LOCATION, itab-DATE, itab-user, itab-ORIGINALAMOUNT,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;          &lt;STRONG&gt;itab-CORRECTEDAMT, itab-DIFFAMT.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;endloop.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if test = ' '.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;STRONG&gt;loop at itab.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    *itab-ORIGINALAMOUNT = -1 * itab-ORIGINALAMOUNT.*&lt;/P&gt;&lt;P&gt;    *itab-CORRECTEDAMT = -1 * itab-CORRECTEDAMT.*&lt;/P&gt;&lt;P&gt;    *itab-DIFFAMT = -1 * itab-DIFFAMT.*&lt;/P&gt;&lt;P&gt;    &lt;STRONG&gt;itab-SYSTEMDATE = sy-datum.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;    &lt;STRONG&gt;itab-SYSTEMTIME = SY-UZEIT.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;    &lt;STRONG&gt;insert ztable1 from table itab.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;STRONG&gt;endloop.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  *	*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    &lt;STRONG&gt;endif.&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 28 Aug 2008 20:09:32 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-08-28T20:09:32Z</dc:date>
    <item>
      <title>Please help me correct this code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-help-me-correct-this-code/m-p/4402380#M1046359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a custom table for some application.&lt;/P&gt;&lt;P&gt;I want to write a program which can reverse the entries in that table for the given selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you guys please help me with this, I've been able to achieve following:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Note: SYSTEMTIME is one of the primary keys of the table&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Code below throws following error: &lt;/P&gt;&lt;P&gt;SAPSQL_ARRAY_INSERT_DUPREC&lt;/P&gt;&lt;P&gt;The ABAP/4 Open SQL array insert results in duplicate database records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;REPORT  ZDIFF_REVERSE                           .&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;tables: ztable1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data: itab like ztable1 occurs 0 with header line.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SELECTION-SCREEN  BEGIN OF BLOCK blk1 WITH FRAME.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;select-options: LOCATION for ztable1-LOCATION obligatory,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;               &lt;STRONG&gt;DATE for ztable1-DATE obligatory,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;               &lt;STRONG&gt;user for ztable1-user obligatory.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;parameter: test as checkbox default 'X'.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SELECTION-SCREEN END OF  BLOCK blk1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*select * from ztable1 into table itab*&lt;/P&gt;&lt;P&gt;                    &lt;STRONG&gt;where LOCATION in LOCATION&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;                       &lt;STRONG&gt;and DATE in DATE&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;                       &lt;STRONG&gt;and user in user.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Loop at itab.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;STRONG&gt;write:/ itab-LOCATION, itab-DATE, itab-user, itab-ORIGINALAMOUNT,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;          &lt;STRONG&gt;itab-CORRECTEDAMT, itab-DIFFAMT.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;endloop.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if test = ' '.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;STRONG&gt;loop at itab.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    *itab-ORIGINALAMOUNT = -1 * itab-ORIGINALAMOUNT.*&lt;/P&gt;&lt;P&gt;    *itab-CORRECTEDAMT = -1 * itab-CORRECTEDAMT.*&lt;/P&gt;&lt;P&gt;    *itab-DIFFAMT = -1 * itab-DIFFAMT.*&lt;/P&gt;&lt;P&gt;    &lt;STRONG&gt;itab-SYSTEMDATE = sy-datum.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;    &lt;STRONG&gt;itab-SYSTEMTIME = SY-UZEIT.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;    &lt;STRONG&gt;insert ztable1 from table itab.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;STRONG&gt;endloop.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  *	*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    &lt;STRONG&gt;endif.&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Aug 2008 20:09:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-help-me-correct-this-code/m-p/4402380#M1046359</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-28T20:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: Please help me correct this code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-help-me-correct-this-code/m-p/4402381#M1046360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;IF you want to reverse the records then why are you using insert instead of delete?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are getting the dump because you are trying to insert records that are already there&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Aug 2008 20:34:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-help-me-correct-this-code/m-p/4402381#M1046360</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-28T20:34:31Z</dc:date>
    </item>
    <item>
      <title>Re: Please help me correct this code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-help-me-correct-this-code/m-p/4402382#M1046361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don't you think you first edit one element:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
itab-SYSTEMDATE = sy-datum.
itab-SYSTEMTIME = SY-UZEIT.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and then you insert whole itab?&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
insert ztable1 from table itab.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It would be better to use table without header line...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wojciech.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Aug 2008 20:34:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-help-me-correct-this-code/m-p/4402382#M1046361</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-28T20:34:54Z</dc:date>
    </item>
    <item>
      <title>Re: Please help me correct this code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-help-me-correct-this-code/m-p/4402383#M1046362</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;You didn't modify the internal table...and you are trying to insert the same records that you got.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab-SYSTEMDATE = sy-datum.&lt;/P&gt;&lt;P&gt;itab-SYSTEMTIME = SY-UZEIT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODIFY itab.&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;insert ztable1 from table itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Aug 2008 20:38:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-help-me-correct-this-code/m-p/4402383#M1046362</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-28T20:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: Please help me correct this code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-help-me-correct-this-code/m-p/4402384#M1046363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Narendra, you nailed it. Adding modifty solved..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In reference to earlier post, I dont want to delete it coz this table feeds BI for reporting. Inorder to have a consistent reporting I am reversing it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Aug 2008 13:28:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-help-me-correct-this-code/m-p/4402384#M1046363</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-29T13:28:01Z</dc:date>
    </item>
  </channel>
</rss>

