Skip to Content

FOR ALL ENTRIES ISSUE

Hi,

I have a problem in a query with the statment FOR ALL ENTRIES.

The internal table PT_POSITIONS has some entries which were sorted by MATNR previously. The problem is that I don't get the same entries using for all entries than using a range with the MATNRs that I have in the internal table, so the problem is with the FOR ALL ENTRIES statment.

Any idea?

Thanks for your time!

s.jpg (27.8 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Aug 24, 2017 at 12:29 PM

    Well For All Entries will drop duplicate rows before returning results. For more help you will have to share what you have in PT_POSITIONS and the range table.

    Add comment
    10|10000 characters needed characters exceeded

    • Hello,

      As Che suggest, try something like this :

      TYPES : BEGIN OF tt_matnr,
        matnr TYPE PT_POSITIONS-MATNR,
        END OF  tt_matnr.
      DATA t_matnr TYPE HASHED TABLE OF tt_matnr WITH UNIQUE DEFAULT KEY. " Unique key will do the trick
      DATA wl_matnr LIKE LINE OF t_matnr.
      FIELD-SYMBOLS <positions> LIKE LINE OF pt_positions.
      
      CLEAR t_matnr.
      LOOP AT pt_positions ASSIGNING <positions> .
        wl_matnr-matnr = <positions>-matnr.
        INSERT wl_matnr INTO TABLE t_matnr.
      ENDLOOP.
      
      CHECK t_matnr is not initial.
      SELECT [...] FOR ALL ENTRIES IN t_matnr
        WHERE matnr =  t_matnr-matnr
      [...].
      
      

      Best regards

      Bertrand