Skip to Content
Former Member
Apr 27, 2017 at 01:51 PM

CDS pathexpression as data source



If I have a CDS view with parameters which publishes an association, can I use this association in other CDS view as a data source?

For example:

I create a CDS view 'zck_view_with_param' which publish association '_vbap'.

@AbapCatalog.sqlViewName: 'zck_vbakp_vw'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'CDS View with Parameters'
define view zck_view_with_param
    with parameters i_vbeln : vbeln
as select from vbak 
association [0..*] to vbap as _vbap on $projection.vbeln = _vbap.vbeln
}where vbeln = :i_vbeln

Now I want to use '_vbap' association as data source in other view 'zck_pathexpr_datasource'.

@AbapCatalog.sqlViewName: 'zck_soitm_vw'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'CDS View Pathexp Data Source'
define view zck_pathexpr_datasource
    with parameters i_sno : vbeln
as select from zck_view_with_param(i_vbeln : $parameters.i_sno)._vbap as _soitm
association [0..1] to mara as _mara on $projection.matnr = _mara.matnr

But I get an error message "Entity zck_view_with_param' requires parameter i_vbeln".

Can you suggest how to pass parameters in this case?

I tried select from zck_view_with_param(i_vbeln : $parameters.i_sno)._vbap

and select from zck_view_with_param._vbap(i_vbeln : $parameters.i_sno).

Both are not working. Please help.

Thanks in advance.