Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Extend CDS view

JamesG
Participant
0 Likes
986

hi experts:

I have two CDS views, ztest_cds and ztex_cds.

ztest_cds was a normal view. ztex_cds was a view that extends ztest_cds.

In ztex_cds, i association another table.When I active ztest_cds,errors was occurs.

this is error message.

when I double click, it come ztex_cds, click active, it's right.NO error and warning.

ztest_cds code:

@AbapCatalog.sqlViewName: 'zt_cds'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'test cds'
define view ztest_cds as select from sflight 
association [1..1] to spfli 
 on sflight.carrid = spfli.carrid
 and sflight.connid = spfli.connid{
    key carrid,
    key connid,
    key fldate,
    price,
    currency
}

ztex_cds code:

@AbapCatalog.sqlViewAppendName: 'ztextend_cds'
@EndUserText.label: 'test extend cds'
extend view ztest_cds
with ztex_cds 
association to sbook as _book
            on _book.carrid = sflight.carrid
            and _book.connid = sflight.connid
 association [1..1] to scustom as _cust
             on _cust.id = _book.customid{
    _book.bookid,
    _book.customid,
    _cust.id,
    _cust.name,
    _cust.form,
    _cust.street
 
} 

somebody can help me ?

Thanks

hi experts:

I have two CDS views, ztest_cds and ztex_cds.

ztest_cds was a normal view. ztex_cds was a view that extends ztest_cds.

In ztex_cds, i association another table.When I active ztest_cds,errors was occurs.

this is error message.

when I double click, it come ztex_cds, click active, it's right.NO error and warning.

ztest_cds code:

@AbapCatalog.sqlViewName: 'zt_cds'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'test cds'
define view ztest_cds as select from sflight 
association [1..1] to spfli 
 on sflight.carrid = spfli.carrid
 and sflight.connid = spfli.connid{
    key carrid,
    key connid,
    key fldate,
    price,
    currency
}

ztex_cds code:

@AbapCatalog.sqlViewAppendName: 'ztextend_cds'
@EndUserText.label: 'test extend cds'
extend view ztest_cds
with ztex_cds 
association to sbook as _book
            on _book.carrid = sflight.carrid
            and _book.connid = sflight.connid
 association [1..1] to scustom as _cust
             on _cust.id = _book.customid{
    _book.bookid,
    _book.customid,
    _cust.id,
    _cust.name,
    _cust.form,
    _cust.street
 
} 

somebody can help me ?

Thanks

1 REPLY 1
Read only

fabianfellhauer
Product and Topic Expert
Product and Topic Expert
0 Likes
793

Hi Wei,

in which release are you working on?

You are accessing the association target _book in the on-condition of your association _cust. Instead, I recommend you to define it like this:

@AbapCatalog.sqlViewAppendName: 'ztextend_cds'
@EndUserText.label: 'test extend cds'
extend view ztest_cds
with ztex_cds 
association to sbook as _book
            on _book.carrid = sflight.carrid
            and _book.connid = sflight.connid

 association [1..1] to scustom as _cust
             on _cust.id = $projection.customid
{
    _book.bookid,
    _book.customid,
    _cust.id,
    _cust.name,
    _cust.form,
    _cust.street
 
} 

Hope this helps!

Best regards

Fabian Fellhauer