Skip to Content

Issue building Custom Hierarchy in ABAP CDS views

Hi Abapers,

I'm new building Custom Hierarchy in ABAP CDS views, and I follow this tutorial but the results that shows this tutorial are not the same that mine, so What I trying to do is to get the Hierarchy of Commitment items master data like when I use t-code FM3G.

but when I build my custom CDS there's not Hierarchy

so these are the cds I build

this is the Hierarchy cds

@VDM.viewType: #BASIC
@ObjectModel: { dataCategory: #HIERARCHY }
@AbapCatalog.sqlViewName: 'ZVIFMCIH'
@Hierarchy.parentChild.name: 'FIPEX_01'
@Hierarchy.parentChild.label: 'Posición presupuestaria 01'
@Hierarchy.parentChild:
{ recurse:          {   parent: 'ParentNode',   child:  'HierarchyNode'   },
  siblingsOrder:    {   by: 'HierarchyNode',    direction: 'ASC'   },
  orphanedNode.handling: #ROOT_NODES
// rootNode.visibility: #DO_NOT_ADD_ROOT_NODE
  }
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Posiciones presupuestarias datos maestros'


/*+[hideWarning] { "IDS" : [ "KEY_CHECK" ]  } */
define view ZI_FMCI_H_01
  as select from fmci as object
    inner join   fmci as relation on  relation.fipex = object.fipex
                                  and relation.kateg = '2'
  association [0..*] to ZI_FMCI_DIM_ as _ZI_FMCI_DIM_01 on $projection.PosPre = _ZI_FMCI_DIM_01.PosPre
{
  key      object.fipex                as HierarchyNode,
           relation.fipup              as ParentNode,
           @ObjectModel.foreignKey.association: '_ZI_FMCI_DIM_01'
           relation.fipex              as PosPre,
           @ObjectModel.foreignKey.association: '_ZI_FMCI_DIM_01'
           relation.fipup              as PosPreM,


           _ZI_FMCI_DIM_01
} 
 

and this is the dimension cds

@AbapCatalog.sqlViewName: 'ZVI_FMCIDIM'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'test analytics'
@VDM.viewType: #BASIC
@Analytics: { dataCategory: #DIMENSION, dataExtraction.enabled: true }
@ObjectModel.representativeKey: 'PosPre'
/*+[hideWarning] { "IDS" : [ "CARDINALITY_CHECK", "KEY_CHECK" ]  } */
define view ZI_FMCI_DIM_
  as select from fmci
  association [0..*] to ZI_FMCI_H_01 as _Fmci_Hier on  $projection.PosPre = _Fmci_Hier.PosPre
  association [1..1] to fmcit        as pospret    on  $projection.PosPre = pospret.fipex
                                                   and pospret.fikrs      = 'UEAN'
                                                   and pospret.spras      = $session.system_language
{
              @ObjectModel.Hierarchy.association: '_Fmci_Hier'
              @ObjectModel.text.element:  [ 'Name' ]
              @EndUserText.label: 'PosPre'
  key         fmci.fipex    as PosPre, //  PosPre
              fmci.fikrs,
              fmci.gjahr,
              fmci.fipup,
              fmci.fipex,
              /*Assosiations*/
              _Fmci_Hier,
              /*Text*/
              @Semantics.text: true
              pospret.mctxt as PosPreName
} 

so I don't know what else I can do to make it work, any suggestion are accepted

regards

1.png (36.1 kB)
2.png (116.2 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Nov 24, 2017 at 07:49 AM

    Maybe the hierarchy annotation is not correctly set up? According to the documentation, the Hierarchy.parentChild is an array. So try to enclose this annotation in brackets

    Add comment
    10|10000 characters needed characters exceeded