@AbapCatalog.sqlViewName: 'PJPGRDOCHD'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ClientHandling.algorithm: #SESSION_VARIABLE
@VDM.viewType: #COMPOSITE
@VDM.private:true
@ObjectModel: { usageType.serviceQuality: #D,
usageType.sizeCategory: #XXL,
usageType.dataClass: #MIXED }
//@EndUserText.label: 'Goods Receipt Document Header List'
define view P_JP_GRDocumentHeader
as select distinct from I_GLAccountLineItem as I_GLAccountLineItem
inner join I_AccountingDocument as Header on I_GLAccountLineItem.CompanyCode = Header.CompanyCode
and I_GLAccountLineItem.FiscalYear = Header.FiscalYear
and I_GLAccountLineItem.AccountingDocument = Header.AccountingDocument
association [1..1] to I_JournalEntry as _JournalEntry on $projection.CompanyCode = _JournalEntry.CompanyCode
and $projection.FiscalYear = _JournalEntry.FiscalYear
and $projection.AccountingDocument = _JournalEntry.AccountingDocument
// left outer to many join P_JP_IRDocumentHeader as IR_Header on I_GLAccountLineItem.SourceLedger = IR_Header.SourceLedger
// and I_GLAccountLineItem.CompanyCode = IR_Header.CompanyCode
// and I_GLAccountLineItem.FiscalYear = IR_Header.FiscalYear
// and I_GLAccountLineItem.AccountingDocument = IR_Header.AccountingDocument
// and I_GLAccountLineItem.Ledger = IR_Header.Ledger
{
key I_GLAccountLineItem.SourceLedger,
key I_GLAccountLineItem.CompanyCode,
key I_GLAccountLineItem.FiscalYear,
key I_GLAccountLineItem.AccountingDocument,
key I_GLAccountLineItem.Ledger,
key I_GLAccountLineItem.ReferenceDocument,
I_GLAccountLineItem.Supplier,
Header.AccountingDocumentHeaderText,
_SourceLedger,
_CompanyCode,
_FiscalYear,
_JournalEntry,
_Ledger,
_Supplier
}
where
I_GLAccountLineItem.AccountingDocument <> I_GLAccountLineItem.ClearingAccountingDocument
and SpecialGLCode = ''
// and ( FinancialAccountType = 'M' or
// FinancialAccountType = 'S' )
and I_GLAccountLineItem.Supplier <> ''
and Header.ReferenceDocumentType = 'MKPF'
and I_GLAccountLineItem.IsReversal <> 'X'
and I_GLAccountLineItem.IsReversed = ''
and FollowOnDocumentType is initial
// and IR_Header.AccountingDocument is null