Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing External Data →  ABAP Database Access →  ABAP SQL →  ABAP SQL - Reads →  SELECT clauses →  SELECT - FROM →  SELECT - FROM data_source 

SELECT - FROM hierarchy_data

Other versions: 7.31 | 7.40 | 7.54


... hierarchy 
  | hierarchy_navigator ...


Specifies hierarchy data as a data source data_source in a ABAP SQL query. Possible hierarchy data is:

Access to hierarchy data is not supported by all databases.


  • Hierarchy data sources are handled like any other data source. They can have alias names defined using AS and can be used in join expressions. There are no restrictions on which queries they can be used in.

  • In an ABAP program, it is possible to use the method USE_FEATURES of the class CL_ABAP_DBFEATURES to check whether the current database system or a database system accessed using a secondary connection supports access to hierarchy data. This requires the constant HIERARCHIES of this class to be passed to the method in an internal table.


Accesses the hierarchy navigator HIERARCHY_SIBLINGS as the data source of a query. The hierarchy navigator uses a CDS hierarchy as a source.

DATA(id) = 5. 

              SOURCE demo_cds_simple_tree( p_id = 1 ) 
              START WHERE id = @id ) 
       FIELDS id, 
       INTO TABLE @DATA(ancestors).


SELECT - FROM hierarchy

SELECT - FROM hierarchy_navigator