<?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: Updating database table with DUPLICATE keys in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915557#M686342</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your kind help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now my problem is solved...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Naren, Loads of thanks for your sample code.&lt;/P&gt;&lt;P&gt;The counter logic Rocks now in my Table...!!!!   &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Pavan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 11 Oct 2007 05:26:34 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-10-11T05:26:34Z</dc:date>
    <item>
      <title>Updating database table with DUPLICATE keys</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915542#M686327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i have an internal table having data as follows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;emp_id     name     date           proj_id  activity_id    Hours  Remarks&lt;/P&gt;&lt;P&gt;101	Pavan    09.10.2007      123	1         2.00       Coding&lt;/P&gt;&lt;P&gt;101	Pavan	09.10.2007   124	2         1.00	   Documentation&lt;/P&gt;&lt;P&gt;102	Raj	09.10.2007   123        3         6.00     Testing&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now i need to update a Ztable with above mentioned data.&lt;/P&gt;&lt;P&gt;The structure of the Ztable is as follows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mandt	emp_id  name    date    proj_id   activity_id   Hours   Remarks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOte: i have ticked both check boxes for the field MANDT in table.&lt;/P&gt;&lt;P&gt;Rest didnt select the check boxes.&lt;/P&gt;&lt;P&gt;I believe now the field MANDT alone is a primary key for the z-table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOw i have tried with UPDATE/INSERT statments to update the database table.&lt;/P&gt;&lt;P&gt;But instead of inserting all the rows, the system is over writing on the same emp_id row.&lt;/P&gt;&lt;P&gt;Even tried with the statments like INSERT INTO &amp;lt;Ztable&amp;gt; values &amp;lt;Internal table&amp;gt; ACCEPTING DUPLICATE KEYS.&lt;/P&gt;&lt;P&gt;But its not getting inserted as a separate row in the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Requirement is to insert the multiple rows in the database table without any over writing activity.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone give me the code to do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Pavan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Oct 2007 09:18:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915542#M686327</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-10T09:18:04Z</dc:date>
    </item>
    <item>
      <title>Re: Updating database table with DUPLICATE keys</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915543#M686328</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;Remove the primary key status of MANDT field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nivetha.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Oct 2007 09:20:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915543#M686328</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-10T09:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: Updating database table with DUPLICATE keys</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915544#M686329</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 don't understand why the data isn't inserted the way you want. Maybe there's something wrong in your coding.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However: Why not insert an additional field with a simple number sequence or something like that and use that as a primary key? You can ignore this field in your processing if you like, but you still have a pkey. This should work regardless of other problems...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just an idea.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Joerg&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Oct 2007 09:22:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915544#M686329</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-10T09:22:48Z</dc:date>
    </item>
    <item>
      <title>Re: Updating database table with DUPLICATE keys</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915545#M686330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Pavan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            Now that your requirement is clearly stated, I can say that since you are not having any primary key, you cannot perform any operations such as &amp;lt;b&amp;gt;insert&amp;lt;/b&amp;gt; or &amp;lt;b&amp;gt;update&amp;lt;/b&amp;gt;. Hope you understand the situation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;             You get duplicate keys when you have any primary keys and non-primary keys. &amp;lt;b&amp;gt;MANDT&amp;lt;/b&amp;gt; is  client-specific.  You need to have some Primary key fields depending on your requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this resolves your query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Nagaraj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Oct 2007 09:24:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915545#M686330</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-10T09:24:39Z</dc:date>
    </item>
    <item>
      <title>Re: Updating database table with DUPLICATE keys</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915546#M686331</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Pavan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if MANDT is the only key field in the Ztable, that means that you cannot create more than one record in the table (by client). I think at least the emp_id has to be as key field as well (together with MANDT).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ec&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Oct 2007 09:30:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915546#M686331</guid>
      <dc:creator>JozsefSzikszai</dc:creator>
      <dc:date>2007-10-10T09:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: Updating database table with DUPLICATE keys</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915547#M686332</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt; Make Emp ID a primary key. that will solve the problem&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Oct 2007 09:31:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915547#M686332</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-10T09:31:37Z</dc:date>
    </item>
    <item>
      <title>Re: Updating database table with DUPLICATE keys</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915548#M686333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think since MANDT is only primary key so always your table contain only one row because when you are trying to insert 2nd row mandt field will be repeating (since sy-mandt is same) and so it will not insert the second row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so as per my solution make below fields also the key field&lt;/P&gt;&lt;P&gt;emp_id name date proj_id activity_id.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now it will update all the records you have posted in your thread.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;shiba dutta&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Oct 2007 09:32:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915548#M686333</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-10T09:32:07Z</dc:date>
    </item>
    <item>
      <title>Re: Updating database table with DUPLICATE keys</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915549#M686334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Pavan,&lt;/P&gt;&lt;P&gt;    Please let me know what are the key fields in your Ztable. Try with below code it may help you. change the "Ztablename" as your database table name and I_INTERNAL TABLE  as your internal table name. still you are facing the problem please let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;lock the custom table before updating the table.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'ENQUEUE_E_TABLE'&lt;/P&gt;&lt;P&gt;   EXPORTING&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  MODE_RSTABLE         = 'E'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;     TABNAME              = 'ZTABLENAME'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  VARKEY               =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  X_TABNAME            = ' '&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  X_VARKEY             = ' '&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  _SCOPE               = '2'&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  _WAIT                = ' '&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  _COLLECT             = ' '&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;   EXCEPTIONS&lt;/P&gt;&lt;P&gt;     FOREIGN_LOCK         = 1&lt;/P&gt;&lt;P&gt;     SYSTEM_FAILURE       = 2&lt;/P&gt;&lt;P&gt;     OTHERS               = 3&lt;/P&gt;&lt;P&gt;            .&lt;/P&gt;&lt;P&gt;  IF SY-SUBRC &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;P&gt;            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;    INSERT  ZTABLENAME FROM TABLE I_INTERNALTABLE ACCEPTING DUPLICATE KEYS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    COMMIT WORK.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;unlock after updating the custom table After updation is done.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'DEQUEUE_E_TABLE'&lt;/P&gt;&lt;P&gt;   EXPORTING&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    MODE_RSTABLE       = 'E'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;     TABNAME            = 'ZTABLENAME'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    VARKEY             =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    X_TABNAME          = ' '&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    X_VARKEY           = ' '&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    _SCOPE             = '3'&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    _SYNCHRON          = ' '&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    _COLLECT           = ' '&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Oct 2007 09:32:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915549#M686334</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-10T09:32:39Z</dc:date>
    </item>
    <item>
      <title>Re: Updating database table with DUPLICATE keys</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915550#M686335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sorry,&lt;/P&gt;&lt;P&gt;Emp ID &amp;amp; project ID  - mark as key fields&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Oct 2007 09:33:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915550#M686335</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-10T09:33:00Z</dc:date>
    </item>
    <item>
      <title>Re: Updating database table with DUPLICATE keys</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915551#M686336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ramakrishna,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My Z-table is as follows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;counter  Primary key catscounte  char12   &lt;/P&gt;&lt;P&gt;empid    -- pernr_d   numc 8  &lt;/P&gt;&lt;P&gt;name    --   --  char20&lt;/P&gt;&lt;P&gt;zdate  --   catsdate   dats8&lt;/P&gt;&lt;P&gt;projid  --   ---  char10&lt;/P&gt;&lt;P&gt;itemid  --   --  char10&lt;/P&gt;&lt;P&gt;actid   --   --  char10&lt;/P&gt;&lt;P&gt;Hrs   --   catshours  quan 4&lt;/P&gt;&lt;P&gt;Remarks    --  catsshoortt  char 40&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hence the filed "counter" is alone a primary key in the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IN se37, i m passing the parameteres and then an internal table will hold all the values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then i have coded as follows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;insert &amp;lt;ZTABLE&amp;gt; from table &amp;lt;ITAB&amp;gt; ACCEPTING DUPLICATE KEYS.&lt;/P&gt;&lt;P&gt;commit work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As of now, the duplicate entries for the same empid are not getting stored in the Ztable. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to store the dupplicate entries in the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope my problem with this discription is crystal clear......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly help me....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Pavan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2007 04:32:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915551#M686336</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-11T04:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: Updating database table with DUPLICATE keys</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915552#M686337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Still problem continues...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please Help me..!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2007 04:36:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915552#M686337</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-11T04:36:29Z</dc:date>
    </item>
    <item>
      <title>Re: Updating database table with DUPLICATE keys</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915553#M686338</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;Make Mandt and emp_id as primary keys in your Z table .&lt;/P&gt;&lt;P&gt;This will solve the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;RK&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2007 04:45:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915553#M686338</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-11T04:45:10Z</dc:date>
    </item>
    <item>
      <title>Re: Updating database table with DUPLICATE keys</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915554#M686339</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;Try this..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

DATA: v_counter type ztable-counter.  " Assuming the counter is the key for the 
                                                        " ztable

* Get the counter.
SELECT max( counter ) INTO v_counter from ztable.

* If the return code is not successful then there is no entry in the table.
* then set the v_counter to 1.
 IF SY-SUBRC &amp;lt;&amp;gt; 0.
    v_counter = 1.
 ELSE.
    v_counter = v_counter + 1.
 ENDIF.

* Now process the internal table that has the data.

LOOP AT itab INTO wa.

* Now counter being the key to the table..increment the counter and modify
* the internal table.
  wa-counter = v_counter.

* make sure to populate the mandt also.
  wa-mandt = sy-mandt.    " Current client.

  MODIFY itab FROM wa.

* Increment the counter.
  v_counter = v_counter + 1.

ENDLOOP.

* Insert the records to the table.
INSERT ztable FROM TABLE itab.

COMMIT WORK.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&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, 11 Oct 2007 04:45:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915554#M686339</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-11T04:45:28Z</dc:date>
    </item>
    <item>
      <title>Re: Updating database table with DUPLICATE keys</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915555#M686340</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;     using either modify or insert key word u can add into database&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   INSERT (dbtabname) FROM TABLE itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  rewards if userful&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sree&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2007 04:50:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915555#M686340</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-11T04:50:18Z</dc:date>
    </item>
    <item>
      <title>Re: Updating database table with DUPLICATE keys</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915556#M686341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;what about the ITAB-COUNTER value it should be unique.  Here I am giving you a simple logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;after filling all the values in itab.&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;itab-counter = sy-tabix.&lt;/P&gt;&lt;P&gt;modify itab.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now use&lt;/P&gt;&lt;P&gt;insert dbtab from table itab ....&lt;/P&gt;&lt;P&gt;accepting duplicate keys will not insert any duplicate key. it is the way to avoid runtime error if you are trying to insert the duplicate key in database table.&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;shiba dutta&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2007 04:50:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915556#M686341</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-11T04:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: Updating database table with DUPLICATE keys</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915557#M686342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your kind help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now my problem is solved...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Naren, Loads of thanks for your sample code.&lt;/P&gt;&lt;P&gt;The counter logic Rocks now in my Table...!!!!   &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Pavan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2007 05:26:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915557#M686342</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-11T05:26:34Z</dc:date>
    </item>
    <item>
      <title>Re: Updating database table with DUPLICATE keys</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915558#M686343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are most welcome..:-)&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, 11 Oct 2007 05:27:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-database-table-with-duplicate-keys/m-p/2915558#M686343</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-11T05:27:42Z</dc:date>
    </item>
  </channel>
</rss>

