Ansicht
Dokumentation

ABENCDS_PATH_EXPRESSION_FILTER_V1 - CDS PATH EXPRESSION FILTER V1

ABENCDS_PATH_EXPRESSION_FILTER_V1 - CDS PATH EXPRESSION FILTER V1

CPI1466 during Backup   ROGBILLS - Synchronize billing plans  
This documentation is copyright by SAP AG.
SAP E-Book

- DDIC-Based View, path_expr, Filter

... $[WHERE$] cds_cond ...

Effect

Filter condition for the current CDS association. If the join type is explicitly defined with INNER$|${LEFT OUTER$}, the addition WHERE must be specified explicitly. If this is not the case, WHERE must not be specified.

A filter condition is a condition cds_cond implemented as an expanded condition for the join when resolving the CDS association with the join in question. For the operands, general and special rules apply when specifying the condition.

If no filter condition is specified in the path expression, any default filter condition specified for the CDS association is used.

Note

In most cases, a filter condition modifies the join expression defined for a CDS association of a path expression on the database. This means that a separate join expression is defined for each CDS association with a filter condition by default. This is not necessary, however, if a CDS association is used more than once and the same filter condition is specified. This is why the ABAP annotation AbapCatalog.compiler.compareFilter can be used to configure whether the filter conditions of multiple CDS associations are compared semantically for the path expressions defined as joins when a view is activated. If the filter condition matches, the associated join expression is created only once, which generally improves performance. In most cases, it is best to use the annotation and it is automatically proposed when creating a CDS view in the ADT. The result sets of the two configurations can, however, differ.

Example

The following three views contain path expressions with filter conditions in their SELECT list that are implemented as join expressions upon activation.

In the first view, the annotation AbapCatalog.compiler.compareFilter has the recommended value true. The conditions are detected as identical and the variants of the path expressions on a SAP HANA database looks something like this:

CREATE VIEW "DEMOCDSASSFI1" AS SELECT
  "=A0"."D" AS "D_2",
  "=A0"."E" AS "E_2",
  "=A1"."I" AS "I_3",
  "=A1"."J" AS "J_3"
FROM (
  "DEMO_JOIN1" "DEMO_JOIN1" INNER JOIN "DEMO_CDS_ASJO2" "=A0" ON (
    "=A0"."D" = "DEMO_JOIN1"."D" AND
    "=A0"."D" = N'1'
  )
) INNER JOIN "DEMO_JOIN3" "=A1" ON (
  "=A1"."L" = "=A0"."D" AND
  "=A1"."I" = N'2'
)

In the second view, AbapCatalog.compiler.compareFilter has the value false and a join expression is defined for each CDS association of the path expressions regardless of the identical conditions. This means that this variant looks like the variant of the third views (in which all conditions are different):

CREATE VIEW "DEMOCDSASSFI2" AS SELECT
  "=A0"."D" AS "D_2",
  "=A1"."E" AS "E_2",
  "=A3"."I" AS "I_3",
  "=A5"."J" AS "J_3"
FROM (
  (
    (
      (
        (
          "DEMO_JOIN1" "DEMO_JOIN1" INNER JOIN "DEMO_CDS_ASJO2" "=A0" ON (
            "=A0"."D" = "DEMO_JOIN1"."D" AND
            "=A0"."D" = N'1'
          )
        ) INNER JOIN "DEMO_CDS_ASJO2" "=A1" ON (
          "=A1"."D" = "DEMO_JOIN1"."D" AND
          "=A1"."D" = N'1'
        )
      ) INNER JOIN "DEMO_CDS_ASJO2" "=A2" ON (
        "=A2"."D" = "DEMO_JOIN1"."D" AND
        "=A2"."D" = N'1'
      )
    ) INNER JOIN "DEMO_JOIN3" "=A3" ON (
      "=A3"."L" = "=A2"."D" AND
      "=A3"."I" = N'2'
    )
  ) INNER JOIN "DEMO_CDS_ASJO2" "=A4" ON (
    "=A4"."D" = "DEMO_JOIN1"."D" AND
    "=A4"."D" = N'1'
  )
) INNER JOIN "DEMO_JOIN3" "=A5" ON (
  "=A5"."L" = "=A4"."D" AND
  "=A5"."I" = N'2'
)

CREATE VIEW "DEMOCDSASSFI3" AS SELECT
  "=A0"."D" AS "D_2",
  "=A1"."E" AS "E_2",
  "=A3"."I" AS "I_3",
  "=A5"."J" AS "J_3"
FROM (
  (
    (
      (
        (
          "DEMO_JOIN1" "DEMO_JOIN1" INNER JOIN "DEMO_CDS_ASJO2" "=A0" ON (
            "=A0"."D" = "DEMO_JOIN1"."D" AND
            "=A0"."D" = N'1'
          )
        ) INNER JOIN "DEMO_CDS_ASJO2" "=A1" ON (
          "=A1"."D" = "DEMO_JOIN1"."D" AND
          "=A1"."D" = N'2'
        )
      ) INNER JOIN "DEMO_CDS_ASJO2" "=A2" ON (
        "=A2"."D" = "DEMO_JOIN1"."D" AND
        "=A2"."D" = N'3'
      )
    ) INNER JOIN "DEMO_JOIN3" "=A3" ON (
      "=A3"."L" = "=A2"."D" AND
      "=A3"."I" = N'5'
    )
  ) INNER JOIN "DEMO_CDS_ASJO2" "=A4" ON (
    "=A4"."D" = "DEMO_JOIN1"."D" AND
    "=A4"."D" = N'4'
  )
) INNER JOIN "DEMO_JOIN3" "=A5" ON (
  "=A5"."L" = "=A4"."D" AND
  "=A5"."I" = N'6'
)






BAL_S_LOG - Application Log: Log header data   BAL_S_LOG - Application Log: Log header data  
This documentation is copyright by SAP AG.

Length: 8446 Date: 20240423 Time: 223331     sap01-206 ( 78 ms )