Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

FOR ALL ENTRIES ISSUE

adrian_mejido
Contributor
0 Kudos

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!

1 ACCEPTED SOLUTION

che_eky
Active Contributor

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.

2 REPLIES 2

che_eky
Active Contributor

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.

0 Kudos

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