Skip to Content
0
Former Member
Apr 25, 2007 at 02:48 PM

UNION statement in ABAP SQL

667 Views

Hi,

How to achieve the UNION SQL operation results in ABAP? To be specific, I want to retrieve STCD1 field value from vendor master table (LFA1) for all vendors (LIFNR) that exist in table BSIK or BSAK.

And I want to achieve the results in single SQL statement. So in essence, the resultant SQL would be something like:

SELECT STCD1

INTO TABLE my_internal_table

FROM LFA1

WHERE LIFNR IN (SELECT DISTINCT LIFNR

FROM BSIK

UNION

SELECT DISTINCT LIFNR

FROM BSAK)

But the UNION is not a valid keyword in ABAP. Any idea how to achieve this?

Regards,

Chetan