Introduction
One of the limitation with association in ABAP CDS view is we cannot use association field in where condition if the maximum cardinality of the association is n (
association[n..*] ).
Scenario
In the below example, a basic view on TFK003 (Document types) master data table is being created with association to its text table TFK003T. As the cardinality of the association is defined as
[1..*], use of where condition on language field spras to restrict to session language results in below error
“To many” associations (cardinality [n..*]) are not allowed here
Alternative way is creating a new basic view for text table TFK003T with filter on language and using that new basic view for association which leads to extra effort.
To overcome this, we can use path expression on association name to filter out data as shown below:
Output:
Conclusion
The above approach is straight forward and will cut down the effort.
Note:
Similar approach can be used with any pair of tables with 1:n relationship to filter out data but care should be taken as the association with filter path expression can
modify the cardinality of the results set.