1

I know how to use range tables with SELECTs.
However, is it possible to use it in a LOOP's WHERE condition?
If not, is there a workaround?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
András
  • 1,326
  • 4
  • 16
  • 26
  • It is the same syntax: LOOP AT ... WHERE field IN range... or do I miss something? – József Szikszai Sep 21 '18 at 12:24
  • I wonder how one could improve the ABAP documentation so that people can find the answers themselves ([here](https://help.sap.com/http.svc/rc/abapdocu_752_index_htm/7.52/en-US/index.htm?file=abenlogexp_comp.htm)) – Sandra Rossi Sep 21 '18 at 12:42
  • @JozsefSzikszai, I knew it does not work with READ TABLE, I knew it worked with SELECT, and the documentation only talked about SELECTs – András Sep 21 '18 at 12:58
  • @JozsefSzikszai, mind making this an answer? – Florian Sep 21 '18 at 13:20
  • 1
    @SandraRossi Agree. The documentation is perceived as precise but overly academic. In this example, the user needs to F1: LOOP > LOOP AT itab - Basic Form > [cond] > WHERE logexp > and then without direct link on to > rel_exp - Comparison Expressions where he will find "operand [NOT] IN seltab. This is a 5 hop navigation that - although correct - is not intuitive. – Florian Sep 21 '18 at 13:26
  • 1
    @Florian: "The documentation is perceived as precise but overly academic." may be you can mention this to Horst Keller... :) – József Szikszai Sep 21 '18 at 13:28
  • 1
    @Florian overly academic and not intuitive, that's a good abstract – Sandra Rossi Sep 21 '18 at 15:53
  • @JozsefSziksai Horst probably knows that, it's probably very difficult and long to reorganize this huge amount of documentation - It would be interesting to propose him another solution, maybe it's why nobody tried yet :) (AFAIK) – Sandra Rossi Sep 21 '18 at 15:53
  • 1
    One way to know if it works is trying, for me the question has implicitly the answer. – Nelson Miranda Sep 21 '18 at 21:08

1 Answers1

5

The syntax is the same like by SELECTs:

LOOP AT ...
     INTO|ASSIGNING ...
     WHERE field IN range.
  ...
ENDLOOP.
József Szikszai
  • 4,791
  • 3
  • 14
  • 24