I'm struggling to find the syntax to create an association between an extension of a parameterized CDS view and a parameterized CDS view. Their input parameters have the same names.
I've tried this:
extend view I_AAA with ZZ_AAA
association [0..1] to ZZ_BBB(P_param1 : $parameters.P_param1) as _ZZ_BBB
This gives the error: "unexpected keyword '(' (ON was expected)".
Or this:
extend view I_AAA with ZZ_AAA
association [0..1] to ZZ_BBB as _ZZ_BBB on $parameters.P_param1 = _ZZ_BBB.P_param1
This gives the error: "The entity ZZ_BBB requires parameter P_X".
The documentation states:
If the data source
target
of a specified CDS association is a CDS entity with input parameters, parameters must be used after the name_assoc
to pass actual parameters to them. No parameters can be specified for a CDS association published as an element of a SELECT list.
Putting parameters after _assoc is what I tried in the first example.
I've found a workaround: parameters have to be specified for each data element in the selection list using the following syntax:
association [0..1] to ZZ_BBB as _ZZ_BBB on $projection.operand1 = _ZZ_BBB.operand1
{
_ZZ_BBB(P_Param1:$parameters.P_Param1, P_Param2:$parameters.P_Param2).Element1 as SomeElement
...
I still would like to know if it is possible to specify a general parameter for the association that would affect all data elements. I'm going to accept this answer in the meantime.