P_AddlLedgerAcctDocItemHistory

DDL: P_ADDLLEDGERACCTDOCITEMHISTORY SQL: PADLEDITEMTRKDOC Type: view COMPOSITE

P_AddlLedgerAcctDocItemHistory is a Composite CDS View in SAP S/4HANA. It reads from 6 data sources and exposes 43 fields with key fields CompanyCode, AccountingDocument, FiscalYear, AccountingDocument, FiscalYear.

Data Sources (6)

SourceAliasJoin Type
I_JournalEntryItem acdoca union
I_JournalEntry bkpf left_outer
I_JournalEntry bkpf left_outer
I_JournalEntry bkpf left_outer
I_AddlLedgerOplAcctgDocItem bsegadd from
I_AddlLedgerOplAcctgDocItem bsegadd union

Annotations (8)

NameValueLevelField
AbapCatalog.sqlViewName PADLEDITEMTRKDOC 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 (43)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode I_AddlLedgerOplAcctgDocItem CompanyCode
KEY AccountingDocument I_AddlLedgerOplAcctgDocItem AccountingDocument
KEY FiscalYear I_AddlLedgerOplAcctgDocItem FiscalYear
AccountingDocumentItem I_AddlLedgerOplAcctgDocItem AccountingDocumentItem
Ledger I_JournalEntry Ledger
PostingDate I_JournalEntry PostingDate
DocumentDate I_JournalEntry DocumentDate
timestamp CreationTime
CreationTime CreationTime
AccountingDocumentCreationDate AccountingDocumentCreationDate
objectid
FinancialAccountType I_AddlLedgerOplAcctgDocItem FinancialAccountType
GLAccount I_AddlLedgerOplAcctgDocItem GLAccount
AccountingDocumentType I_JournalEntry AccountingDocumentType
CompanyCode
KEY AccountingDocument I_AddlLedgerOplAcctgDocItem AccountingDocument
KEY FiscalYear I_AddlLedgerOplAcctgDocItem FiscalYear
AccountingDocumentItem I_AddlLedgerOplAcctgDocItem AccountingDocumentItem
Ledger I_JournalEntry Ledger
PostingDate I_JournalEntry PostingDate
DocumentDate I_JournalEntry DocumentDate
timestamp CreationTime
CreationTime CreationTime
AccountingDocumentCreationDate AccountingDocumentCreationDate
objectid
FinancialAccountType I_AddlLedgerOplAcctgDocItem FinancialAccountType
GLAccount I_AddlLedgerOplAcctgDocItem GLAccount
AccountingDocumentType I_JournalEntry AccountingDocumentType
CompanyCode
KEY AccountingDocument I_JournalEntryItem AccountingDocument
KEY FiscalYear I_JournalEntryItem FiscalYear
AccountingDocumentItem I_JournalEntryItem LedgerGLLineItem
Ledger I_JournalEntryItem SourceLedger
PostingDate I_JournalEntry PostingDate
DocumentDate I_JournalEntry DocumentDate
timestamp CreationTime
CreationTime CreationTime
AccountingDocumentCreationDate AccountingDocumentCreationDate
objectid
FinancialAccountType I_JournalEntryItem FinancialAccountType
GLAccount I_JournalEntryItem GLAccount
AccountingDocumentType I_JournalEntry AccountingDocumentType
AccountingDocumentCategory I_JournalEntry AccountingDocumentCategory
@AbapCatalog.sqlViewName: 'PADLEDITEMTRKDOC'
@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_AddlLedgerAcctDocItemHistory
  as select from    I_AddlLedgerOplAcctgDocItem as bsegadd
    left outer join I_JournalEntry              as bkpf on  bsegadd.CompanyCode        = bkpf.CompanyCode
                                                        and bsegadd.FiscalYear         = bkpf.FiscalYear
                                                        and bsegadd.AccountingDocument = bkpf.AccountingDocument
{
  key    bsegadd.CompanyCode,
  key    bsegadd.AccountingDocument,
  key    bsegadd.FiscalYear,
         bsegadd.AccountingDocumentItem,
         bkpf.Ledger,
         bkpf.PostingDate,
         bkpf.DocumentDate,
         CreationTime                                                                                                                                                               as timestamp,
         CreationTime,
         AccountingDocumentCreationDate,
         replace(replace(concat( bsegadd.mandt, concat( rpad(bsegadd.CompanyCode, 4, '|'), concat( bsegadd.AccountingDocument, bsegadd.FiscalYear))), '|', '| |'), '|', '')                                                             as objectid,
         replace(replace(concat( bsegadd.mandt, concat( bkpf.LedgerGroup, concat( rpad(bsegadd.CompanyCode, 4, '|'), concat( bsegadd.FiscalYear, concat( bsegadd.AccountingDocument , AccountingDocumentItem))))), '|', '| |'), '|', '') as bsegadd_tabkey,
         bsegadd.FinancialAccountType,
         bsegadd.GLAccount,
         bkpf.AccountingDocumentType,
         bkpf.AccountingDocumentCategory
}
where
      bkpf.AccountingDocumentCategory <> 'C'
  and bkpf.AccountingDocumentCategory <> 'L'

union select from I_AddlLedgerOplAcctgDocItem as bsegadd
  left outer join I_JournalEntry              as bkpf on  bsegadd.CompanyCode        = bkpf.CompanyCode
                                                      and bsegadd.FiscalYear         = bkpf.FiscalYear
                                                      and bsegadd.AccountingDocument = bkpf.AccountingDocument
{
  key    bsegadd.CompanyCode,
  key    bsegadd.AccountingDocument,
  key    bsegadd.FiscalYear,
         bsegadd.AccountingDocumentItem,
         bkpf.Ledger,
         bkpf.PostingDate,
         bkpf.DocumentDate,
         CreationTime                                                                                                                                                         as timestamp,
         CreationTime,
         AccountingDocumentCreationDate,
         replace(replace(concat( bsegadd.mandt, concat( rpad(bsegadd.CompanyCode, 4, '|'), concat( bsegadd.AccountingDocument, bsegadd.FiscalYear))), '|', '| |'), '|', '')                                                     as objectid,
         replace(replace(concat( bsegadd.mandt,  concat( rpad(bsegadd.CompanyCode, 4, '|'), concat( bsegadd.AccountingDocument, concat( bsegadd.FiscalYear , AccountingDocumentItem)))), '|', '| |'), '|', '')                     as bsegadd_tabkey,
         bsegadd.FinancialAccountType,
         bsegadd.GLAccount,
         bkpf.AccountingDocumentType,
         bkpf.AccountingDocumentCategory
}
where
  bkpf.AccountingDocumentCategory = 'L'

union select from I_JournalEntryItem         as acdoca
  left outer join I_JournalEntry as bkpf on  acdoca.CompanyCode = bkpf.CompanyCode
                                         and acdoca.FiscalYear  = bkpf.FiscalYear
                                         and acdoca.AccountingDocument  = bkpf.AccountingDocument
{
  key    acdoca.CompanyCode,                                                                                                                                 
  key    acdoca.AccountingDocument,                                                                                                                                  
  key    acdoca.FiscalYear,                                                                                                                                  
         acdoca.LedgerGLLineItem     as AccountingDocumentItem,                                                                                                                            
         acdoca.SourceLedger as Ledger,                                                                                                                                  
         bkpf.PostingDate,
         bkpf.DocumentDate,
         CreationTime                                                                                                                                  as timestamp,
         CreationTime,
         AccountingDocumentCreationDate,
         replace(replace(concat( bkpf.mandt, concat( rpad(acdoca.CompanyCode, 4, '|'), concat( acdoca.AccountingDocument, acdoca.FiscalYear))), '|', '| |'), '|', '')                                                            as objectid,
         replace(replace(concat( bkpf.mandt, concat(acdoca.SourceLedger, concat( rpad(acdoca.CompanyCode, 4, '|'), concat( acdoca.FiscalYear, concat( acdoca.AccountingDocument , acdoca.LedgerGLLineItem ))))), '|', '| |'), '|', '')             as bsegadd_tabkey,
         acdoca.FinancialAccountType                                                                                                                 ,
         acdoca.GLAccount                                                                                                                                  ,
         bkpf.AccountingDocumentType,
         bkpf.AccountingDocumentCategory
}
where
  bkpf.AccountingDocumentCategory = 'L'
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_ADDLLEDGEROPLACCTGDOCITEM",
"I_JOURNALENTRY",
"I_JOURNALENTRYITEM"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/