P_FinStmtLeafWithGLAcct

DDL: P_FINSTMTLEAFWITHGLACCT SQL: PFSLEAFGLACC Type: view BASIC Package: FINS_FIS_FICO

Fin Statement Item with G/L Account (assigned & unassigned)

P_FinStmtLeafWithGLAcct is a Basic CDS View that provides data about "Fin Statement Item with G/L Account (assigned & unassigned)" in SAP S/4HANA. It reads from 6 data sources and exposes 22 fields with key fields HierarchyUniqueNodeID, UniqueParentID, versn, ktopl, saknr. Part of development package FINS_FIS_FICO.

Data Sources (6)

SourceAliasJoin Type
I_FinancialStatementItem fsitem left_outer
I_FinancialStatementItem fsitem left_outer
I_GLAccountInChartOfAccounts GLAccount from
t011 t011 inner
fagl_011zc zc_leaf left_outer
P_FAGL_011ZC zc_range union_all

Annotations (7)

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

Fields (22)

KeyFieldSource TableSource FieldDescription
KEY HierarchyUniqueNodeID
KEY UniqueParentID
KEY versn t011 versn
KEY ktopl I_GLAccountInChartOfAccounts ChartOfAccounts
KEY saknr I_GLAccountInChartOfAccounts GLAccount
type
Description
xsoll fagl_011zc xsoll
xhabn fagl_011zc xhabn
stufe
char50asHierarchyUniqueNodeID
KEY UniqueParentID
KEY versn P_FAGL_011ZC versn
KEY ergsl P_FAGL_011ZC ergsl
KEY ktopl P_FAGL_011ZC ktopl
saknr
type
Description
xsoll
xhabn
stufe
id I_FinancialStatementItem HierarchyNode
@VDM.private:true
@VDM.viewType: #BASIC
@AbapCatalog.sqlViewName: 'PFSLEAFGLACC'
@AbapCatalog.compiler.compareFilter: true
@ClientHandling.algorithm: #SESSION_VARIABLE
@Metadata.ignorePropagatedAnnotations: true
@AbapCatalog.preserveKey:true
define view P_FinStmtLeafWithGLAcct

  as select from    I_GLAccountInChartOfAccounts as GLAccount

    inner join      t011                                    on t011.versn is not null

    left outer join fagl_011zc                   as zc_leaf on  GLAccount.ChartOfAccounts =  zc_leaf.ktopl
                                                            and t011.versn                =  zc_leaf.versn
                                                            and GLAccount.GLAccount       >= zc_leaf.vonkt
                                                            and GLAccount.GLAccount       <= zc_leaf.biskt

    left outer join I_FinancialStatementItem     as fsitem  on  fsitem.FinancialStatementVariant = zc_leaf.versn
                                                            and fsitem.FinancialStatementItem    = zc_leaf.ergsl
                                                            and fsitem.NodeType                  = 'P'

{
      //add '=' in order to have a right sort

  key cast ( concat(concat(concat( fsitem.HierarchyNode,GLAccount.ChartOfAccounts),GLAccount.GLAccount),'=') as abap.char(50) )                               as HierarchyUniqueNodeID,

  key cast (concat(concat( concat(concat( fsitem.HierarchyNode,zc_leaf.ktopl),zc_leaf.vonkt ),'-'),zc_leaf.biskt ) as abap.char(50) )                         as UniqueParentID,

  key t011.versn,

  key case when zc_leaf.ergsl is null then cast (t011.zuord as ergsl) // NULL means unassigned G/L account

           else zc_leaf.ergsl
      end                                                                                                                                                     as ergsl,

  key GLAccount.ChartOfAccounts                                                                                                                               as ktopl,

  key GLAccount.GLAccount                                                                                                                                     as saknr,

      cast ('L' as seu_type)                                                                                                                                  as type,
      cast ( '' as abap.char( 50 ))                                                                                                                           as Description,
      zc_leaf.xsoll                                                                                                                                           as xsoll,
      zc_leaf.xhabn                                                                                                                                           as xhabn,
      cast (fsitem.FinStatementHierarchyLevelVal as abap.int4) + 2                                                                                            as stufe,
      fsitem.HierarchyNode                                                                                                                                    as id
}


union all

select from       P_FAGL_011ZC             as zc_range

  left outer join I_FinancialStatementItem as fsitem on  fsitem.FinancialStatementVariant = zc_range.versn
                                                     and fsitem.FinancialStatementItem    = zc_range.ergsl
                                                     and fsitem.NodeType                  = 'P'
{
  key cast ( concat( concat(concat(concat( fsitem.HierarchyNode,zc_range.ktopl),zc_range.vonkt ),'-'),zc_range.biskt ) as abap.char(50) )            as HierarchyUniqueNodeID,

  key cast ( fsitem.HierarchyNode as abap.char(50) )                                                                                                 as UniqueParentID,

  key zc_range.versn,

  key zc_range.ergsl,

  key zc_range.ktopl,

      ''                                                                                                                                             as saknr,

      cast ('B' as seu_type)                                                                                                                         as type,
      cast (concat(concat (concat(concat (zc_range.ktopl,' '),zc_range.vonkt),'-'),zc_range.biskt) as abap.char(50) )                                as Description,
      cast ('' as xsoll_f02e)                                                                                                                        as xsoll,
      cast ('' as xhabn_f02e)                                                                                                                        as xhabn,
      cast (fsitem.FinStatementHierarchyLevelVal as abap.int4) + 1                                                                                   as stufe,
      fsitem.HierarchyNode                                                                                                                           as id
}