<?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: Upload all data into custom table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/upload-all-data-into-custom-table/m-p/8225218#M1628536</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Shiva,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for the reply, the only reason I have created this table without primary key is, there is going to be lot of dulplicate records. So keeping that in mind if i create table with Primary key I can't create duplicate records in table.&lt;/P&gt;&lt;P&gt;Correct me if i am wrong or please tell me if there is another way to where I create one primary key in table and also able to populate duplicate records in table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;SB&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 23 Sep 2011 02:23:41 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-09-23T02:23:41Z</dc:date>
    <item>
      <title>Upload all data into custom table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/upload-all-data-into-custom-table/m-p/8225216#M1628534</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 see my code below, I am trying to upload data into custom table &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note : &lt;STRONG&gt;My custom table has 5 fields and MANDT is only primary Key&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I learned if there is no primary key other than MANDT you always will have one entry in table. Correct me if i am wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Keeping all in mind is there a way (using below code and MANDT is only field as primary key) I can upload all the data into table including duplicates?&lt;/STRONG&gt;  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : IT_RECORD_IN      TYPE TABLE OF zPHY_INV_HIS.&lt;/P&gt;&lt;P&gt;DATA : FILENAME          TYPE STRING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN BEGIN OF BLOCK  BLKONE WITH FRAME TITLE TEXT-A01.&lt;/P&gt;&lt;P&gt;PARAMETERS: PATHNAME(80) DEFAULT 'C:\abc.CSV' OBLIGATORY.&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN END   OF BLOCK BLKONE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FILENAME = PATHNAME.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'GUI_UPLOAD'&lt;/P&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;P&gt;    FILENAME                = filename&lt;/P&gt;&lt;P&gt;    FILETYPE                = 'ASC'&lt;/P&gt;&lt;P&gt;    HAS_FIELD_SEPARATOR     = 'X'&lt;/P&gt;&lt;P&gt;  TABLES&lt;/P&gt;&lt;P&gt;    DATA_TAB                = IT_RECORD_IN&lt;/P&gt;&lt;P&gt;  EXCEPTIONS&lt;/P&gt;&lt;P&gt;    FILE_OPEN_ERROR         = 1&lt;/P&gt;&lt;P&gt;    FILE_READ_ERROR         = 2&lt;/P&gt;&lt;P&gt;    NO_BATCH                = 3&lt;/P&gt;&lt;P&gt;    GUI_REFUSE_FILETRANSFER = 4&lt;/P&gt;&lt;P&gt;    INVALID_TYPE            = 5&lt;/P&gt;&lt;P&gt;    NO_AUTHORITY            = 6&lt;/P&gt;&lt;P&gt;    UNKNOWN_ERROR           = 7&lt;/P&gt;&lt;P&gt;    BAD_DATA_FORMAT         = 8&lt;/P&gt;&lt;P&gt;    HEADER_NOT_ALLOWED      = 9&lt;/P&gt;&lt;P&gt;    SEPARATOR_NOT_ALLOWED   = 10&lt;/P&gt;&lt;P&gt;    HEADER_TOO_LONG         = 11&lt;/P&gt;&lt;P&gt;    UNKNOWN_DP_ERROR        = 12&lt;/P&gt;&lt;P&gt;    ACCESS_DENIED           = 13&lt;/P&gt;&lt;P&gt;    DP_OUT_OF_MEMORY        = 14&lt;/P&gt;&lt;P&gt;    DISK_FULL               = 15&lt;/P&gt;&lt;P&gt;    DP_TIMEOUT              = 16&lt;/P&gt;&lt;P&gt;    OTHERS                  = 17.&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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; MODIFY zPHY_INV_HIS FROM TABLE IT_RECORD_IN.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; UPDATE zPHY_INV_HIS FROM TABLE IT_RECORD_IN.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; INSERT zPHY_INV_HIS FROM TABLE IT_RECORD_IN.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;INSERT zPHY_INV_HIS FROM TABLE IT_RECORD_IN ACCEPTING DUPLICATE KEYS.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2011 23:31:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/upload-all-data-into-custom-table/m-p/8225216#M1628534</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-22T23:31:56Z</dc:date>
    </item>
    <item>
      <title>Re: Upload all data into custom table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/upload-all-data-into-custom-table/m-p/8225217#M1628535</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;If there is no primary key except MANDT, then system will hold the last record. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Even if you try to create a TMG, that is also will not be possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So you need to have at least a single primary key in table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Interesting answers for your query|&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1516661"&gt;&lt;/A&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Shiva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2011 23:57:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/upload-all-data-into-custom-table/m-p/8225217#M1628535</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-22T23:57:23Z</dc:date>
    </item>
    <item>
      <title>Re: Upload all data into custom table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/upload-all-data-into-custom-table/m-p/8225218#M1628536</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Shiva,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for the reply, the only reason I have created this table without primary key is, there is going to be lot of dulplicate records. So keeping that in mind if i create table with Primary key I can't create duplicate records in table.&lt;/P&gt;&lt;P&gt;Correct me if i am wrong or please tell me if there is another way to where I create one primary key in table and also able to populate duplicate records in table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;SB&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2011 02:23:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/upload-all-data-into-custom-table/m-p/8225218#M1628536</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-23T02:23:41Z</dc:date>
    </item>
    <item>
      <title>Re: Upload all data into custom table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/upload-all-data-into-custom-table/m-p/8225219#M1628537</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;There will be a different value in any of the field, so try make as many fields as  primary keys. No other options as per my understanding.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Shiva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2011 02:27:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/upload-all-data-into-custom-table/m-p/8225219#M1628537</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-23T02:27:01Z</dc:date>
    </item>
    <item>
      <title>Re: Upload all data into custom table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/upload-all-data-into-custom-table/m-p/8225220#M1628538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sarath,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can achieve your requirement thru this way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;add one more field which will be the primary key. So what is this field? this is a field which is a counting number. So the modified structure of your table would look like this&lt;/P&gt;&lt;P&gt;MANDT&lt;/P&gt;&lt;P&gt;PID (primary ID)&lt;/P&gt;&lt;P&gt;FIELD1&lt;/P&gt;&lt;P&gt;FIELD2&lt;/P&gt;&lt;P&gt;FIELD3&lt;/P&gt;&lt;P&gt;FIELD4&lt;/P&gt;&lt;P&gt;FIELD5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As I said, your PID field will be a continuos counting number, like 1, 2 , 3 etc.... In this manner, you will differentiate between records even they are duplicates (but not their primary key). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps. Cheers &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2011 02:47:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/upload-all-data-into-custom-table/m-p/8225220#M1628538</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-23T02:47:02Z</dc:date>
    </item>
    <item>
      <title>Re: Upload all data into custom table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/upload-all-data-into-custom-table/m-p/8225221#M1628539</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;MANDT is always added as one of the fields to make the table client specific and it has to be a primary key. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As rest of your fields are non-primary key fields, your table will have duplicate records for all the fields. You shall not get any error even if you enter duplicate entries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a general practice, it is always good to have at least one primary key on a a table apart from MANDT. This ensures faster data access and provides uniqueness for each record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, if your table does not have at least one primary key apart from MANDT, you shall not be able to maintain the table via SM30 even if you create a Table Maintanence.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Danish.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2011 06:08:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/upload-all-data-into-custom-table/m-p/8225221#M1628539</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-23T06:08:52Z</dc:date>
    </item>
    <item>
      <title>Re: Upload all data into custom table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/upload-all-data-into-custom-table/m-p/8225222#M1628540</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, 18 Mar 2012 11:49:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/upload-all-data-into-custom-table/m-p/8225222#M1628540</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-03-18T11:49:18Z</dc:date>
    </item>
  </channel>
</rss>

