P_CN_CADEGLAccountForBalance

DDL: P_CN_CADEGLACCOUNTFORBALANCE SQL: PCNGLACCT4BAL Type: view COMPOSITE Package: GLO_FIN_CADE_CN

CADE GL Account Structure for Balance

P_CN_CADEGLAccountForBalance is a Composite CDS View that provides data about "CADE GL Account Structure for Balance" in SAP S/4HANA. It reads from 5 data sources (I_FinancialStatementItem, P_CN_CADEFinStmntItemWithLeaf, I_FinancialStatementVersion, I_GLAccountInChartOfAccounts, I_CN_CADEFinStatementLeafItem) and exposes 8 fields with key fields FinancialStatementVariant, FinancialStatementItem, FinancialStatementItem. Part of development package GLO_FIN_CADE_CN.

Data Sources (5)

SourceAliasJoin Type
I_FinancialStatementItem FinancialStatementItem from
P_CN_CADEFinStmntItemWithLeaf FinancialStatementLeafItem left_outer
I_FinancialStatementVersion FinancialStatementVersion inner
I_GLAccountInChartOfAccounts GLAccount union
I_CN_CADEFinStatementLeafItem leafItem left_outer

Parameters (1)

NameTypeDefault
P_FinancialStatementVariant versn_011

Annotations (10)

NameValueLevelField
AbapCatalog.preserveKey true view
AbapCatalog.sqlViewName PCNGLACCT4BAL view
VDM.private true view
VDM.viewType #COMPOSITE view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #NOT_REQUIRED view
ObjectModel.usageType.sizeCategory #S view
ObjectModel.usageType.dataClass #CUSTOMIZING view
ObjectModel.usageType.serviceQuality #A view
ClientHandling.algorithm #SESSION_VARIABLE view

Fields (8)

KeyFieldSource TableSource FieldDescription
KEY FinancialStatementVariant I_FinancialStatementItem FinancialStatementVariant
KEY FinancialStatementItem I_FinancialStatementItem FinancialStatementItem
GLAccountWOPrefix I_FinancialStatementItem FinancialStatementItem
GLAccount
KEY FinancialStatementItem I_CN_CADEFinStatementLeafItem FinancialStatementItem
GLAccountWOPrefix
GLAccount GLAccount
IsGLAccount
@AbapCatalog.preserveKey: true
@AbapCatalog.sqlViewName: 'PCNGLACCT4BAL'
@VDM.private: true
@VDM.viewType: #COMPOSITE
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ObjectModel.usageType.sizeCategory: #S
@ObjectModel.usageType.dataClass:  #CUSTOMIZING
@ObjectModel.usageType.serviceQuality: #A
@ClientHandling.algorithm: #SESSION_VARIABLE
define view P_CN_CADEGLAccountForBalance 
  with parameters
    P_FinancialStatementVariant : versn_011
/*
  Fetch the GL account in FSV item
*/
as select from I_FinancialStatementItem as FinancialStatementItem
  inner join I_FinancialStatementVersion as FinancialStatementVersion on FinancialStatementItem.FinancialStatementVariant = FinancialStatementVersion.FinancialStatementVariant
  
  //Find the FSV leaf item with no account assign. Mark as "IsGLaccount"

  left outer join P_CN_CADEFinStmntItemWithLeaf as FinancialStatementLeafItem on FinancialStatementItem.FinancialStatementVariant = FinancialStatementLeafItem.FinancialStatementVariant
                                                                              and FinancialStatementItem.FinancialStatementItem = FinancialStatementLeafItem.FinancialStatementItem
                                                                              and FinancialStatementLeafItem.FinancialStatementItem = FinancialStatementLeafItem.FinancialStatementLeafItem
                                                                              and (FinancialStatementLeafItem.UpperBoundaryAccount is null 
                                                                              or FinancialStatementLeafItem.LowerBoundaryAccount is null)
{
  key FinancialStatementItem.FinancialStatementVariant,
  key FinancialStatementItem.FinancialStatementItem,
  FinancialStatementItem.FinancialStatementItem as GLAccountWOPrefix,
  right(concat('0000000000',FinancialStatementItem.FinancialStatementItem),10) as GLAccount,
  case 
    when FinancialStatementLeafItem.FinancialStatementItem is not null then
      cast('X' as abap.char(1)) 
  end as IsGLAccount
  
}
where FinancialStatementItem.FinancialStatementVariant = :P_FinancialStatementVariant
and FinancialStatementItem.FinancialStatementItem != FinancialStatementVersion.FinancialStatementAssetsItem
and FinancialStatementItem.FinancialStatementItem != FinancialStatementVersion.FinancialStatementNetLossItem
and FinancialStatementItem.FinancialStatementItem != FinancialStatementVersion.FinancialStatementNotesItem
and FinancialStatementItem.FinancialStatementItem != FinancialStatementVersion.FinancialStatementOrphansItem
and FinancialStatementItem.FinancialStatementItem != FinancialStatementVersion.FinStatementLiabilitiesItem
and FinancialStatementItem.FinancialStatementItem != FinancialStatementVersion.FinStatementNetProfitItem
and FinancialStatementItem.FinancialStatementItem != FinancialStatementVersion.FinStatementProfitAndLossItem
and FinancialStatementItem.FinancialStatementItem != :P_FinancialStatementVariant

/*
  Fetch the GL account in leaf items
*/
union select from I_GLAccountInChartOfAccounts as GLAccount
  left outer join I_CN_CADEFinStatementLeafItem as leafItem on  leafItem.FinancialStatementVariant = $parameters.P_FinancialStatementVariant
                                                            and leafItem.ChartOfAccounts = GLAccount.ChartOfAccounts
                                                            and GLAccount.GLAccount >= leafItem.LowerBoundaryAccount
                                                            and GLAccount.GLAccount <= leafItem.UpperBoundaryAccount
{
  key FinancialStatementVariant,
  key leafItem.FinancialStatementItem as FinancialStatementItem,
  Ltrim(GLAccount,'0') as GLAccountWOPrefix,
  GLAccount,
  cast('X' as abap.char(1)) as IsGLAccount
}
where
      leafItem.FinancialStatementVariant =  :P_FinancialStatementVariant
  and leafItem.FinancialStatementItem    <> 'NA'