SAP DEMO UNION RANGES ABEXA



Get Example source ABAP code based on a different SAP table
  



SELECT, Union for Building a Ranges Table
This example demonstrates how a ranges table is built using unions.

ABAP_SOURCE_CODE
DEMO CL_DEMO_UNION_RANGES

ABAP_DESCRIPTION
The aim of this example is to create a list of all ABAP programs in a package. The names of the ABAP programs are in the DDIC database table TRDIR and the assignment of repository objects to a package is specified in the DDIC database table TADIR. In the case of function pools and class pools from the table TADIR, the names of the associated master programs and include programs must be found in the table TRDIR. This can be done by evaluating the naming conventions. In the example shown here, a ranges table is constructed for use in a WHERE clause. The method get_prog_ranges fills the ranges table in a single AB-SQL statement using UNION statements. The entire ranges table is filled on the database. In a test class, the test method test_union contains an alternative implementation in which the ranges tables is constructed from the results of four individual SELECT statements in the ABAP program and in which ABAP expressions are used instead of SQL expressions.