@AbapCatalog.sqlViewName: 'PCLRGDOC'
@AbapCatalog.compiler.compareFilter: true
@VDM.viewType: #CONSUMPTION
@VDM.private: true
@AccessControl.authorizationCheck: #NOT_ALLOWED
@ClientHandling.algorithm: #SESSION_VARIABLE
@Metadata.ignorePropagatedAnnotations: true
define view P_ClearingDocument
as select from I_JournalEntry
inner join P_ClearedItem1 as ClrdItm on I_JournalEntry.CompanyCode = ClrdItm.CompanyCode
and I_JournalEntry.AccountingDocument = ClrdItm.ClearingJournalEntry
and I_JournalEntry.FiscalYear = ClrdItm.ClearingJournalEntryFiscalYear
association [0..1] to P_ClearedItemCorrespondenceCnt as _CorrespondenceCnt on $projection.CompanyCode = _CorrespondenceCnt.CompanyCode
and $projection.ClearingJournalEntry = _CorrespondenceCnt.ClearingJournalEntry
and $projection.ClearingJournalEntryFiscalYear = _CorrespondenceCnt.ClearingJournalEntryFiscalYear
{
key I_JournalEntry.CompanyCode,
key cast(I_JournalEntry.AccountingDocument as fis_augbl preserving type) as ClearingJournalEntry,
key cast(I_JournalEntry.FiscalYear as fis_auggj_no_conv preserving type) as ClearingJournalEntryFiscalYear,
I_JournalEntry.AccountingDocumentType,
I_JournalEntry._AccountingDocumentType.AuthorizationGroup,
I_JournalEntry.IntercompanyTransaction,
I_JournalEntry.DocumentDate,
I_JournalEntry.PostingDate,
cast(I_JournalEntry.FiscalPeriod as fis_augperiod) as ClearingFiscalPeriod,
cast(I_JournalEntry.AccountingDocumentCreationDate as fis_augcp) as ClearingCreationDate,
I_JournalEntry.AccountingDocCreatedByUser,
I_JournalEntry.CompanyCodeCurrency,
I_JournalEntry.AccountingDocumentCategory,
I_JournalEntry._CompanyCode,
_CorrespondenceCnt
}
group by
I_JournalEntry.CompanyCode,
I_JournalEntry.AccountingDocument,
I_JournalEntry.FiscalYear,
I_JournalEntry.AccountingDocumentType,
I_JournalEntry._AccountingDocumentType.AuthorizationGroup,
I_JournalEntry.IntercompanyTransaction,
I_JournalEntry.DocumentDate,
I_JournalEntry.PostingDate,
I_JournalEntry.FiscalPeriod,
I_JournalEntry.AccountingDocumentCreationDate,
I_JournalEntry.AccountingDocCreatedByUser,
I_JournalEntry.CompanyCodeCurrency,
I_JournalEntry.AccountingDocumentCategory
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_ACCOUNTINGDOCUMENTTYPE",
"I_JOURNALENTRY",
"P_CLEAREDITEM1"
],
"ASSOCIATED":
[
"I_COMPANYCODE",
"P_CLEAREDITEMCORRESPONDENCECNT"
],
"BASE":
[
"I_JOURNALENTRY"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/