Using SubQueries in ABAP

Sometimes you just want to know whether some records in a secondary table exist or not. You don‘t need their actual content.
This is where Subqueries come in handy:

Are there any rows in the SFLIGHT table without a corresponding entry in table SPFLI?

SELECT carrid connid
INTO (xcarrid, xconnid)
FROM sflight AS f
WHERE NOT EXISTS ( SELECT * FROM spfli
WHERE carrid = f~carrid
AND connid = f~connid ).
Comments