Skip to Content
0

FOR ALL ENTRIES ISSUE

Aug 24, 2017 at 12:17 PM

57

avatar image

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)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Surbjeet Dhillon Aug 24, 2017 at 12:29 PM
4

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.

Show 1 Share
10 |10000 characters needed characters left 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

0