Skip to content

ABAP Keyword Documentation →  ABAP Dictionary →  ABAP CDS in ABAP Dictionary →  ABAP CDS - Views →  ABAP CDS - DDL Statements →  ABAP CDS - DEFINE VIEW →  ABAP CDS - SELECT →  ABAP CDS- SELECT, clauses 


Other versions: 7.31 | 7.40 | 7.54


... UNION [ALL] select_statement ...


Creates the union of rows in the results sets of two SELECT statements of a CDS view in ABAP CDS. A prerequisite is that the structures of the results sets are compatible. This means that the results sets must have the same number of elements and that the pairs of elements in each position have a compatible data type. The element names of the results sets do not need to match.

A union results set can itself be the left side of a further union. The properties of the union results set are defined as follows:

  • The element names are taken either from an explicitly specified name list or, if no list is specified, from the SELECT list of the first SELECT statement.
  • The definition of the key elements is taken from the SELECT list of the first SELECT statement.
  • The data type of each element is a data type from ABAP Dictionary whose value range covers the data types of the associated columns of all results sets involved.
  • If the addition ALL, is not specified, all duplicate entries are removed from the results set. They are not removed if ALL is specified.

In CDS views where UNION is used to create union sets, no associations can be defined in SELECT statements.


  • Union sets can be a good way of transforming non-standardized database tables into a standardized view of the data.

  • A CDS view with union sets cannot be expanded using EXTEND VIEW.