<?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: Internal table non-unique key consequences in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-non-unique-key-consequences/m-p/4648702#M1094007</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It just occured to me, that it cannot add duplicated records since the "Move-corresponding new_data to i_tab" is followed by a &lt;STRONG&gt;modify&lt;/STRONG&gt; i_tab statement and not a &lt;STRONG&gt;append&lt;/STRONG&gt; i_tab statement - is that correct?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 Oct 2008 13:16:44 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-10-21T13:16:44Z</dc:date>
    <item>
      <title>Internal table non-unique key consequences</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-non-unique-key-consequences/m-p/4648698#M1094003</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a i_tab which is defined as follows:&lt;/P&gt;&lt;P&gt;      &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;i_tab TYPE STANDARD TABLE OF TAB_STRUCTURE
       WITH HEADER LINE
       WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TAB_STRUCTURE is defined as follows:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPES:
  BEGIN OF TAB_STRUCTURE.
        INCLUDE STRUCTURE /BIC/CS8ZPURVEN5.
TYPES:
     cnfqty like /bic/azpurcscg00-cnfqty,
  END OF TAB_STRUCTURE.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then the i_tab is filled and loop at. In the loop is a read on the new_data itab performed. If the read is successfull is a "Move-corresponding new_data to i_tab" performed. Will this cause double data in the i_tab (will the same line be present twice in i_tab after the "Move-corresponding new_data to i_tab"?)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;clear i_tab.
        refresh i_tab.
* Find key from active table.
        SELECT * FROM
        /bic/azpurcscg00
        WHERE oi_ebeln EQ DATA_PACKAGE-doc_num AND
              oi_ebelp EQ DATA_PACKAGE-doc_item AND
              sched_line EQ DATA_PACKAGE-sched_line.
          MOVE-CORRESPONDING /bic/azpurcscg00 to i_tab.
          MOVE /bic/azpurcscg00-oi_ebeln to i_tab-doc_num.
          MOVE /bic/azpurcscg00-oi_ebelp to i_tab-doc_item.
          APPEND i_tab.
        ENDSELECT.
        SORT i_tab BY doc_num doc_item sched_line conf_line.
* Find key from new table.
        LOOP at i_tab.
          READ TABLE NEW_DATA WITH KEY
                        oi_ebeln = DATA_PACKAGE-doc_num
                        oi_ebelp = DATA_PACKAGE-doc_item
                        sched_line = DATA_PACKAGE-sched_line
                        conf_line = i_tab-conf_line
                        BINARY SEARCH.
          IF sy-subrc = 0.
            Move-corresponding new_data to i_tab. &amp;lt;--------------------------------------------
            modify i_tab.
          ENDIF.
        ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot in advance and kind regards,&lt;/P&gt;&lt;P&gt;Torben&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Oct 2008 12:48:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-non-unique-key-consequences/m-p/4648698#M1094003</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-21T12:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table non-unique key consequences</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-non-unique-key-consequences/m-p/4648699#M1094004</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The UNIQUE or NON-UNIQUE determine whether the key is to be unique or non-unique, that is, whether the table can accept duplicate entries. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If we are not specifying the key then table type is generic &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; a®&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Oct 2008 12:57:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-non-unique-key-consequences/m-p/4648699#M1094004</guid>
      <dc:creator>former_member194669</dc:creator>
      <dc:date>2008-10-21T12:57:16Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table non-unique key consequences</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-non-unique-key-consequences/m-p/4648700#M1094005</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;Thanks for your reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes I'm aware of that, but what I do not know is if the line "Move-corresponding new_data to i_tab" in the code I posted can cause duplicate records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Torben&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDIT: Arh, I guess it cannot add duplicated records since the "Move-corresponding new_data to i_tab" is followed by a modify i_tab statement and not a append i_tab statement - correct?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Torben Pedersen on Oct 21, 2008 3:09 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Oct 2008 13:02:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-non-unique-key-consequences/m-p/4648700#M1094005</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-21T13:02:23Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table non-unique key consequences</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-non-unique-key-consequences/m-p/4648701#M1094006</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, Your sy-subrc = 0 (after read) and table i_tab have NON_UNIQUE will create duplicate entries&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a®&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Oct 2008 13:09:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-non-unique-key-consequences/m-p/4648701#M1094006</guid>
      <dc:creator>former_member194669</dc:creator>
      <dc:date>2008-10-21T13:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table non-unique key consequences</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-non-unique-key-consequences/m-p/4648702#M1094007</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It just occured to me, that it cannot add duplicated records since the "Move-corresponding new_data to i_tab" is followed by a &lt;STRONG&gt;modify&lt;/STRONG&gt; i_tab statement and not a &lt;STRONG&gt;append&lt;/STRONG&gt; i_tab statement - is that correct?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Oct 2008 13:16:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-non-unique-key-consequences/m-p/4648702#M1094007</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-21T13:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table non-unique key consequences</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-non-unique-key-consequences/m-p/4648703#M1094008</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try to change this way&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP at i_tab.
v_tabix = sy-tabix
          READ TABLE NEW_DATA WITH KEY
                        oi_ebeln = DATA_PACKAGE-doc_num
                        oi_ebelp = DATA_PACKAGE-doc_item
                        sched_line = DATA_PACKAGE-sched_line
                        conf_line = i_tab-conf_line
                        BINARY SEARCH.
          IF sy-subrc = 0.
            Move-corresponding new_data to i_tab. 
" Here after the read your sy-tabix value get changed so use v_tabix instead of sy-tabix
            modify i_tab index v_tabix " .
          ENDIF.
        ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;a®&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Oct 2008 13:29:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-non-unique-key-consequences/m-p/4648703#M1094008</guid>
      <dc:creator>former_member194669</dc:creator>
      <dc:date>2008-10-21T13:29:11Z</dc:date>
    </item>
  </channel>
</rss>

