Skip to content

ABAP Keyword Documentation →  ABAP - Dictionary →  Dependency Rules in ABAP Dictionary →  Dictionary DDL for defining dependency rules 

DEFINE DEPENDENCY RULE

Other versions: 7.31 | 7.40 | 7.54

Syntax


DEFINE FILTER|
JOIN DEPENDENCY RULE drul 
  ON dbtab [, ...]
    IF { cond_pattern }
      THEN { derived_cond }

Effect

Dictionary DDL statement used to define a dependency rule. The statement has two variants:

The name drul of a dependency rule must comply with the naming conventions for dictionary types and can have a maximum of 30 characters. The name is in the namespace of the ABAP Dictionary data types and must match the name of the DRUL source code.

The names dbtab of ABAP Dictionary database tables for which the dependency rule is defined are specified after ON.

  • In the case of filter dependency rules, precisely one database table must be specified.
  • In the case of join dependency rules, comma-separated database tables must be specified.

cond_pattern is used to specify a pattern for a relational expression after IF. In the case of reads made on the database table dbtab, the SAP HANA database optimizer searches for this pattern in the associated WHERE condition or ON condition. If the pattern is found, the optimizer uses AND to add the condition derived_cond specified after THEN to the corresponding WHERE condition or ON condition. The potential conditions are specified in the same way as in the CDS DDL or CDS DCL syntax and are described in the filter and join dependency rules.

Caution

It cannot be guaranteed that the SAP HANA database finds the pattern cond_pattern. This is why the additional condition derived_cond must not modify the results set of the original query. This is technically possible, but produces undefined behavior in cases where the SAP HANA database optimizer finds the pattern cond_pattern in some reads but not in others.


Notes

  • The derivation of an additional condition derived_cond from a pattern cond_pattern usually defines a dependency between semantic and technical columns of a database table. When an application accesses a table with a specific selection condition for semantic columns, an additional condition for technical columns is created implicitly. In the optimization of access to old data, regular date columns are the semantic columns and the temperature column is the technical column.

  • If multiple dependency rules are defined for a database table, AND is used to join all additional conditions and append them to the original condition.

  • Dependency rules can be defined for database tables only; they cannot be defined for views. The SAP HANA database optimizer evaluates all SQL reads on these tables. These include reads made with ABAP SQL, AMDP, and Native SQL, plus all reads made on views that contain the database table as a data source.

  • Dependency rules are not evaluated in reads not made using SQL (such as in calculation views).

  • As in the CDS syntax, the definition of an ABAP Dictionary append structure can contain comments after // and between /* ... */.

  • Partners and customers cannot currently define their own dependency rules.

Continue

DEFINE FILTER DEPENDENCY RULE

DEFINE JOIN DEPENDENCY RULE