P_SAFTSUMJOURNALLINEITEM

CDS View

P_SAFTSUMJOURNALLINEITEM is a CDS View in S/4HANA. It contains 5 fields. 1 CDS views read from this table.

CDS Views using this table (1)

ViewTypeJoinVDMDescription
I_SAFTJournalHeader view inner COMPOSITE SAF-T Journal Header

Fields (5)

KeyField CDS FieldsUsed in Views
KEY Ledger Ledger 1
_CompanyCodeCurrency _CompanyCodeCurrency 1
CompanyCodeCurrency CompanyCodeCurrency 1
SourceLedger SourceLedger 1
TotalGrossAmountInCoCodeCrcy TotalGrossAmountInCoCodeCrcy 1
@AbapCatalog.sqlViewName: 'PSAFTSUMJRNLITEM'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@AccessControl.personalData.blocking: #NOT_REQUIRED
@ObjectModel.usageType.serviceQuality: #P
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.dataClass: #MIXED
@ClientHandling.algorithm: #SESSION_VARIABLE
@VDM.private: true
@VDM.viewType: #COMPOSITE
define view P_SAFTSumJournalLineItem
  as select from I_JournalEntryItem
{
      @ObjectModel.foreignKey.association: '_SourceLedger'
  key SourceLedger                     as SourceLedger,
      @ObjectModel.foreignKey.association: '_CompanyCode'
  key CompanyCode                      as CompanyCode,
      @ObjectModel.foreignKey.association: '_FiscalYear'
  key FiscalYear                       as FiscalYear,
      @ObjectModel.foreignKey.association: '_JournalEntry'
  key AccountingDocument               as AccountingDocument,
      @ObjectModel.foreignKey.association: '_Ledger'
  key Ledger                           as Ledger,

      PostingDate,

      @ObjectModel.foreignKey.association: '_CompanyCodeCurrency'
      @Semantics.currencyCode: true
      CompanyCodeCurrency              as CompanyCodeCurrency,

      @Semantics.amount.currencyCode: 'CompanyCodeCurrency'
      sum(AmountInCompanyCodeCurrency) as TotalGrossAmountInCoCodeCrcy,

      //associations

      _SourceLedger,
      _CompanyCode,
      _FiscalYear,
      _JournalEntry,
      _Ledger,
      _CompanyCodeCurrency
}
where
   ReferenceDocumentType <> 'FKKSU'
group by
  SourceLedger,
  CompanyCode,
  FiscalYear,
  AccountingDocument,
  Ledger,
  CompanyCodeCurrency,
  PostingDate

-- FI-CA Section
union all

select from  I_JournalEntryItem           as jItem

  inner join I_GLAccountInChartOfAccounts as glItem on  glItem.ChartOfAccounts = jItem.ChartOfAccounts
                                                    and jItem.GLAccount        = glItem.GLAccount
 left outer to many join     I_NL_SAFTAccountGroupSettings  as zItem  on zItem.ChartOfAccounts = glItem.ChartOfAccounts
                                                    -- and glItem.GLAccountGroup  = 'GL'

{
      @ObjectModel.foreignKey.association: '_SourceLedger'
  key jItem.SourceLedger                     as SourceLedger,
      @ObjectModel.foreignKey.association: '_CompanyCode'
  key jItem.CompanyCode                      as CompanyCode,
      @ObjectModel.foreignKey.association: '_FiscalYear'
  key jItem.FiscalYear                       as FiscalYear,
      @ObjectModel.foreignKey.association: '_JournalEntry'
  key jItem.AccountingDocument               as AccountingDocument,
      @ObjectModel.foreignKey.association: '_Ledger'
  key jItem.Ledger                           as Ledger,

      jItem.PostingDate,

      @ObjectModel.foreignKey.association: '_CompanyCodeCurrency'
      @Semantics.currencyCode: true
      jItem.CompanyCodeCurrency              as CompanyCodeCurrency,

      @Semantics.amount.currencyCode: 'CompanyCodeCurrency'
      sum(jItem.AmountInCompanyCodeCurrency) as TotalGrossAmountInCoCodeCrcy,

      //associations

      jItem._SourceLedger,
      jItem._CompanyCode,
      jItem._FiscalYear,
      jItem._JournalEntry,
      jItem._Ledger,
      jItem._CompanyCodeCurrency
}
where
  jItem.ReferenceDocumentType = 'FKKSU'
  and(
    (
          zItem.GLAccountGroup        is not null
      and glItem.GLAccountGroup       = zItem.GLAccountGroup
    )
    or(
          zItem.GLAccountGroup        is null
      and glItem.GLAccountGroup       = 'ABST'
    )
    )
group by
  jItem.AccountingDocument,
  jItem.SourceLedger,
  jItem.CompanyCode,
  jItem.FiscalYear,
  jItem.Ledger,
  jItem.CompanyCodeCurrency,
  jItem.PostingDate
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_GLACCOUNTINCHARTOFACCOUNTS",
"I_JOURNALENTRYITEM",
"I_NL_SAFTACCOUNTGROUPSETTINGS"
],
"ASSOCIATED":
[
"I_COMPANYCODE",
"I_CURRENCY",
"I_FISCALYEARFORCOMPANYCODE",
"I_JOURNALENTRY",
"I_LEDGER"
],
"BASE":
[
"I_JOURNALENTRYITEM"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/