P_GLACCTWITHCOCODE

DDL: P_GLACCTWITHCOCODE SQL: PGLACCTINCOCODE Type: view COMPOSITE

P_GLACCTWITHCOCODE is a Composite CDS View in SAP S/4HANA. It reads from 4 data sources (I_GLAccountInChartOfAccounts, I_FinancialStatementHier, I_ChartOfAccounts, I_CompanyCode) and exposes 7 fields with key fields GLAccount, CompanyCode. It has 1 association to related views.

Data Sources (4)

SourceAliasJoin Type
I_GLAccountInChartOfAccounts CorporateGroupAccount left_outer
I_FinancialStatementHier FSVERSION inner
I_ChartOfAccounts I_ChartOfAccounts left_outer
I_CompanyCode I_CompanyCode inner

Parameters (2)

NameTypeDefault
p_FinancialStatementHierarchy hryid
P_AlternativeGLAccountIsUsed char1

Associations (1)

CardinalityTargetAliasCondition
[0..*] I_GlAccountTextInCompanycode _Text $projection.CompanyCode = _Text.CompanyCode and $projection.GLAccount = _Text.GLAccount

Annotations (6)

NameValueLevelField
AbapCatalog.sqlViewName PGLACCTINCOCODE view
AbapCatalog.compiler.compareFilter true view
VDM.private true view
VDM.viewType #COMPOSITE view
AccessControl.authorizationCheck #NOT_REQUIRED view
ClientHandling.algorithm #SESSION_VARIABLE view

Fields (7)

KeyFieldSource TableSource FieldDescription
KEY GLAccount GLAccountInCompanyCode GLAccount
KEY CompanyCode GLAccountInCompanyCode CompanyCode
ChartOfAccounts I_GLAccountInChartOfAccounts ChartOfAccounts
GLAccountendendasGLAccountExternal
CorporateGroupChartOfAccounts ChartOfAccounts CorporateGroupChartOfAccounts
CorporateGroupAccount I_GLAccountInChartOfAccounts CorporateGroupAccount
_Text _Text
@AbapCatalog.sqlViewName: 'PGLACCTINCOCODE'
@AbapCatalog.compiler.compareFilter: true
@VDM.private:true
@VDM.viewType: #COMPOSITE
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ClientHandling.algorithm: #SESSION_VARIABLE 
define view P_GLACCTWITHCOCODE 
     with parameters
         p_FinancialStatementHierarchy : hryid,
         P_AlternativeGLAccountIsUsed : char1
//as select from I_GLAccountInCompanyCode as GLAccountInCompanyCode

as select distinct from I_GLAccountInCompanyCode as GLAccountInCompanyCode
  inner join I_CompanyCode CompanyCode on 
    CompanyCode.CompanyCode = GLAccountInCompanyCode.CompanyCode
//  inner join I_FinancialStatementVersion as FSVERSION

//    on FSVERSION.FinancialStatementVariant = $parameters.p_FinancialStatementHierarchy

// FSV migration adaption

  inner join I_FinancialStatementHier as FSVERSION
    on FSVERSION.FinancialStatementHierarchy = $parameters.p_FinancialStatementHierarchy
  left outer join I_GLAccountInChartOfAccounts as CorporateGroupAccount on 
      CompanyCode.ChartOfAccounts = CorporateGroupAccount.ChartOfAccounts and 
      CorporateGroupAccount.GLAccount = GLAccountInCompanyCode.GLAccount
  left outer join I_ChartOfAccounts  ChartOfAccounts on 
      CorporateGroupAccount.ChartOfAccounts = ChartOfAccounts.ChartOfAccounts
  association [0..*] to I_GlAccountTextInCompanycode as _Text on  $projection.CompanyCode = _Text.CompanyCode
                                                              and $projection.GLAccount   = _Text.GLAccount
{
  key GLAccountInCompanyCode.GLAccount,
  key GLAccountInCompanyCode.CompanyCode,
  CorporateGroupAccount.ChartOfAccounts,
  
  cast(case $parameters.P_AlternativeGLAccountIsUsed
    when '1'  then _CompanyCode.CountryChartOfAccounts
    else  '' 
  end as ktop2) as CountryChartOfAccounts,
  case $parameters.P_AlternativeGLAccountIsUsed
    when '1'  then ''
    else  AlternativeGLAccount
  end as AlternativeGLAccount,
  
  case $parameters.P_AlternativeGLAccountIsUsed
    when '1'  then 
        case when AlternativeGLAccount = '' then
            GLAccountInCompanyCode.GLAccount
        else
            AlternativeGLAccount
        end 
//    else  GLAccountInCompanyCode.GLAccount

    else case FSVERSION.GroupChartOfAccountIsUsed
           when 'X' then case when CorporateGroupAccount.CorporateGroupAccount = '' then GLAccountInCompanyCode.GLAccount
                              else CorporateGroupAccount.CorporateGroupAccount
                         end
           else GLAccountInCompanyCode.GLAccount
         end
  end as GLAccountExternal,
  
  ChartOfAccounts.CorporateGroupChartOfAccounts,
  CorporateGroupAccount.CorporateGroupAccount,
  
  _Text
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_CHARTOFACCOUNTS",
"I_COMPANYCODE",
"I_FINANCIALSTATEMENTHIER",
"I_GLACCOUNTINCHARTOFACCOUNTS",
"I_GLACCOUNTINCOMPANYCODE"
],
"ASSOCIATED":
[
"I_GLACCOUNTTEXTINCOMPANYCODE"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/