@AbapCatalog.sqlViewName: 'CCLSTRPJEITM'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@ObjectModel.usageType.sizeCategory: #XXL
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.dataClass: #MIXED
@VDM.viewType: #CONSUMPTION
@Analytics: { dataCategory: #CUBE }
@Analytics.internalName:#LOCAL
@ClientHandling.algorithm: #SESSION_VARIABLE
@AccessControl.personalData.blocking: #BLOCKED_DATA_INCLUDED
@EndUserText.label: 'Jrnl Entr Items for Chile Reporting Cube'
@Metadata.allowExtensions:true
define view C_CL_StRpJournalEntryItemCube
with parameters
P_ReportingCurrency : glo_reporting_currency
as select from I_JournalEntryOperationalView as I_JournalEntryItem
inner join I_StRpJournalEntryLog on I_JournalEntryItem.CompanyCode = I_StRpJournalEntryLog.CompanyCode
and I_JournalEntryItem.AccountingDocument = I_StRpJournalEntryLog.AccountingDocument
and I_JournalEntryItem.FiscalYear = I_StRpJournalEntryLog.FiscalYear
left outer to one join I_OneTimeAccountBP on I_JournalEntryItem.CompanyCode = I_OneTimeAccountBP.CompanyCode
and I_JournalEntryItem.FiscalYear = I_OneTimeAccountBP.FiscalYear
and I_JournalEntryItem.AccountingDocument = I_OneTimeAccountBP.AccountingDocument
and I_JournalEntryItem.AccountingDocumentItem = I_OneTimeAccountBP.AccountingDocumentItem
left outer to one join I_CL_DocTypeVchrTypeAssgmt on I_CL_DocTypeVchrTypeAssgmt.Country = 'CL'
and I_JournalEntryItem.CompanyCode = I_CL_DocTypeVchrTypeAssgmt.CompanyCode
and I_JournalEntryItem.AccountingDocumentType = I_CL_DocTypeVchrTypeAssgmt.AccountingDocumentType
association [0..1] to I_Currency as _ReportingCurrency on Currency = ReportingCurrency
{
key SourceLedger,
key I_JournalEntryItem.CompanyCode,
key I_JournalEntryItem.FiscalYear,
key I_JournalEntryItem.AccountingDocument,
key LedgerGLLineItem,
key Ledger,
key StatryRptgEntity,
key StatryRptCategory,
key StatryRptRunID,
AccountingDocumentHeaderText,
DocumentReferenceID,
I_JournalEntryItem.AccountingDocumentType,
//in output XML file the target element "TpoDocumTpoDocum" has maxLength = 15
cast( substring(_JournalEntry._AccountingDocumentTypeText[1:Language = $session.system_language].AccountingDocumentTypeName, 1, 15) as farp_ltext_003t ) as AccountingDocumentTypeName,
CL_ReportingDocumentType,
AccountingDocumentCategory,
FinancialAccountType,
GLRecordType,
GLAccountType,
GLAccount,
AlternativeGLAccount,
ChartOfAccounts,
CountryChartOfAccounts,
FiscalPeriod,
FiscalYearVariant,
FiscalYearPeriod,
DocumentDate,
PostingDate,
NetDueDate,
I_JournalEntryItem.AccountingDocumentItem,
FinancialTransactionType,
IsReversal,
IsReversed,
ReversalReferenceDocumentCntxt,
ReversalReferenceDocument,
CostCenter,
ProfitCenter,
FunctionalArea,
BusinessArea,
Segment,
//in output XML file the target element "Glosa" has maxLength = 15
cast( substring ( DocumentItemText, 1, 30) as farp_sgtxt ) as DocumentItemText,
SpecialGLCode,
TaxCode,
ClearingDate,
cast( '' as fis_augbl ) as ClearingAccountingDocument,
cast( '0000' as fis_auggj ) as ClearingDocFiscalYear,
Supplier,
Customer,
cast( case
when I_OneTimeAccountBP.AccountingDocument is not null
then I_OneTimeAccountBP.TaxID1
when FinancialAccountType = 'K'
then _Supplier.TaxNumber1
when FinancialAccountType = 'D'
then _Customer.TaxNumber1
else
''
end
as stcd1 preserving type ) as TaxNumber1,
cast( case
when I_OneTimeAccountBP.AccountingDocument is not null
then concat_with_space( I_OneTimeAccountBP.BusinessPartnerName1, I_OneTimeAccountBP.BusinessPartnerName2, 1)
when FinancialAccountType = 'K'
then _Supplier._SupplierToBusinessPartner._BusinessPartner.BusinessPartnerName
when FinancialAccountType = 'D'
then _Customer._CustomerToBusinessPartner._BusinessPartner.BusinessPartnerName
else
''
end
as businesspartnername ) as BusinessPartnerName,
DebitCreditCode,
CompanyCodeCurrency,
@ObjectModel.foreignKey.association: '_ReportingCurrency'
@Semantics.currencyCode:true
cast( $parameters.P_ReportingCurrency as glo_reporting_currency preserving type ) as ReportingCurrency,
@DefaultAggregation: #SUM
@Semantics.amount.currencyCode: 'ReportingCurrency'
cast(
case $parameters.P_ReportingCurrency
when I_JournalEntryItem.CompanyCodeCurrency
then -CreditAmountInCoCodeCrcy
when I_JournalEntryItem.TransactionCurrency
then -CreditAmountInTransCrcy
when GlobalCurrency
then -CreditAmountInGlobalCrcy
when BalanceTransactionCurrency
then -CreditAmountInBalanceTransCrcy
when FreeDefinedCurrency1
then -CreditAmountInFreeDefinedCrcy1
when FreeDefinedCurrency2
then -CreditAmountInFreeDefinedCrcy2
when FreeDefinedCurrency3
then -CreditAmountInFreeDefinedCrcy3
when FreeDefinedCurrency4
then -CreditAmountInFreeDefinedCrcy4
when FreeDefinedCurrency5
then CreditAmountInFreeDefinedCrcy5
when FreeDefinedCurrency6
then -CreditAmountInFreeDefinedCrcy6
when FreeDefinedCurrency7
then -CreditAmountInFreeDefinedCrcy7
when FreeDefinedCurrency8
then -CreditAmountInFreeDefinedCrcy8
else
0
end
as glo_credit_amount_rptg_crcy preserving type ) as CreditAmountInReportingCrcy,
@DefaultAggregation: #SUM
@Semantics.amount.currencyCode: 'ReportingCurrency'
cast(
case $parameters.P_ReportingCurrency
when I_JournalEntryItem.CompanyCodeCurrency
then DebitAmountInCoCodeCrcy
when I_JournalEntryItem.TransactionCurrency
then DebitAmountInTransCrcy
when GlobalCurrency
then DebitAmountInGlobalCrcy
when BalanceTransactionCurrency
then DebitAmountInBalanceTransCrcy
when FreeDefinedCurrency1
then DebitAmountInFreeDefinedCrcy1
when FreeDefinedCurrency2
then DebitAmountInFreeDefinedCrcy2
when FreeDefinedCurrency3
then DebitAmountInFreeDefinedCrcy3
when FreeDefinedCurrency4
then DebitAmountInFreeDefinedCrcy4
when FreeDefinedCurrency5
then DebitAmountInFreeDefinedCrcy5
when FreeDefinedCurrency6
then DebitAmountInFreeDefinedCrcy6
when FreeDefinedCurrency7
then DebitAmountInFreeDefinedCrcy7
when FreeDefinedCurrency8
then DebitAmountInFreeDefinedCrcy8
else
0
end
as glo_debit_amount_rptg_crcy preserving type ) as DebitAmountInReportingCurrency,
@DefaultAggregation: #SUM
@Semantics.amount.currencyCode: 'ReportingCurrency'
cast(
case $parameters.P_ReportingCurrency
when I_JournalEntryItem.CompanyCodeCurrency
then AmountInCompanyCodeCurrency
when I_JournalEntryItem.TransactionCurrency
then AmountInTransactionCurrency
when GlobalCurrency
then AmountInGlobalCurrency
when BalanceTransactionCurrency
then AmountInBalanceTransacCrcy
when FreeDefinedCurrency1
then AmountInFreeDefinedCurrency1
when FreeDefinedCurrency2
then AmountInFreeDefinedCurrency2
when FreeDefinedCurrency3
then AmountInFreeDefinedCurrency3
when FreeDefinedCurrency4
then AmountInFreeDefinedCurrency4
when FreeDefinedCurrency5
then AmountInFreeDefinedCurrency5
when FreeDefinedCurrency6
then AmountInFreeDefinedCurrency6
when FreeDefinedCurrency7
then AmountInFreeDefinedCurrency7
when FreeDefinedCurrency8
then AmountInFreeDefinedCurrency8
else
0
end
as glo_amount_rptg_crcy preserving type ) as AmountInReportingCurrency,
_ReportingCurrency
}
where AccountingDocumentCategory = ' '
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_ACCOUNTINGDOCUMENTTYPETEXT",
"I_BUSINESSPARTNER",
"I_CL_DOCTYPEVCHRTYPEASSGMT",
"I_CUSTOMER",
"I_CUSTOMERTOBUSINESSPARTNER",
"I_JOURNALENTRY",
"I_JOURNALENTRYOPERATIONALVIEW",
"I_ONETIMEACCOUNTBP",
"I_STRPJOURNALENTRYLOG",
"I_SUPPLIER",
"I_SUPPLIERTOBUSINESSPARTNER"
],
"ASSOCIATED":
[
"I_CURRENCY"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/