@AbapCatalog.sqlViewName: 'PAREDUPHEATOT'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.dataClass: #MIXED
@VDM.viewType: #CONSUMPTION
@VDM.private: true
@ClientHandling.algorithm: #SESSION_VARIABLE
define view P_AR_EDplDocumentTotal
with parameters
@Consumption.defaultValue:'X'
P_RptgAmountIsInTransCrcy : fiar_use_transaction_currency,
P_FromReportingDate : glo_reporting_date,
P_ToReportingDate : glo_reporting_date
as select from P_AR_EDplDocAggregatedAmount ( P_RptgAmountIsInTransCrcy: $parameters.P_RptgAmountIsInTransCrcy )
as AggregatedAmount
inner join I_StRpJournalEntryHeaderLog as StRpJournalEntryLog on StRpJournalEntryLog.CompanyCode = AggregatedAmount.CompanyCode
and StRpJournalEntryLog.FiscalYear = AggregatedAmount.FiscalYear
and StRpJournalEntryLog.AccountingDocument = AggregatedAmount.AccountingDocument
left outer to one join P_AR_CustomerReceivableTotal as CustomerReceivableTotal on CustomerReceivableTotal.CompanyCode = AggregatedAmount.CompanyCode
and CustomerReceivableTotal.FiscalYear = AggregatedAmount.FiscalYear
and CustomerReceivableTotal.AccountingDocument = AggregatedAmount.AccountingDocument
{
key AggregatedAmount.CompanyCode,
key AggregatedAmount.FiscalYear,
key StRpJournalEntryLog.StatryRptgEntity,
key StRpJournalEntryLog.StatryRptCategory,
key StRpJournalEntryLog.StatryRptRunID,
AggregatedAmount.CompanyCodeCurrency,
cast( count( * ) as fiar_number_of_records preserving type ) as NumberOfRecords,
@Semantics.currencyCode:true
AggregatedAmount.CompanyCodeCurrency as ReportingCurrency,
@Semantics.amount.currencyCode: 'ReportingCurrency'
cast(
sum(
case $parameters.P_RptgAmountIsInTransCrcy
when 'X'
then CustomerReceivableTotal.AmountInTransactionCurrency
else CustomerReceivableTotal.AmountInCompanyCodeCurrency
end
) as glo_amount_rptg_crcy preserving type
) as TotalGrossAmountInRptgCrcy,
@Semantics.amount.currencyCode: 'ReportingCurrency'
cast(
sum(
case $parameters.P_RptgAmountIsInTransCrcy
when 'X'
then CustomerReceivableTotal.AmountInTransactionCurrency
else CustomerReceivableTotal.AmountInCompanyCodeCurrency
end
) as glo_amount_rptg_crcy preserving type
) as AmountInReportingCurrency,
@Semantics.amount.currencyCode: 'ReportingCurrency'
cast( sum(AggregatedAmount.NotTaxedAmount) as fi_ar_nottax_amnt preserving type ) as NotTaxedAmount,
@Semantics.amount.currencyCode: 'ReportingCurrency'
cast( sum(AggregatedAmount.NotRegisteredBPTxAmtInRptgCrcy) as fiar_notreg_bptaxamount preserving type ) as NotRegisteredBPTxAmtInRptgCrcy,
@Semantics.amount.currencyCode: 'ReportingCurrency'
cast( sum(AggregatedAmount.TaxExemptionAmount) as fiar_exempted_amount preserving type ) as TaxExemptionAmount,
@Semantics.amount.currencyCode: 'ReportingCurrency'
cast( sum(AggregatedAmount.PerceptionVATAmount) as fi_ar_perpvat_amnt preserving type ) as PerceptionVATAmount,
@Semantics.amount.currencyCode: 'ReportingCurrency'
cast( sum(AggregatedAmount.GrossIncomeTaxAmount) as fiar_provincial_tax_amount preserving type ) as GrossIncomeTaxAmount,
@Semantics.amount.currencyCode: 'ReportingCurrency'
cast( sum(AggregatedAmount.MunicipalTaxAmount) as fi_ar_mptax_amnt preserving type ) as MunicipalTaxAmount,
@Semantics.amount.currencyCode: 'ReportingCurrency'
cast( sum(AggregatedAmount.OpenTotalTaxAmount) as fiar_internal_tax_amount preserving type ) as OpenTotalTaxAmount,
@Semantics.amount.currencyCode: 'ReportingCurrency'
cast( sum(AggregatedAmount.OtherTaxAmount) as fiar_other_tax_amount preserving type ) as OtherTaxAmount,
@Semantics.amount.currencyCode: 'ReportingCurrency'
cast( sum(AggregatedAmount.NetTaxAmount) as fiar_net_tax_amount preserving type ) as NetTaxAmount,
@Semantics.amount.currencyCode: 'ReportingCurrency'
cast( sum(AggregatedAmount.TaxedAmountInRptgCrcy) as fiar_taxed_base_amount preserving type ) as TaxedAmountInRptgCrcy
}
where
AggregatedAmount.ReportingDate between $parameters.P_FromReportingDate and $parameters.P_ToReportingDate
group by
AggregatedAmount.CompanyCode,
AggregatedAmount.FiscalYear,
AggregatedAmount.CompanyCodeCurrency,
StRpJournalEntryLog.StatryRptgEntity,
StRpJournalEntryLog.StatryRptCategory,
StRpJournalEntryLog.StatryRptRunID
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_STRPJOURNALENTRYHEADERLOG",
"P_AR_CUSTOMERRECEIVABLETOTAL",
"P_AR_EDPLDOCAGGREGATEDAMOUNT"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/