Supported by
Supported by Inetum

SELECT comparing 2 fields of the same table

images/thumbnail.jpg - Thumbnail

This tip is simple and quick, but I bet 200.482 Portuguese escudos that few know it.

How to use fields of the table being selected to filter the selection results:

DATA: cnt TYPE i.

SELECT COUNT( * )
       FROM kna1
       INTO cnt
       WHERE telf1 = kna1~telfx.

WRITE cnt.

In this SELECT we obtain all the customers whose fax number is the same as their phone number.

Did you know this? Had you already done this?

Thanks to Rui Pina for the tip.

And thanks to Kendra for the photo .

Greetings from Abapinho.