@AbapCatalog.sqlViewName: 'PCLRDITM1'
@AbapCatalog.compiler.compareFilter: true
@VDM.viewType: #CONSUMPTION
@VDM.private: true
@AccessControl.authorizationCheck: #NOT_ALLOWED
@ClientHandling.algorithm: #SESSION_VARIABLE
define view P_ClearedItem1
as select from I_OperationalAcctgDocItem
{
key I_OperationalAcctgDocItem.CompanyCode,
key FiscalYear,
key AccountingDocument,
key AccountingDocumentItem,
FinancialAccountType,
ClearingJournalEntry,
ClearingJournalEntryFiscalYear,
AccountingDocumentType,
AccountingDocumentCategory,
AssignmentReference,
CompanyCodeCurrency,
DocumentDate,
DocumentItemText,
InvoiceReference,
FollowOnDocumentType,
PostingDate,
SpecialGLCode,
AccountingDocumentItemType,
PaymentCardItem,
AmountInCompanyCodeCurrency,
CashDiscountAmtInCoCodeCrcy,
AmountInAdditionalCurrency1,
AmountInAdditionalCurrency2,
cast(case
when FinancialAccountType = 'D' then
Customer
when FinancialAccountType = 'K' then
Supplier
when FinancialAccountType = 'S' then
GLAccount
else
''
end as konko) as Account
}
where
AccountingDocumentCategory <> 'M'
and AccountingDocumentCategory <> 'D'
and ClearingJournalEntry <> ''
and ClearingJournalEntryFiscalYear <> '0000'
and ReferenceDocumentType <> 'GLYEC'
and(
FinancialAccountType = 'D'
or FinancialAccountType = 'K'
or FinancialAccountType = 'S'
)
union all select from P_Bseg_Add
{
key P_Bseg_Add.CompanyCode,
key FiscalYear,
key AccountingDocument,
key AccountingDocumentItem,
FinancialAccountType,
ClearingJournalEntry,
ClearingJournalEntryFiscalYear,
AccountingDocumentType,
AccountingDocumentCategory,
AssignmentReference,
CompanyCodeCurrency,
DocumentDate,
DocumentItemText,
InvoiceReference,
FollowOnDocumentType,
PostingDate,
'' as SpecialGLCode,
AccountingDocumentItemType,
PaymentCardItem,
AmountInCompanyCodeCurrency,
0 as CashDiscountAmtInCoCodeCrcy,
AmountInAdditionalCurrency1,
AmountInAdditionalCurrency2,
cast (P_Bseg_Add.GLAccount as konko) as Account
}
where
AccountingDocumentCategory = 'L'
and ClearingJournalEntry <> ''
and ClearingJournalEntryFiscalYear <> '0000'
and ReferenceDocumentType <> 'GLYEC'
and(
FinancialAccountType = 'S'
)
union all select from P_ARLineItem_7
{
key CompanyCode,
key FiscalYear,
key AccountingDocument,
key AccountingDocumentItem,
'D' as FinancialAccountType,
ClearingAccountingDocument as ClearingJournalEntry,
ClearingDocFiscalYear as ClearingJournalEntryFiscalYear,
AccountingDocumentType,
cast(AccountingDocumentCategory as fis_bstat) as AccountingDocumentCategory,
AssignmentReference,
_CompanyCode.Currency as CompanyCodeCurrency,
DocumentDate,
DocumentItemText,
InvoiceReference,
FollowOnDocumentType,
PostingDate,
SpecialGLCode,
AccountingDocumentItemType,
PaymentCardItem,
AmountInCompanyCodeCurrency,
CashDiscountAmtInCoCodeCrcy,
AmountInAdditionalCurrency1,
AmountInAdditionalCurrency2,
cast( Debtor as konko ) as Account
}
where
ClearingDocFiscalYear <> '0000'
union all select from P_APLineItem_7
{
key CompanyCode,
key FiscalYear,
key AccountingDocument,
key AccountingDocumentItem,
'K' as FinancialAccountType,
ClearingAccountingDocument as ClearingJournalEntry,
ClearingDocFiscalYear as ClearingJournalEntryFiscalYear,
AccountingDocumentType,
cast(AccountingDocumentCategory as fis_bstat) as AccountingDocumentCategory,
AssignmentReference,
_CompanyCode.Currency as CompanyCodeCurrency,
DocumentDate,
DocumentItemText,
InvoiceReference,
FollowOnDocumentType,
PostingDate,
SpecialGLCode,
AccountingDocumentItemType,
'000' as PaymentCardItem,
AmountInCompanyCodeCurrency,
CashDiscountAmtInCoCodeCrcy,
AmountInAdditionalCurrency1,
AmountInAdditionalCurrency2,
cast( Supplier as konko ) as Account
}
where
ClearingDocFiscalYear <> '0000'
union all select from P_BSAS_BCK
{
key CompanyCode,
key FiscalYear,
key AccountingDocument,
key AccountingDocumentItem,
'S' as FinancialAccountType,
ClearingJournalEntry,
ClearingJournalEntryFiscalYear,
AccountingDocumentType,
AccountingDocumentCategory,
AssignmentReference,
_CompanyCode.Currency as CompanyCodeCurrency,
DocumentDate,
DocumentItemText,
'' as InvoiceReference,
'' as FollowOnDocumentType,
PostingDate,
'' as SpecialGLCode,
AccountingDocumentItemType,
PaymentCardItem,
AmountInCompanyCodeCurrency,
0 as CashDiscountAmtInCoCodeCrcy,
AmountInAdditionalCurrency1,
AmountInAdditionalCurrency2,
cast( GLAccount as konko ) as Account
}
where
ClearingJournalEntryFiscalYear <> '0000'
union all select from P_FAGLBSAS_BCK
{
key CompanyCode,
key FiscalYear,
key AccountingDocument,
key AccountingDocumentItem,
'S' as FinancialAccountType,
ClearingJournalEntry,
ClearingJournalEntryFiscalYear,
AccountingDocumentType,
AccountingDocumentCategory,
AssignmentReference,
_CompanyCode.Currency as CompanyCodeCurrency,
DocumentDate,
DocumentItemText,
InvoiceReference,
FollowOnDocumentType,
PostingDate,
'' as SpecialGLCode,
AccountingDocumentItemType,
PaymentCardItem,
AmountInCompanyCodeCurrency,
0 as CashDiscountAmtInCoCodeCrcy,
AmountInAdditionalCurrency1,
AmountInAdditionalCurrency2,
cast( GLAccount as konko ) as Account
}
where
ClearingJournalEntryFiscalYear <> '0000'
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_COMPANYCODE",
"I_OPERATIONALACCTGDOCITEM",
"P_APLINEITEM_7",
"P_ARLINEITEM_7",
"P_BSAS_BCK",
"P_BSEG_ADD",
"P_FAGLBSAS_BCK"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/