Skip to content

ABAP Keyword Documentation →  ABAP - Dictionary →  ABAP CDS in ABAP Dictionary →  ABAP CDS - Data Definitions →  ABAP CDS - DDL for Data Definitions →  ABAP CDS - DEFINE HIERARCHY 

ABAP CDS - DEFINE HIERARCHY, parameter_list

Other versions: 7.31 | 7.40 | 7.54

Syntax


... WITH PARAMETERS parameter1, parameter2, ...

Effect

Defines CDS parameters parameter1, parameter2, ... as input parameters of a CDS table hierarchy in a comma-separated list.

An input parameter called pname can be used as an operand in the following places of the DEFINE HIERARCHY statement using the same syntax as in the CDS views :pname or $parameters.pname:

  • As an operand on the right side of the start condition after START WHERE.
  • As an operand after DEPTH.


Example

Defines an input parameter in a CDS hierarchy and its use after START WHERE. The program DEMO_HIERARCHY_TREE accesses the CDS hierarchy and passes an actual parameter to the input parameter.

define hierarchy DEMO_CDS_SIMPLE_TREE
  with parameters
    p_id : abap.int4
  as parent child hierarchy(
    source
      DEMO_CDS_SIMPLE_TREE_SOURCE
      child to parent association _tree
      start where
        id = :p_id
      siblings order by
        id ascending
    )
    {
      id,
      parent,
      name
    }