<?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: Select query without distinct bugs, duplicate data removed in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-without-distinct-bugs-duplicate-data-removed/m-p/12789955#M2024252</link>
    <description>&lt;P&gt;Basically &lt;A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/abenwhere_all_entries.htm"&gt;FOR ALL ENTRIES&lt;/A&gt; will remove duplicates entries from the result set.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;To keep every record you could add the primary keys to the SELECT clause (as you did in the second try, field TAPOS was added) so add TAPOS in your first SELECT&lt;/LI&gt;&lt;/UL&gt;</description>
    <pubDate>Mon, 30 Oct 2023 10:30:33 GMT</pubDate>
    <dc:creator>RaymondGiuseppi</dc:creator>
    <dc:date>2023-10-30T10:30:33Z</dc:date>
    <item>
      <title>Select query without distinct bugs, duplicate data removed</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-without-distinct-bugs-duplicate-data-removed/m-p/12789954#M2024251</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
  &lt;P&gt;I was wondering If such case ever happened for others. &lt;/P&gt;
  &lt;P&gt;So in my Production server, I am using this syntax below, but it cause weird bugs, where there should be 5 lines of data ( where 3 lines have batch A, and 2 lines have batch B ), but somehow, it remove the duplicate row, so my data only consist of 2 row ( 1 line of batch A, 1 line of batch B ), as if there is hidden DISTINCT word.&lt;/P&gt;
  &lt;P&gt; Based on my debug analysis, all 5 rows are in same TANUM, same NLPLA, and also the VISTM or NISTM has value. When I tried on SE16N, it fetch 5 rows of data correctly.&lt;/P&gt;
  &lt;P&gt;Might there be some hidden query configuration or report configuration? &lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;DATA : li_group TYPE TABLE OF gt_group.

SELECT a~matnr a~werks a~charg a~meins a~nistm
      a~lgnum a~tanum
      FROM ltap AS a
      INTO CORRESPONDING FIELDS OF TABLE li_group
      FOR ALL ENTRIES IN gi_ltak
      WHERE a~lgnum = gi_ltak-lgnum AND
            a~tanum = gi_ltak-tanum AND
            a~nltyp = '200' AND
            a~nlpla = p_sammg AND
            ( ( a~vistm &amp;lt;&amp;gt; 0 ) OR ( a~nistm &amp;lt;&amp;gt; 0 ) ).&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;But in my newest select query, it show the correct rows too.&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;SELECT lgnum tanum tapos matnr werks charg meins nistm
      FROM ltap
      INTO CORRESPONDING FIELDS OF TABLE li_group
      FOR ALL ENTRIES IN gi_ltak
      WHERE lgnum = gi_ltak-lgnum
        AND tanum = gi_ltak-tanum
        AND nltyp = '200'
        AND nlpla = p_sammg
        AND nistm GT 0.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;Might it actually caused by the WHERE ( ( vistm &amp;lt;&amp;gt; 0 ) OR ( nistm &amp;lt;&amp;gt; 0 ) ) condition? I felt like the where condition should be true though.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2023 10:15:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-without-distinct-bugs-duplicate-data-removed/m-p/12789954#M2024251</guid>
      <dc:creator>xiswanto</dc:creator>
      <dc:date>2023-10-30T10:15:15Z</dc:date>
    </item>
    <item>
      <title>Re: Select query without distinct bugs, duplicate data removed</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-without-distinct-bugs-duplicate-data-removed/m-p/12789955#M2024252</link>
      <description>&lt;P&gt;Basically &lt;A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/abenwhere_all_entries.htm"&gt;FOR ALL ENTRIES&lt;/A&gt; will remove duplicates entries from the result set.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;To keep every record you could add the primary keys to the SELECT clause (as you did in the second try, field TAPOS was added) so add TAPOS in your first SELECT&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Mon, 30 Oct 2023 10:30:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-without-distinct-bugs-duplicate-data-removed/m-p/12789955#M2024252</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2023-10-30T10:30:33Z</dc:date>
    </item>
    <item>
      <title>Re: Select query without distinct bugs, duplicate data removed</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-without-distinct-bugs-duplicate-data-removed/m-p/12789956#M2024253</link>
      <description>&lt;P&gt;Huh, I never thought it would affect that way, since I don't use the TAPOS field, thats why. thanks anyway.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2023 11:00:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-without-distinct-bugs-duplicate-data-removed/m-p/12789956#M2024253</guid>
      <dc:creator>xiswanto</dc:creator>
      <dc:date>2023-10-30T11:00:10Z</dc:date>
    </item>
  </channel>
</rss>

