P_JournalEntryHistory

DDL: P_JOURNALENTRYHISTORY SQL: PJOURNALENTHST Type: view COMPOSITE Package: FINS_FIS_FICO

Journal Entry History Export as CDS Service

P_JournalEntryHistory is a Composite CDS View that provides data about "Journal Entry History Export as CDS Service" in SAP S/4HANA. It reads from 10 data sources and exposes 106 fields with key fields CompanyCode, Ledger, AccountingDocument, ChangeDocument, DatabaseTable. Part of development package FINS_FIS_FICO.

Data Sources (10)

SourceAliasJoin Type
I_ChangeDocumentItem cdpos inner
I_ChangeDocumentItem cdpos inner
I_ChangeDocumentItem cdpos inner
I_ChangeDocumentItem cdpos inner
I_ChangeDocumentItem cdpos inner
P_AddlLedgerAcctDocItemHistory P_AddlLedgerAcctDocItemHistory inner
P_AddlLedgerDocHeaderHistory P_AddlLedgerDocHeaderHistory inner
P_JournalEntryHeaderHistory P_JournalEntryHeaderHistory inner
P_JournalEntryHeaderHistory P_JournalEntryHeaderHistory inner
P_JournalEntryItemHistory P_JournalEntryItemHistory inner

Annotations (8)

NameValueLevelField
AbapCatalog.sqlViewName PJOURNALENTHST view
VDM.viewType #COMPOSITE view
AccessControl.authorizationCheck #NOT_REQUIRED view
ObjectModel.representativeKey AccountingDocument view
VDM.private true view
ClientHandling.algorithm #SESSION_VARIABLE view
AbapCatalog.buffering.status #NOT_ALLOWED view
Metadata.ignorePropagatedAnnotations true view

Fields (106)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode CompanyCode
KEY Ledger Ledger
KEY AccountingDocument AccountingDocument
KEY ChangeDocument I_ChangeDocumentItem ChangeDocument
KEY DatabaseTable I_ChangeDocumentItem DatabaseTable
KEY ChangeDocTableKey I_ChangeDocumentItem ChangeDocTableKey
KEY ChangeDocDatabaseTableField ChangeDocDatabaseTableField
KEY AccountingDocumentItem P_JournalEntryItemHistory AccountingDocumentItem
FiscalYear FiscalYear
PostingDate PostingDate
DocumentDate DocumentDate
UserName cdhdr CreatedByUser
LastChangeTime cdhdr CreationTime
OldFieldContent ChangeDocPreviousFieldValue
NewFieldContent ChangeDocNewFieldValue
LastChangeDate cdhdr CreationDate
AccountingDocumentCreationDate AccountingDocumentCreationDate
CreationTime P_JournalEntryItemHistory CreationTime
FinancialAccountType FinancialAccountType
GLAccount GLAccount
AccountingDocumentType P_JournalEntryItemHistory AccountingDocumentType
bkpf_tabkeykeyCompanyCode
KEY ChangeDocTableKey42endasLedger
KEY AccountingDocument AccountingDocument
KEY ChangeDocument I_ChangeDocumentItem ChangeDocument
KEY DatabaseTable I_ChangeDocumentItem DatabaseTable
KEY ChangeDocTableKey I_ChangeDocumentItem ChangeDocTableKey
KEY ChangeDocDatabaseTableField ChangeDocDatabaseTableField
KEY AccountingDocumentItem P_JournalEntryHeaderHistory AccountingDocumentItem
FiscalYear FiscalYear
PostingDate PostingDate
DocumentDate DocumentDate
UserName cdhdr CreatedByUser
LastChangeTime cdhdr CreationTime
OldFieldContent ChangeDocPreviousFieldValue
NewFieldContent ChangeDocNewFieldValue
LastChangeDate cdhdr CreationDate
AccountingDocumentCreationDate AccountingDocumentCreationDate
CreationTime P_JournalEntryHeaderHistory CreationTime
FinancialAccountType FinancialAccountType
GLAccount GLAccount
AccountingDocumentType P_JournalEntryHeaderHistory AccountingDocumentType
ChangeDocumentkeyCompanyCode
KEY ChangeDocTableKey42endasLedger
KEY AccountingDocument AccountingDocument
KEY ChangeDocument I_ChangeDocumentItem ChangeDocument
KEY DatabaseTable I_ChangeDocumentItem DatabaseTable
KEY ChangeDocTableKey I_ChangeDocumentItem ChangeDocTableKey
KEY ChangeDocDatabaseTableField ChangeDocDatabaseTableField
KEY AccountingDocumentItem P_JournalEntryHeaderHistory AccountingDocumentItem
FiscalYear FiscalYear
PostingDate PostingDate
DocumentDate DocumentDate
UserName cdhdr CreatedByUser
LastChangeTime cdhdr CreationTime
OldFieldContent ChangeDocPreviousFieldValue
NewFieldContent ChangeDocNewFieldValue
LastChangeDate cdhdr CreationDate
AccountingDocumentCreationDate AccountingDocumentCreationDate
CreationTime P_JournalEntryHeaderHistory CreationTime
FinancialAccountType FinancialAccountType
GLAccount GLAccount
AccountingDocumentType P_JournalEntryHeaderHistory AccountingDocumentType
bsegadd_tabkeykeyCompanyCode
KEY Ledger Ledger
KEY AccountingDocument AccountingDocument
KEY ChangeDocument I_ChangeDocumentItem ChangeDocument
KEY DatabaseTable I_ChangeDocumentItem DatabaseTable
KEY ChangeDocTableKey I_ChangeDocumentItem ChangeDocTableKey
KEY ChangeDocDatabaseTableField ChangeDocDatabaseTableField
KEY AccountingDocumentItem P_AddlLedgerAcctDocItemHistory AccountingDocumentItem
FiscalYear FiscalYear
PostingDate PostingDate
DocumentDate DocumentDate
UserName cdhdr CreatedByUser
LastChangeTime cdhdr CreationTime
OldFieldContent ChangeDocPreviousFieldValue
NewFieldContent ChangeDocNewFieldValue
LastChangeDate cdhdr CreationDate
AccountingDocumentCreationDate AccountingDocumentCreationDate
CreationTime P_AddlLedgerAcctDocItemHistory CreationTime
FinancialAccountType FinancialAccountType
GLAccount GLAccount
AccountingDocumentType P_AddlLedgerAcctDocItemHistory AccountingDocumentType
bkpf_tabkeykeyCompanyCode
KEY Ledger Ledger
KEY AccountingDocument AccountingDocument
KEY ChangeDocument I_ChangeDocumentItem ChangeDocument
KEY DatabaseTable I_ChangeDocumentItem DatabaseTable
KEY ChangeDocTableKey I_ChangeDocumentItem ChangeDocTableKey
KEY ChangeDocDatabaseTableField ChangeDocDatabaseTableField
KEY AccountingDocumentItem P_AddlLedgerDocHeaderHistory AccountingDocumentItem
FiscalYear FiscalYear
PostingDate PostingDate
DocumentDate DocumentDate
UserName cdhdr CreatedByUser
LastChangeTime cdhdr CreationTime
OldFieldContent ChangeDocPreviousFieldValue
NewFieldContent ChangeDocNewFieldValue
LastChangeDate cdhdr CreationDate
AccountingDocumentCreationDate AccountingDocumentCreationDate
CreationTime P_AddlLedgerDocHeaderHistory CreationTime
FinancialAccountType FinancialAccountType
GLAccount GLAccount
AccountingDocumentType P_AddlLedgerDocHeaderHistory AccountingDocumentType
AccountingDocumentCategory P_AddlLedgerDocHeaderHistory AccountingDocumentCategory
@AbapCatalog.sqlViewName: 'PJOURNALENTHST'
@VDM.viewType: #COMPOSITE
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ObjectModel.representativeKey: 'AccountingDocument'
@VDM.private:true
@ClientHandling.algorithm: #SESSION_VARIABLE
@AbapCatalog.buffering.status: #NOT_ALLOWED
@Metadata.ignorePropagatedAnnotations: true

define view P_JournalEntryHistory
  as select from(
    (
                   I_ChangeDocument     as cdhdr
        inner join P_JournalEntryItemHistory     on cdhdr.ChangeDocObject = P_JournalEntryItemHistory.objectid
    )
      inner join   I_ChangeDocumentItem as cdpos on  cdpos.ChangeDocObjectClass = cdhdr.ChangeDocObjectClass
                                                 and cdpos.ChangeDocObject      = cdhdr.ChangeDocObject
                                                 and cdpos.ChangeDocument       = cdhdr.ChangeDocument
                                                 and cdpos.ChangeDocTableKey    = P_JournalEntryItemHistory.tabkey
  )
{
  key CompanyCode,
  key Ledger,
  key AccountingDocument,
  key cdpos.ChangeDocument,
  key cdpos.DatabaseTable,
  key cdpos.ChangeDocTableKey,
  key ChangeDocDatabaseTableField,
  key P_JournalEntryItemHistory.AccountingDocumentItem,
      FiscalYear,
      PostingDate,
      DocumentDate,
      cdhdr.CreatedByUser                                           as UserName,
      cdhdr.CreationTime                                            as LastChangeTime,//LastChangeDateTime,

      ChangeDocPreviousFieldValue                                   as OldFieldContent,
      ChangeDocNewFieldValue                                        as NewFieldContent,
      cdhdr.CreationDate                                            as LastChangeDate,
      AccountingDocumentCreationDate,
      P_JournalEntryItemHistory.CreationTime,
      FinancialAccountType,
      GLAccount,
      P_JournalEntryItemHistory.AccountingDocumentType,
      P_JournalEntryItemHistory.AccountingDocumentCategory
}
where
  (
       cdhdr.ChangeDocObjectClass = 'BELEG'
    or cdhdr.ChangeDocObjectClass = 'BELEGR'
    or cdhdr.ChangeDocObjectClass = 'ISJP_IT'
  )
  and  cdpos.ChangeDocDatabaseTableField != 'AEDAT'
  and  cdpos.ChangeDocDatabaseTableField != 'KEY'
  and(
       cdpos.DatabaseTable        = 'BSEG'
    or cdpos.DatabaseTable        = 'BSEC'
    or cdpos.DatabaseTable        = 'BSEGR'
    or cdpos.DatabaseTable        = 'ISJPINVSUMIT'
  )

union

select from(
  (
                 I_ChangeDocument     as cdhdr
      inner join P_JournalEntryHeaderHistory   on cdhdr.ChangeDocObject = P_JournalEntryHeaderHistory.objectid
  )
    inner join   I_ChangeDocumentItem as cdpos on  cdpos.ChangeDocObjectClass = cdhdr.ChangeDocObjectClass
                                               and cdpos.ChangeDocObject      = cdhdr.ChangeDocObject
                                               and cdpos.ChangeDocument       = cdhdr.ChangeDocument
                                               and cdpos.ChangeDocTableKey    = P_JournalEntryHeaderHistory.bkpf_tabkey
)
{
  key CompanyCode,
  key case cdpos.DatabaseTable when 'BKPF' then ''
    when 'BSEGR' then ''
    when 'ACDOCA' then substring(cdpos.ChangeDocTableKey, 4,2)
  end                                                               as  Ledger,
  key AccountingDocument,
  key cdpos.ChangeDocument,
  key cdpos.DatabaseTable,
  key cdpos.ChangeDocTableKey,
  key ChangeDocDatabaseTableField,
  key P_JournalEntryHeaderHistory.AccountingDocumentItem,
      FiscalYear,
      PostingDate,
      DocumentDate,
      cdhdr.CreatedByUser                                           as  UserName,
      cdhdr.CreationTime                                            as  LastChangeTime,//LastChangeDateTime,

      ChangeDocPreviousFieldValue                                   as  OldFieldContent,
      ChangeDocNewFieldValue                                        as  NewFieldContent,
      cdhdr.CreationDate                                            as  LastChangeDate,
      AccountingDocumentCreationDate,
      P_JournalEntryHeaderHistory.CreationTime,
      FinancialAccountType,
      GLAccount,
      P_JournalEntryHeaderHistory.AccountingDocumentType,
      P_JournalEntryHeaderHistory.AccountingDocumentCategory
}
where
  (
        cdhdr.ChangeDocObjectClass = 'BELEGR'
    and cdpos.DatabaseTable        = 'BSEGR'

  )
union

select from(
  (
                 I_ChangeDocument     as cdhdr
      inner join P_JournalEntryHeaderHistory   on cdhdr.ChangeDocObject = P_JournalEntryHeaderHistory.objectid
  )
    inner join   I_ChangeDocumentItem as cdpos on  cdpos.ChangeDocObjectClass = cdhdr.ChangeDocObjectClass
                                               and cdpos.ChangeDocObject      = cdhdr.ChangeDocObject
                                               and cdpos.ChangeDocument       = cdhdr.ChangeDocument

)
{
  key CompanyCode,
  key case cdpos.DatabaseTable when 'BKPF' then ''
    when 'BSEGR' then ''
    when 'ACDOCA' then substring(cdpos.ChangeDocTableKey, 4,2)
  end                                                               as  Ledger,
  key AccountingDocument,
  key cdpos.ChangeDocument,
  key cdpos.DatabaseTable,
  key cdpos.ChangeDocTableKey,
  key ChangeDocDatabaseTableField,
  key P_JournalEntryHeaderHistory.AccountingDocumentItem,
      FiscalYear,
      PostingDate,
      DocumentDate,
      cdhdr.CreatedByUser                                           as  UserName,
      cdhdr.CreationTime                                            as  LastChangeTime,//LastChangeDateTime,

      ChangeDocPreviousFieldValue                                   as  OldFieldContent,
      ChangeDocNewFieldValue                                        as  NewFieldContent,
      cdhdr.CreationDate                                            as  LastChangeDate,
      AccountingDocumentCreationDate,
      P_JournalEntryHeaderHistory.CreationTime,
      FinancialAccountType,
      GLAccount,
      P_JournalEntryHeaderHistory.AccountingDocumentType,
      P_JournalEntryHeaderHistory.AccountingDocumentCategory
}
where
  (
        cdhdr.ChangeDocObjectClass = 'BELEG'
    and cdpos.DatabaseTable        = 'ACDOCA'
  )
  or(
        cdhdr.ChangeDocObjectClass = 'BELEG'
    and cdpos.ChangeDocDatabaseTableField != 'AEDAT'
    and cdpos.DatabaseTable        = 'BKPF'
  )

union

select from(
  (
                 I_ChangeDocument     as cdhdr
      inner join P_AddlLedgerAcctDocItemHistory on cdhdr.ChangeDocObject = P_AddlLedgerAcctDocItemHistory.objectid

  )
    inner join   I_ChangeDocumentItem as cdpos  on  cdpos.ChangeDocObjectClass = cdhdr.ChangeDocObjectClass
                                                and cdpos.ChangeDocObject      = cdhdr.ChangeDocObject
                                                and cdpos.ChangeDocument       = cdhdr.ChangeDocument
                                                and cdpos.ChangeDocTableKey    = P_AddlLedgerAcctDocItemHistory.bsegadd_tabkey

)
{
  key CompanyCode,
  key Ledger,
  key AccountingDocument,
  key cdpos.ChangeDocument,
  key cdpos.DatabaseTable,
  key cdpos.ChangeDocTableKey,
  key ChangeDocDatabaseTableField,
  key P_AddlLedgerAcctDocItemHistory.AccountingDocumentItem,
      FiscalYear,
      PostingDate,
      DocumentDate,
      cdhdr.CreatedByUser                                           as UserName,
      cdhdr.CreationTime                                            as LastChangeTime,//LastChangeDateTime,

      ChangeDocPreviousFieldValue                                   as OldFieldContent,
      ChangeDocNewFieldValue                                        as NewFieldContent,
      cdhdr.CreationDate                                            as LastChangeDate,
      AccountingDocumentCreationDate,
      P_AddlLedgerAcctDocItemHistory.CreationTime,
      FinancialAccountType,
      GLAccount,
      P_AddlLedgerAcctDocItemHistory.AccountingDocumentType,
      P_AddlLedgerAcctDocItemHistory.AccountingDocumentCategory
}
where
  (
       cdhdr.ChangeDocObjectClass = 'BELEG'
    or cdhdr.ChangeDocObjectClass = 'BELEGR'
    or cdhdr.ChangeDocObjectClass = 'ISJP_IT'
  )
  and  cdpos.ChangeDocDatabaseTableField != 'AEDAT'
  and  cdpos.ChangeDocDatabaseTableField != 'KEY'
  and(
       cdpos.DatabaseTable        = 'BSEG_ADD'
    or cdpos.DatabaseTable        = 'ACDOCA'
  )

union 

select from(
  (
                 I_ChangeDocument     as cdhdr
      inner join P_AddlLedgerDocHeaderHistory  on cdhdr.ChangeDocObject = P_AddlLedgerDocHeaderHistory.objectid
  )
    inner join   I_ChangeDocumentItem as cdpos on  cdpos.ChangeDocObjectClass = cdhdr.ChangeDocObjectClass
                                               and cdpos.ChangeDocObject      = cdhdr.ChangeDocObject
                                               and cdpos.ChangeDocument       = cdhdr.ChangeDocument
                                               and cdpos.ChangeDocTableKey    = P_AddlLedgerDocHeaderHistory.bkpf_tabkey
)
{ 
  key CompanyCode,
  key Ledger,
  key AccountingDocument,
  key cdpos.ChangeDocument,
  key cdpos.DatabaseTable,
  key cdpos.ChangeDocTableKey,
  key ChangeDocDatabaseTableField,
  key P_AddlLedgerDocHeaderHistory.AccountingDocumentItem,
      FiscalYear,
      PostingDate,
      DocumentDate,
      cdhdr.CreatedByUser                                           as  UserName,
      cdhdr.CreationTime                                            as  LastChangeTime,//LastChangeDateTime,

      ChangeDocPreviousFieldValue                                   as  OldFieldContent,
      ChangeDocNewFieldValue                                        as  NewFieldContent,
      cdhdr.CreationDate                                            as  LastChangeDate,
      AccountingDocumentCreationDate,
      P_AddlLedgerDocHeaderHistory.CreationTime,
      FinancialAccountType,
      GLAccount,
      P_AddlLedgerDocHeaderHistory.AccountingDocumentType,
      P_AddlLedgerDocHeaderHistory.AccountingDocumentCategory

}
where
      cdhdr.ChangeDocObjectClass = 'BELEG'
  and cdpos.DatabaseTable        = 'BKPF'
  and cdpos.ChangeDocDatabaseTableField != 'AEDAT'