Get Example source ABAP code based on a different SAP table
SELECT>, Union with Aggregate Expression This example demonstrates how a union is created across a table using an aggregate expression.
ABAP_SOURCE_CODE DEMO CL_DEMO_SELECT_UNION_SUM
ABAP_DESCRIPTION UNION>> is used to create the union of the result sets of two SELECT> statements for the same DDIC database table. The first SELECT> statement reads all flights for a carrier and the second SELECT> statement aggregates the flights by connection , adding the number of occupied seats. A CAST> expression> is used to insert a column for the flight date fldate > from the first result set with a suitable data type in the second result set. A comment indicates how this is also possible using a host expression> in this case. A further column mark> is filled with literals to make realistic sorts possible. The entire result contains the aggregated rows located below the associated rows of the first result set and are flagged with X>.