P_FINSTMTHIERARCHY

CDS View

P_FINSTMTHIERARCHY is a CDS View in S/4HANA. It contains 17 fields. 1 CDS views read from this table.

CDS Views using this table (1)

ViewTypeJoinVDMDescription
P_FinStmtHierarchyWithCocd view from BASIC

Fields (17)

KeyField CDS FieldsUsed in Views
KEY ergsl ergsl 1
KEY fkber fkber 1
KEY HierarchyUniqueNodeID HierarchyUniqueNodeID 1
KEY ktopl ktopl 1
KEY saknr saknr 1
KEY UniqueParentID UniqueParentID 1
KEY versn versn 1
child child 1
Description Description 1
ergs2 ergs2 1
id id 1
MaintenanceLanguage MaintenanceLanguage 1
nextn nextn 1
parent parent 1
segment segment 1
stufe stufe 1
type type 1
@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":""
}
}*/