Application Development 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: 

Association is not available error in cds

former_member594288
Participant
0 Kudos
3,703

Hi,

when i try to create a value help for sales document then i am getting an error like "Association _vb is not available"

@AbapCatalog.sqlViewName: 'ZTEST_ASSOCV'

@VDM.viewType: #BASIC

@Analytics.dataCategory: #FACT

define view ztest_assoc as

select from vbap association [1] to vbak as _vb

on $projection.vbeln = _vb.vbeln

{

@ObjectModel.foreignKey.association: '_vb'

key vbeln,

_vb

}

Please correct me.

6 REPLIES 6

0 Kudos
1,203

Hi ,

used this code your error is resolved

@AbapCatalog.sqlViewName: 'ZSCN'

@AbapCatalog.compiler.compareFilter: true

@AbapCatalog.preserveKey: true

@AccessControl.authorizationCheck: #CHECK

@EndUserText.label: 'SCN QNS'

define view ZYPRACTICE_SCN as select from vbap association [1] to vbak as _vb on $projection.vbeln = _vb.vbeln {

@ObjectModel.foreignKey.association: '_vb'

key vbeln ,

_vb

}

0 Kudos
1,203

Hi Lavanya, i did not see any difference between both code.

0 Kudos
1,203

Yeah i agree that one but i was executed my query i did not got that error

jallipalli_sai
Explorer
0 Kudos
1,203

Hi Ram,

I think there are some restrictions related to association to use in Analytics Views. I checked after

removing @Analytics.dataCategory: #FACT from query which is getting activated successfully.

Alternatively as you need to creat value help instead of @ObjectModel.foreignKey.association: '_vb' you can use @Consumption.valueHelp:'_vb.vbeln' which is working with analytics view as shown in below.

@AbapCatalog.sqlViewName:'ZTEST_ASSOCJ'

@VDM.viewType:#BASIC

@Analytics.dataCategory:#FACT

define view ztest_assocv as

selectfrom vbap association[1]to vbak as _vb

on $projection.vbeln = _vb.vbeln

{


//@ObjectModel.foreignKey.association: '_vb'

@Consumption.valueHelp:'_vb.vbeln'

key vbeln,

_vb

}

Thanks - Sai


former_member594288
Participant
0 Kudos
1,203

Hello @Jallipalli Sai, I tried your suggestion still value help is not appearing in RSRT Transaction.

prabhu_04
Explorer
0 Kudos
1,203

Hi Ram Kumar,

use this code

@AbapCatalog.sqlViewName: 'zbsales'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK 
@EndUserText.label: 'Foreign key'
@VDM.viewType:  #BASIC
@Analytics.dataCategory: #FACT
define view ZB_Sales_04 as select from vbap
association [1] to vbak as _vbak  on $projection.vbeln = _vbak.vbeln {
    @ObjectModel :
    {
    foreignKey.association: '_vbak'
    }
   key vbeln,
    _vbak
}