Skip to Content
0
Former Member
Oct 16, 2016 at 07:32 PM

ABAP CDS Association Cardinality of Filter Expressions

1583 Views Last edit Oct 17, 2016 at 12:42 PM 2 rev

Dear Community Members,

In the View shown below, i access two fields of another CDS-View (Zcustom_Assoc). In Zcustom_Assoc there is the association bookings, which i use with a filter on field custtype. If i dont add the cardinality 1:0 in the Filter, there is a warning. The where clause, which is commented out, is an alternative for filtering with field custtype. If i remove the filter and use the where-clause , i get the same result set. In the where-clause i cannot remove the cardinality, cause i am accessing an 1:N Association. This is explained inside the help pages of sap: We do not know if the condition applies to one or all values in the 1:N to association. I also understand this, but what i dont understand is, why i need to set the cardinality in the where-clause, but not in the Filter ?

@AbapCatalog.sqlViewName: 'ztest' 
define view Ztestview as select from Zcustom_Assoc
{   
  Zcustom_Assoc.id, 
  Zcustom_Assoc.name,
  Zcustom_Assoc.bookings[inner where custtype = 'B'].bookid  
} //where Zcustom_Assoc.bookings[1:inner].custtype = 'B'