//Documentation about annotations can be found at http://help.sap.com searching for CDS annotations
@VDM.viewType: #CONSUMPTION
@Analytics: { dataCategory: #CUBE }
@AbapCatalog.sqlViewName: 'CNLSRACCTAXITMC'
@AbapCatalog.compiler.compareFilter: true
@EndUserText.label: '[Obsolete] NL VAT - Reported Tax Items'
@AccessControl.authorizationCheck: #CHECK
@AccessControl.personalData.blocking: #BLOCKED_DATA_INCLUDED
@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.dataClass: #MIXED
@Metadata.allowExtensions:true
////////////////////////////////////////////////////////////////////////////////////////////////////////
// This view creates a list of already reported tax items submitted to and accepted by the government
////////////////////////////////////////////////////////////////////////////////////////////////////////
define view C_NL_StRpAcceptedTaxItemCube
as select distinct from
I_StRpRepRun
inner join
I_StRpJournalEntryLog
on I_StRpJournalEntryLog.StatryRptCategory = I_StRpRepRun.StatryRptCategory
and I_StRpJournalEntryLog.StatryRptgEntity = I_StRpRepRun.StatryRptgEntity
and I_StRpJournalEntryLog.StatryRptRunID = I_StRpRepRun.StatryRptRunID
inner join
I_StRpTaxItemBoxCube
on I_StRpTaxItemBoxCube.AccountingDocument = I_StRpJournalEntryLog.AccountingDocument
and I_StRpTaxItemBoxCube.CompanyCode = I_StRpJournalEntryLog.CompanyCode
and I_StRpTaxItemBoxCube.FiscalYear = I_StRpJournalEntryLog.FiscalYear
{
key I_StRpRepRun.StatryRptgEntity,
key I_StRpRepRun.StatryRptCategory,
key I_StRpRepRun.StatryRptRunID,
key I_StRpJournalEntryLog.AccountingDocument,
key I_StRpJournalEntryLog.CompanyCode,
key I_StRpJournalEntryLog.FiscalYear,
key TaxCode,
key TransactionTypeDetermination,
key TaxBox,
key TaxDeclnAmountType,
key TaxItemGroupingVersion,
I_StRpTaxItemBoxCube.TaxItem,
PostingDate,
DocumentDate,
TaxReportingDate,
ReportingDate,
FiscalPeriod,
AccountingDocumentType,
DocumentReferenceID,
CompanyCodeCountry,
ReportingCountry,
TaxReturnCountry,
ExchangeRate,
TaxRate,
GLAccount,
BusinessPlace,
TaxJurisdiction,
LowestLevelTaxJurisdiction,
TaxNumber1,
TaxNumber2,
TaxNumber3,
BusinessPartner,
BusinessPartnerName,
CustomerSupplierAddress,
TaxType,
TargetTaxCode,
@Semantics.currencyCode:true
ReportingCurrency,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'ReportingCurrency'
case
when TaxBox = '06' or TaxBox = '10' or TaxBox = '11' or TaxBox = '62' or TaxBox = '63' then AmountInReportingCurrency
else - AmountInReportingCurrency
end as AmountInReportingCurrency,
@Semantics.currencyCode:true
DocumentCurrency,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'DocumentCurrency'
case
when TaxBox = '06' or TaxBox = '10' or TaxBox = '11' or TaxBox = '62' or TaxBox = '63' then AmountInTransactionCurrency
else - AmountInTransactionCurrency
end as AmountInTransactionCurrency,
@Semantics.currencyCode:true
AdditionalCurrency1,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'AdditionalCurrency1'
case
when TaxBox = '06' or TaxBox = '10' or TaxBox = '11' or TaxBox = '62' or TaxBox = '63' then AmountInAdditionalCurrency1
else - AmountInAdditionalCurrency1
end as AmountInAdditionalCurrency1,
@Semantics.currencyCode:true
AdditionalCurrency2,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'AdditionalCurrency2'
case
when TaxBox = '06' or TaxBox = '10' or TaxBox = '11' or TaxBox = '62' or TaxBox = '63' then AmountInAdditionalCurrency2
else - AmountInAdditionalCurrency2
end as AmountInAdditionalCurrency2
}
where
// Consider only already accepted runs
I_StRpRepRun.StatryRptRunStatus = 'SOK'
// Filter the documents where configuration is not maintained
and TaxDeclnAmountType <> ''
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_STRPJOURNALENTRYLOG",
"I_STRPREPRUN",
"I_STRPTAXITEMBOXCUBE"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/