What does it do? Specifies a filter for an association from the projected entity that is exposed or redefined in a CDS projection view. The filter is specified in square brackets [ ] when the association is exposed in the projection list. The filter can consist of two attributes, namely cardinality and filter condition >. Example: _Assoc[exact one to exact one:field1 = 5].> The rules described in topic CDS DDL - CDS View Entity, path_expr>, Cardinality> apply to the cardinality cardinality>. Additionally, the following special rules apply:
A filter can never consist of a new cardinality alone. It must always be combined with a filter condition.
The cardinality of an association might implicitly be changed when a filter is added. If this is the case, and only in this case, the new cardinality can be specified in square brackets. The following rules apply to the filter condition cds_cond>:
The rules described in topic CDS DDL - View Entity, path_expr>, filter> apply with one exception: no join type> can be specified for a filter of an exposed association in a CDS projection view.
The prefix $projection.> can be used within a filter to access an element from the projection list Example: _Assoc[to exact one:field1 = $projection.field1] as _alias >
ABAP_EXAMPLE_VX5 The following CDS projection view DEMO_SALES_PV_SO_MODIFY>> is a projection of the CDS view DEMO_SALES_CDS_SO>>. It exposes the association _Items> twice. The first time, all original properties are kept. The second time, the association is modified with a filter. The new alias name _TopItems> is assigned and by using the keyword REDIRECTED TO>, the specialization as composition child is lost and the association is projected as a simple CDS association. DDLS DEMO_SALES_PV_SO_MODIFY ABAP_EXAMPLE_END
ABAP_EXAMPLE_VX5 The following CDS projection view DEMO_SALES_PV_SO_PARAM>> is a projection of the CDS view DEMO_SALES_CDS_SO>>. It exposes the parameter my_parameter> that is included in the associated CDS view DEMO_SALES_CDS_SO_PARAM>>. The parameter has to be filled upon exposure. DDLS DEMO_SALES_PV_SO_PARAM ABAP_EXAMPLE_END