C_PE_GLAcctHierarchyInCoCode is a Consumption CDS View that provides data about "Acc. Ctrl. for Jrnl Entry Item Cube View" in SAP S/4HANA. It reads from 3 data sources (I_CompanyCode, I_GLAccountInCompanyCode, I_GLAccountText) and exposes 11 fields with key fields CompanyCode, FinancialStatementHierarchy, ValidityEndDate, GLAccount0endendashrynodeasHierarchyNode, ParentNode. Part of development package GLO_FIN_IS_PE.
@AbapCatalog.sqlViewName: 'CPEGLACCTHIER'
@AbapCatalog.compiler.compareFilter: true@AbapCatalog.preserveKey: true@AccessControl.authorizationCheck: #CHECK@ObjectModel.usageType.sizeCategory: #S@ObjectModel.usageType.serviceQuality: #D@ObjectModel.usageType.dataClass: #MIXED@VDM.viewType: #CONSUMPTION@ClientHandling.algorithm: #SESSION_VARIABLE@AccessControl.personalData.blocking: #NOT_REQUIRED@EndUserText.label: 'Acc. Ctrl. for Jrnl Entry Item Cube View'
defineview C_PE_GLAcctHierarchyInCoCode
withparameters@EndUserText.label: 'Alternative Account'
P_AlternativeGLAccount : allgaltk
asselectdistinctfrom I_FinancialStatementStructure as FinancialStatementStructure
innerjoin I_CompanyCode as CompanyCode on CompanyCode.CountryChartOfAccounts = FinancialStatementStructure.ChartOfAccounts
leftouterjoin I_GLAccountInCompanyCode as GLAccountInCompanyCode on GLAccountInCompanyCode.CompanyCode = CompanyCode.CompanyCode
and GLAccountInCompanyCode.AlternativeGLAccount = FinancialStatementStructure.HierarchyNodeVal
and FinancialStatementStructure.FinancialStatementNodeType = 'G'
leftouterjoin I_GLAccountText as GLAccountText on GLAccountText.ChartOfAccounts = FinancialStatementStructure.ChartOfAccounts
and GLAccountText.GLAccount = GLAccountInCompanyCode.AlternativeGLAccount
and GLAccountText.Language = $session.system_language
{
key CompanyCode.CompanyCode,
key FinancialStatementStructure.FinancialStatementHierarchy,
key FinancialStatementStructure.ValidityEndDate,
keycast(
casewhen FinancialStatementStructure.FinancialStatementNodeType = 'I' or FinancialStatementStructure.FinancialStatementNodeType = 'F'
then
ltrim( FinancialStatementStructure.HierarchyNodeVal, '0' )
elsecase $parameters.P_AlternativeGLAccount
when 'X'
thencasewhen GLAccountInCompanyCode.AlternativeGLAccount <> '' and GLAccountInCompanyCode.AlternativeGLAccount isnotnullthen
ltrim( GLAccountInCompanyCode.AlternativeGLAccount, '0' )
else
ltrim( GLAccountInCompanyCode.GLAccount, '0')
endelse
ltrim( GLAccountInCompanyCode.GLAccount, '0')
endendas hrynode ) as HierarchyNode,
key FinancialStatementStructure.ParentNode,
cast(
case FinancialStatementStructure.FinancialStatementNodeType
when 'G'
then
GLAccountText.GLAccountLongName
else
FinancialStatementStructure._HierNodeText[1: Language = $session.system_language].HierarchyNodeText
endas nodetxt ) as HierarchyNodeText,
FinancialStatementStructure.ChartOfAccounts,
// assigning empty value to avoid duplicate lines in the report output when more than one GLAccount is associated with the same AlternativeGLAccount
cast( '' as saknr ) as GLAccount,
cast( '' as fis_alternativeglaccount ) as AlternativeGLAccount,
FinancialStatementStructure.HierarchyNodeSequence as SequenceNumber,
FinancialStatementStructure.HierarchyLevel,
FinancialStatementStructure.FinancialStatementNodeType
}
where// only accounts in company code
( FinancialStatementStructure.FinancialStatementNodeType <> 'G' or GLAccountInCompanyCode.AlternativeGLAccount isnotnull )
and FinancialStatementStructure.HierarchyLevel > '000003'