C_PE_GLAcctHierarchyInCoCode

DDL: C_PE_GLACCTHIERARCHYINCOCODE SQL: CPEGLACCTHIER Type: view CONSUMPTION Package: GLO_FIN_IS_PE

Acc. Ctrl. for Jrnl Entry Item Cube View

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.

Data Sources (3)

SourceAliasJoin Type
I_CompanyCode CompanyCode inner
I_GLAccountInCompanyCode GLAccountInCompanyCode left_outer
I_GLAccountText GLAccountText left_outer

Parameters (1)

NameTypeDefault
P_AlternativeGLAccount allgaltk

Annotations (11)

NameValueLevelField
AbapCatalog.sqlViewName CPEGLACCTHIER view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
AccessControl.authorizationCheck #CHECK view
ObjectModel.usageType.sizeCategory #S view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.dataClass #MIXED view
VDM.viewType #CONSUMPTION view
ClientHandling.algorithm #SESSION_VARIABLE view
AccessControl.personalData.blocking #NOT_REQUIRED view
EndUserText.label Acc. Ctrl. for Jrnl Entry Item Cube View view

Fields (11)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode I_CompanyCode CompanyCode
KEY FinancialStatementHierarchy FinancialStatementStructure FinancialStatementHierarchy
KEY ValidityEndDate FinancialStatementStructure ValidityEndDate
KEY GLAccount0endendashrynodeasHierarchyNode
KEY ParentNode FinancialStatementStructure ParentNode
ChartOfAccounts FinancialStatementStructure ChartOfAccounts
GLAccount
AlternativeGLAccount
SequenceNumber FinancialStatementStructure HierarchyNodeSequence
HierarchyLevel FinancialStatementStructure HierarchyLevel
FinancialStatementNodeType FinancialStatementStructure FinancialStatementNodeType
@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'
define view C_PE_GLAcctHierarchyInCoCode
  with parameters
    @EndUserText.label: 'Alternative Account'
    P_AlternativeGLAccount : allgaltk
  as select distinct from I_FinancialStatementStructure as FinancialStatementStructure

  inner join I_CompanyCode as CompanyCode on CompanyCode.CountryChartOfAccounts = FinancialStatementStructure.ChartOfAccounts

  left outer join I_GLAccountInCompanyCode as GLAccountInCompanyCode on  GLAccountInCompanyCode.CompanyCode                     = CompanyCode.CompanyCode
                                                                     and GLAccountInCompanyCode.AlternativeGLAccount            = FinancialStatementStructure.HierarchyNodeVal
                                                                     and FinancialStatementStructure.FinancialStatementNodeType = 'G'

  left outer join 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,
  key cast(
        case
          when FinancialStatementStructure.FinancialStatementNodeType = 'I' or FinancialStatementStructure.FinancialStatementNodeType = 'F'
            then
              ltrim( FinancialStatementStructure.HierarchyNodeVal, '0' )
          else
            case $parameters.P_AlternativeGLAccount
              when 'X'
                then
                  case
                    when GLAccountInCompanyCode.AlternativeGLAccount <> '' and GLAccountInCompanyCode.AlternativeGLAccount is not null
                      then
                        ltrim( GLAccountInCompanyCode.AlternativeGLAccount, '0' )
                    else
                      ltrim( GLAccountInCompanyCode.GLAccount, '0')
                  end
              else
                ltrim( GLAccountInCompanyCode.GLAccount, '0')
            end
        end as hrynode ) as HierarchyNode,

  key FinancialStatementStructure.ParentNode,

  cast(
    case FinancialStatementStructure.FinancialStatementNodeType
      when 'G'
        then
          GLAccountText.GLAccountLongName
      else
        FinancialStatementStructure._HierNodeText[1: Language = $session.system_language].HierarchyNodeText
    end as 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 is not null )
  and FinancialStatementStructure.HierarchyLevel > '000003'