Skip to Content
0
Aug 17, 2018 at 06:23 AM

cds view association on association?

414 Views Last edit Aug 17, 2018 at 06:26 AM 3 rev

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>