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: 

cds view association on association?

former_member186143
Active Contributor
0 Kudos

I try to create a CDS view and as I learn here from the blogs association is something to consider above using joins. Now I try to replace my joins with associations but get a problem with a join on a join. how can asscociations be nested?

here the sample code where I get the error on the line

  on _module_group_data.category = _group_type_descr.category

Table name _module_group_data unknown or shadowed by an alias

define view ZCMOD_DD_MODULEGROUP_DATA 
                with parameters p_idate:abap.dats,
                p_lang:abap.lang //will define validity
                
  
-- The Main object
  as select distinct from hrp1000  as object
  association [0..1] to hrp1733  as _module_group_data 
    on object.plvar =  _module_group_data.plvar 
     and object.otjid =  _module_group_data.otjid
  
-- Module Group data
      
      association [0..1] to t7piqmodgrpcatt as _group_type_descr
     on _module_group_data.category = _group_type_descr.category
      and _group_type_descr.spras = $parameters.p_lang 
                                 
-- Modulegroup Extra Data
    association [0..1] to hrp9102 as _modulegroup_extra_data 
    on object.plvar = _modulegroup_extra_data.plvar
      and object.otjid = _modulegroup_extra_data.otjid 


<br>
1 REPLY 1

Abhi105
Advisor
Advisor
0 Kudos

Hi A.Smidt,

Its been quite a while but still checking if you got the answer to your query. I have the same question !

Best,

Abhinav