Ansicht
Dokumentation

ABENSELECT_HIERARCHY - SELECT HIERARCHY

ABENSELECT_HIERARCHY - SELECT HIERARCHY

rdisp/max_wprun_time - Maximum work process run time   General Data in Customer Master  
This documentation is copyright by SAP AG.
SAP E-Book

SELECT, FROM hierarchy

... cds_hierarchy
  $| HIERARCHY( ... )
  $| cte_hierarchy


Effect

Specifies an SQL hierarchy as a data source in an query.

  • The following can be maintained:

  • An SQL hierarchy can be specified in the following places:

  • As the source of the hierarchy generator HIERARCHY

An SQL hierarchy is a tabular set of rows that represent the hierarchy nodes.

  • A CTE hierarchy represents the hierarchy that is specified as the only data source in the subquery of the CTE under the name of the CTE in the subsequent queries of the current WITH statement.

The columns of an SQL hierarchy are composed as follows:

  • Components of the data source used when the hierarchy is created by a CDS hierarchy or created by the hierarchy generator.
  • In the case of CDS hierarchies and CTE hierarchies, these are exactly the components listed here.

  • In the case of the hierarchy generator HIERARCHY, these are all components of the source of the SQL hierarchy.

When an SQL hierarchy is used as a data source in an query, the additional hierarchy columns can be accessed as follows:

  • Hierarchy columns can be specified as regular columns using colname and then become part of the result set of the query.

  • If * or ...~* is specified, hierarchy columns are not part of the result set of the query. Only the components of the source of the SQL hierarchy are respected. In this case, the hierarchy columns are also ignored by any structure or internal table created in the INTO clause by an inline declaration @DATA$|@FINAL(...).

  • In other clauses, hierarchy columns can be specified regardless of the SELECT list and are evaluated accordingly.

Notes

  • It is possible to evaluate the hierarchy columns in a query, but this is not mandatory. In most cases, only the data content of an SQL hierarchy is of interest and not the technical properties of the hierarchy nodes.
  • On SAP HANA databases, the result sets of CDS hierarchies and the hierarchy generator HIERARCHY are created using the SAP HANA hierarchy generator function HIERARCHY and similar. For more information, see SAP HANA documentation.

Examples

The following programs demonstrate the three ways of specifying SQL hierarchies as the data source of a SELECT statement while reading all possible hierarchy columns.






ROGBILLS - Synchronize billing plans   Fill RESBD Structure from EBP Component Structure  
This documentation is copyright by SAP AG.

Length: 6696 Date: 20240419 Time: 041244     sap01-206 ( 73 ms )