<?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: Fill database table from internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/fill-database-table-from-internal-table/m-p/6009989#M1345798</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; thanks for ur helpfull reply&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Ya u r right..My field is cost center is key field..&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You mean to say that you have only one &lt;STRONG&gt;Key Field&lt;/STRONG&gt; Which is &lt;STRONG&gt;Cost Center&lt;/STRONG&gt; if yes than you must Add some more &lt;STRONG&gt;Key Field&lt;/STRONG&gt; according to your Requirements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Remember that the combination of all Key Fields Must be Unique&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Faisal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 22 Aug 2009 16:24:42 GMT</pubDate>
    <dc:creator>faisalatsap</dc:creator>
    <dc:date>2009-08-22T16:24:42Z</dc:date>
    <item>
      <title>Fill database table from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fill-database-table-from-internal-table/m-p/6009985#M1345794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I made one table ZDISP_CHDOC_CC and want to fill that table from internal table.and i got runtime error. that duplicate entry&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and two entry are like 10 200000    likhp 10&lt;/P&gt;&lt;P&gt;                                    10 200000    likp   10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DESCRIBE TABLE IT_CHDOC .&lt;/P&gt;&lt;P&gt;    LOOP AT IT_CHDOC.&lt;/P&gt;&lt;P&gt;    INSERT ZDISP_CHDOC_CC FROM  IT_CHDOC.&lt;/P&gt;&lt;P&gt;    endloop.&lt;/P&gt;&lt;P&gt;    IF SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;      COMMIT WORK.&lt;/P&gt;&lt;P&gt;    ELSE.&lt;/P&gt;&lt;P&gt;and when i used following then only one entry is insreted.&lt;/P&gt;&lt;P&gt;DESCRIBE TABLE IT_CHDOC .&lt;/P&gt;&lt;P&gt;    LOOP AT IT_CHDOC.&lt;/P&gt;&lt;P&gt;    INSERT ZDISP_CHDOC_CC FROM  IT_CHDOC.&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt;    IF SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;      COMMIT WORK.&lt;/P&gt;&lt;P&gt; endloop.&lt;/P&gt;&lt;P&gt;    ELSE.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Aug 2009 12:33:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fill-database-table-from-internal-table/m-p/6009985#M1345794</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-22T12:33:42Z</dc:date>
    </item>
    <item>
      <title>Re: Fill database table from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fill-database-table-from-internal-table/m-p/6009986#M1345795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Kjain&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please Check for you table Key Fields i think you are trying to &lt;STRONG&gt;INSERT&lt;/STRONG&gt; the Duplicate records mean with the same Key Fields Values for both Records,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So it is giving message, Check and Reply if any Else Issue,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Faisal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Aug 2009 13:02:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fill-database-table-from-internal-table/m-p/6009986#M1345795</guid>
      <dc:creator>faisalatsap</dc:creator>
      <dc:date>2009-08-22T13:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: Fill database table from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fill-database-table-from-internal-table/m-p/6009987#M1345796</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;Please check the key fields of your table. I think the fields representing 10 and 200000 are your key fields. &lt;/P&gt;&lt;P&gt;It is not possible to use the same set of key fields in a table. Since you are providing redundant data you end up in error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first case gives you a run time error, because you are checking the value of sy-subrc at the end of all inserts and committing your job. This checks only for the last row of the internal table and inserts all the rows and was not able to &lt;/P&gt;&lt;P&gt;do so, as there was a duplicate entry.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Whereas the second case checks each and every INSERT inside the loop. Sy-subrc will not be 0 when the duplicate entry is encountered and hence that was not inserted to the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Sharmila&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Aug 2009 13:42:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fill-database-table-from-internal-table/m-p/6009987#M1345796</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-22T13:42:32Z</dc:date>
    </item>
    <item>
      <title>Re: Fill database table from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fill-database-table-from-internal-table/m-p/6009988#M1345797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks for ur helpfull reply&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ya u r right..My field is cost center is key field..in my ztable but i want to insert both record.because two and more filed are different in each row except cost center.so please give me solution&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: priyank kjain on Aug 22, 2009 6:20 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Aug 2009 16:19:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fill-database-table-from-internal-table/m-p/6009988#M1345797</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-22T16:19:20Z</dc:date>
    </item>
    <item>
      <title>Re: Fill database table from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fill-database-table-from-internal-table/m-p/6009989#M1345798</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; thanks for ur helpfull reply&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Ya u r right..My field is cost center is key field..&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You mean to say that you have only one &lt;STRONG&gt;Key Field&lt;/STRONG&gt; Which is &lt;STRONG&gt;Cost Center&lt;/STRONG&gt; if yes than you must Add some more &lt;STRONG&gt;Key Field&lt;/STRONG&gt; according to your Requirements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Remember that the combination of all Key Fields Must be Unique&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Faisal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Aug 2009 16:24:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fill-database-table-from-internal-table/m-p/6009989#M1345798</guid>
      <dc:creator>faisalatsap</dc:creator>
      <dc:date>2009-08-22T16:24:42Z</dc:date>
    </item>
    <item>
      <title>Re: Fill database table from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fill-database-table-from-internal-table/m-p/6009990#M1345799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This message was moderated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 23 Aug 2009 10:25:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fill-database-table-from-internal-table/m-p/6009990#M1345799</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-23T10:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: Fill database table from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fill-database-table-from-internal-table/m-p/6009991#M1345800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;in a database table there cant be tow entries with same primary key(s).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so first in addition to profit center add one more field as primary key,say line number or any field which you know that could make combination for primary key.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 23 Aug 2009 19:53:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fill-database-table-from-internal-table/m-p/6009991#M1345800</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-23T19:53:54Z</dc:date>
    </item>
    <item>
      <title>Re: Fill database table from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fill-database-table-from-internal-table/m-p/6009992#M1345801</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;Replace your current code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DESCRIBE TABLE IT_CHDOC .
LOOP AT IT_CHDOC.
INSERT ZDISP_CHDOC_CC FROM IT_CHDOC.
endloop.
IF SY-SUBRC = 0.
COMMIT WORK.
ELSE.&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;WITH THE ONE GIVEN BELOW&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DESCRIBE TABLE IT_CHDOC .
INSERT ZDISP_CHDOC_CC FROM TABLE IT_CHDOC ACCEPTING DUPLICATE KEYS.
IF SY-SUBRC = 0.
COMMIT WORK.
ELSE.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Siddarth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 23 Aug 2009 22:51:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fill-database-table-from-internal-table/m-p/6009992#M1345801</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-23T22:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: Fill database table from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fill-database-table-from-internal-table/m-p/6009993#M1345802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi priyank,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the data already exists in the db table then u go for update n u need to give the primary key wher u want it to update the kna1 table..&lt;/P&gt;&lt;P&gt;ellse u need to use INsert...&lt;/P&gt;&lt;P&gt;what error r u getting exactly...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use the abap code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT ITAB INTO WA.
MODIFY ZTABLE FROM WA.
IF SY-SUBRC NE 0.
Move wa to wa1.
append itab1 from wa1.
endif.
clear wa.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Thanks &amp;amp; Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Saurabh Goel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2009 05:43:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fill-database-table-from-internal-table/m-p/6009993#M1345802</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-24T05:43:34Z</dc:date>
    </item>
    <item>
      <title>Re: Fill database table from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fill-database-table-from-internal-table/m-p/6009994#M1345803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi thanks for ur soluction. i have one more problem. supose I run my program then it will inserted all data into custom table with respect to select condition . again i run with same condition then it willl go in dump. i want it will check in custom table and after give the message that 'Record is Already inserted'.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2009 13:17:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fill-database-table-from-internal-table/m-p/6009994#M1345803</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-24T13:17:10Z</dc:date>
    </item>
    <item>
      <title>Re: Fill database table from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fill-database-table-from-internal-table/m-p/6009995#M1345804</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;for that situation you can do it this way....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DESCRIBE TABLE IT_CHDOC .
LOOP AT IT_CHDOC.
  SELECT * FROM ZDISP_CHDOC_CC INTO IT_CHDOC
         WHERE KEY_FIELD1 = IT_CHDOC-KEYFIELD1 
             AND KEY_FIELD2 = IT_CHDOC-KEYFIELD2 
             "AND SO ON... IF THERE ARE MORE THAN ONE KEYFIELDS IN THE CUSTOM TABLE
.
IF SY-SUBRC = 0.
  WRITE : / IT_CHDOC-KEYFIELD, ' Already Exists'.
ELSE.
  INSERT ZDISP_CHDOC_CC FROM IT_CHDOC.
ENDIF.
ENDLOOP.
COMMIT WORK.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REGARDS,&lt;/P&gt;&lt;P&gt;Siddarth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Aug 2009 05:16:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fill-database-table-from-internal-table/m-p/6009995#M1345804</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-25T05:16:46Z</dc:date>
    </item>
  </channel>
</rss>

