cdss4hana

Extend CDS consumption view with one field


I want to extend standard CDS /PF1/C_VH_ACCOUNT_ID with "segment_id" field from table /PF1/DB_SGMT_ACT. The reason is that i want to use this field to build additional access control to this CDS and restrict the usage of one of the Fiori Apps that is based on that. I've made the below:

what i have so far :)

but when activating it raises the error msg: enter image description here

Can you give me some advice how to do it properly? I tried to replace the direct association to the table with other custom cds that fetches data from the table but same result. Is it even possible to achieve what I want with this CDS?


Solution

  • Usage of /PF1/C_VH_ACCOUNT_ID and $projection in join clause is what causing issues with activation.

    Below CDS extension works fine without issues.

    @AbapCatalog.sqlViewAppendName: 'ZMS_ACC_ID_EXT'
    @EndUserText.label: 'cds extension example'
    extend view /PF1/C_VH_ACCOUNT_ID with zms_pf1_acc_id
    association [1..1] to /pf1/db_sgmt_act as _seg  on
    I_HouseBankAccountLinkage.bankcountry = _seg.country and
    I_HouseBankAccountLinkage.housebank = _seg.bankkey and
    I_HouseBankAccountLinkage.bankaccountnumber = _seg.acct_no
    
    {
      _seg.segment_id as seg_id
    }