title: Show duplicates in internal table
body: <p>Each an every item should have an uniquie SecondNo + Drawing combination. Due to misentries, some combinations are there two times.</p>
  
  <p>I need to create a report with ABAP which identifies those combinations and does not reflect the others.</p>
  
  <pre><code>Item:  SecNo: Drawing:
  121       904      5000         double
  122       904      5000         double
  123       816      5100
  124       813      5200
  125       812      4900          double
  126       812      4900          double
  127       814      5300
  </code></pre>
  
  <p>How can I solve this? I tried 2 approaches and failed:</p>
  
  <ol>
  <li><p>Sorting the data and tried to print out each one when the value of the upper row is equal to the next value</p></li>
  <li><p>counting the duplicates and showing all of them which are more then one.</p></li>
  </ol>
  
  <p>Where do I put in the condition? in the loop area?</p>
  
  <p>I tried this:</p>
  
  <pre><code>REPORT  duplicates.
  
  DATA: BEGIN OF lt_duplicates OCCURS 0,
          f2(10),
          f3(10),
        END OF lt_duplicates,
        it_test TYPE TABLE OF ztest WITH HEADER LINE,
        i       TYPE i.
  
  SELECT DISTINCT f2 f3 FROM ztest INTO TABLE lt_duplicates.
  
  LOOP AT lt_duplicates.
  
    IF f2 = lt_duplicates-f2 AND f3 = lt_duplicates-f3.
    ENDIF.
  
    i = LINES( it_test ).
  
    IF i &gt; 1.
      LOOP AT it_test.
        WRITE :/ it_test-f1,it_test-f2,it_test-f3.
      ENDLOOP.
    ENDIF.
  
  ENDLOOP.
  </code></pre>