title: Using FOR ALL ENTRIES for validation multiple lines
body: <p>I have a question concerning the <strong>For all Entries</strong> statement in ABAP.
  I know that it functions like a <strong>Select Distinct</strong> and deletes duplicate entries.</p>
  <p>In my case, I want to write a validation for table inputs. As you can enter more than one line, I have to check every single one of them.
  <em>Loop with Select</em> is not an Option. The alternative is <strong>For all Entries</strong>. Sadly if f.e. the same company code needs to be validated, FoE just gives back one entry. So I have no chance to identify where the error was (if there is one).</p>
  <p>Here is the Code for the validation:</p>
  <pre><code>  LOOP AT extract.
      IF &lt;xact&gt; NE empty.
        READ TABLE total WITH KEY &lt;vim_xextract_key&gt;.
        IF sy-subcs EQ 0.
          MOVE &lt;vim_total_struc&gt; TO ls_y.
          APPEND ls_y TO lt_y.
        ENDIF.
      ENDIF.
    ENDLOOP.
  
  
    SELECT bukrs
    FROM t001
    FOR ALL ENTRIES IN @lt_y 
    WHERE bukrs = @lt_y-bukrs
    INTO TABLE @DATA(lt_check_bukrs).
  
  IF lt_check_bukrs IS INITIAL.
      MESSAGE 'Error in company code' TYPE 'S' DISPLAY LIKE 'E'.
      vim_abort_saving = abap_true.
    ENDIF.
  </code></pre>
  <p>Maybe one of you has an approach or an idea.
  Thank you for all answers!</p>