P_FinStmtHierarchy

DDL: P_FINSTMTHIERARCHY SQL: PFSITEMHIER Type: view BASIC

P_FinStmtHierarchy is a Basic CDS View in SAP S/4HANA. It reads from 7 data sources and exposes 36 fields with key fields HierarchyUniqueNodeID, UniqueParentID, versn, ergsl, ktopl.

Data Sources (7)

SourceAliasJoin Type
P_FSHierarchy_Calc_Item calc_item left_outer
P_FSHierarchy_Calc_Item calc_item left_outer
P_Distinct_Coa_Fagl_Zc dis_zc inner
I_FinancialStatementItem I_FinancialStatementItem from
P_FinStmtLeafItem P_FinStmtLeafItem union_all
t011 t011 inner
t011 t011 inner

Annotations (6)

NameValueLevelField
ClientHandling.algorithm #SESSION_VARIABLE view
Metadata.ignorePropagatedAnnotations true view
VDM.private true view
VDM.viewType #BASIC view
AbapCatalog.sqlViewName PFSITEMHIER view
AbapCatalog.compiler.compareFilter true view

Fields (36)

KeyFieldSource TableSource FieldDescription
KEY HierarchyUniqueNodeID
KEY UniqueParentID
KEY versn I_FinancialStatementItem FinancialStatementVariant
KEY ergsl I_FinancialStatementItem FinancialStatementItem
KEY ktopl P_Distinct_Coa_Fagl_Zc ktopl
KEY saknr
KEY fkber
type I_FinancialStatementItem NodeType
Description
MaintenanceLanguage t011 dspra
xsoll
xhabn
id I_FinancialStatementItem HierarchyNode
parent I_FinancialStatementItem ParentNode
child I_FinancialStatementItem ChildNode
nextn I_FinancialStatementItem SiblingNode
stufe
ergs2 I_FinancialStatementItem OffsettingItem
HierarchyUniqueNodeID
KEY UniqueParentID P_FinStmtLeafItem UniqueParentID
KEY versn P_FinStmtLeafItem versn
ergsl P_FinStmtLeafItem ergsl
KEY ktopl P_FinStmtLeafItem ktopl
KEY saknr P_FinStmtLeafItem saknr
KEY fkber P_FinStmtLeafItem fkber
type P_FinStmtLeafItem type
Description P_FinStmtLeafItem Description
MaintenanceLanguage t011 dspra
xsoll P_FinStmtLeafItem xsoll
xhabn P_FinStmtLeafItem xhabn
id P_FinStmtLeafItem id
parent P_FinStmtLeafItem parent
child P_FinStmtLeafItem child
nextn P_FinStmtLeafItem nextn
stufe P_FinStmtLeafItem stufe
ergs2 P_FinStmtLeafItem ergs2
@ClientHandling.algorithm: #SESSION_VARIABLE
@Metadata.ignorePropagatedAnnotations: true

@VDM.private:true
@VDM.viewType: #BASIC
@AbapCatalog.sqlViewName: 'PFSITEMHIER'
@AbapCatalog.compiler.compareFilter: true
define view P_FinStmtHierarchy
  as select from    I_FinancialStatementItem
    inner join      t011                                 on I_FinancialStatementItem.FinancialStatementVariant = t011.versn
    inner join      P_Distinct_Coa_Fagl_Zc  as dis_zc     on I_FinancialStatementItem.FinancialStatementVariant = dis_zc.versn
    left outer join P_FSHierarchy_Calc_Item as calc_item on  I_FinancialStatementItem.FinancialStatementVariant =  calc_item.versn
                                                         and I_FinancialStatementItem.HierarchyNode             >= calc_item.id_from
                                                         and I_FinancialStatementItem.HierarchyNode             <  calc_item.id_to
{
  key cast(I_FinancialStatementItem.HierarchyNode as abap.char(50))             as HierarchyUniqueNodeID,
  key cast (I_FinancialStatementItem.ParentNode as abap.char(50))               as UniqueParentID,
  key I_FinancialStatementItem.FinancialStatementVariant                        as versn,
  key I_FinancialStatementItem.FinancialStatementItem                           as ergsl,
  key dis_zc.ktopl                                                              as ktopl,
  key cast ('' as saknr)                                                        as saknr,
  key cast ('' as fkber)                                                        as fkber,
      I_FinancialStatementItem.NodeType                                         as type,
      cast ('' as abap.char(50))                                                as Description,
      t011.dspra                                                                as MaintenanceLanguage,
      cast ('' as xsoll_f02e)                                                   as xsoll,
      cast ('' as xhabn_f02e)                                                   as xhabn,
      I_FinancialStatementItem.HierarchyNode                                    as id,
      I_FinancialStatementItem.ParentNode                                       as parent,
      I_FinancialStatementItem.ChildNode                                        as child,
      I_FinancialStatementItem.SiblingNode                                      as nextn,
      cast(I_FinancialStatementItem.FinStatementHierarchyLevelVal as abap.int4) as stufe,
      I_FinancialStatementItem.OffsettingItem                                   as ergs2,
      case when calc_item.segment is null and I_FinancialStatementItem.NodeType = 'R' then 'RT'
           when calc_item.segment is null and I_FinancialStatementItem.NodeType <> 'R' then 'PL'
           else calc_item.segment
      end                                                                       as segment
      // Only top level node will have value in SEGMENT field

      //  case I_FinancialStatementItem.FinStatementHierarchyLevelVal

      //    when '02' then // '01' is ROOT, '02' is ASSET, LIABILITEIS, etc

      //      case I_FinancialStatementItem.FinancialStatementItem

      //        when t011.aktva then 'BS'

      //        when t011.pssva then 'BS'

      //        when t011.anhng then 'NT'

      //        when t011.zuord then 'UA'

      //        else 'PL'

      //      end

      //    else ''

      //  end as segment

}

union all

select from       P_FinStmtLeafItem
  inner join      t011                                 on P_FinStmtLeafItem.versn = t011.versn
  left outer join P_FSHierarchy_Calc_Item as calc_item on  P_FinStmtLeafItem.versn =  calc_item.versn
                                                       and P_FinStmtLeafItem.id    >= calc_item.id_from
                                                       and P_FinStmtLeafItem.id    <  calc_item.id_to
{
  key P_FinStmtLeafItem.HierarchyUniqueNodeID,
  key P_FinStmtLeafItem.UniqueParentID,
  key P_FinStmtLeafItem.versn,
      P_FinStmtLeafItem.ergsl,
  key P_FinStmtLeafItem.ktopl,
  key P_FinStmtLeafItem.saknr,
  key P_FinStmtLeafItem.fkber,
      P_FinStmtLeafItem.type,
      P_FinStmtLeafItem.Description,
      t011.dspra as MaintenanceLanguage,
      P_FinStmtLeafItem.xsoll,
      P_FinStmtLeafItem.xhabn,
      P_FinStmtLeafItem.id,
      //cast('000000' as SEU_ID) as id,

      P_FinStmtLeafItem.parent,
      P_FinStmtLeafItem.child,
      P_FinStmtLeafItem.nextn,
      P_FinStmtLeafItem.stufe,
      P_FinStmtLeafItem.ergs2,
      //calc_item.segment

      case when calc_item.segment is null then 'PL'
           else calc_item.segment
      end        as segment
      // Only top level node will have value in SEGMENT field

      //  case P_FinStmtLeafItem.stufe

      //    when 2 then // '01' is ROOT, '02' is ASSET, LIABILITEIS, etc

      //      case P_FinStmtLeafItem.ergsl

      //        when t011.aktva then 'BS'

      //        when t011.pssva then 'BS'

      //        when t011.anhng then 'NT'

      //        when t011.zuord then 'UA'

      //        else 'PL'

      //      end

      //    else ''

      //  end as segment

}               
  
  
  
  
  
  
 /*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_FINANCIALSTATEMENTITEM",
"P_DISTINCT_COA_FAGL_ZC",
"P_FINSTMTLEAFITEM",
"P_FSHIERARCHY_CALC_ITEM",
"T011"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/