Skip to Content
avatar image
Former Member

CDS pathexpression as data source

Hi,

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
{
    vbeln,
    _vbap
}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
{
    vbeln,
    posnr,
    _soitm.matnr,
    _mara.matkl
}

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers