P_RO_StRpDeferredItem

DDL: P_RO_STRPDEFERREDITEM SQL: PROVATDEFITM Type: view CONSUMPTION

RO: VAT 300 Deferred Items

P_RO_StRpDeferredItem is a Consumption CDS View that provides data about "RO: VAT 300 Deferred Items" in SAP S/4HANA. It reads from 3 data sources (I_OperationalAcctgDocItem, P_DEFTAX_ITEM_3, P_DEFTAX_ITEM_2) and exposes 43 fields with key fields CompanyCode, AccountingDocument, FiscalYear, StatryRptgEntity, StatryRptCategory.

Data Sources (3)

SourceAliasJoin Type
I_OperationalAcctgDocItem oadi left_outer
P_DEFTAX_ITEM_3 P_DEFTAX_ITEM_3 left_outer
P_DEFTAX_ITEM_2 trdti left_outer

Parameters (1)

NameTypeDefault
P_TaxReportingToDate vatdate

Annotations (12)

NameValueLevelField
AbapCatalog.sqlViewName PROVATDEFITM view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
AccessControl.authorizationCheck #CHECK view
AccessControl.personalData.blocking #BLOCKED_DATA_INCLUDED view
ClientHandling.algorithm #SESSION_VARIABLE view
EndUserText.label RO: VAT 300 Deferred Items view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.dataClass #MIXED view
VDM.private true view
VDM.viewType #CONSUMPTION view

Fields (43)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode strp CompanyCode
KEY AccountingDocument strp AccountingDocument
KEY FiscalYear strp FiscalYear
KEY StatryRptgEntity StatryRptgEntity
KEY StatryRptCategory StatryRptCategory
KEY StatryRptRunID StatryRptRunID
KEY TaxCode strp TaxCode
KEY TransactionTypeDetermination strp TransactionTypeDetermination
KEY ValidFrom ValidFrom
KEY TaxBoxStructureType TaxBoxStructureType
PostingDate strp PostingDate
DocumentDate strp DocumentDate
TaxReportingDate TaxReportingDate
ReportingDate ReportingDate
FiscalPeriod strp FiscalPeriod
AccountingDocumentType strp AccountingDocumentType
DocumentReferenceID DocumentReferenceID
CompanyCodeCountry CompanyCodeCountry
ReportingCountry ReportingCountry
TaxReturnCountry TaxReturnCountry
ExchangeRate ExchangeRate
TaxRate TaxRate
GLAccount strp GLAccount
BusinessPlace strp BusinessPlace
TaxJurisdiction strp TaxJurisdiction
LowestLevelTaxJurisdiction LowestLevelTaxJurisdiction
TaxNumber1 TaxNumber1
TaxNumber2 TaxNumber2
TaxNumber3 TaxNumber3
BusinessPartner BusinessPartner
BusinessPartnerName BusinessPartnerName
VATRegistration I_OperationalAcctgDocItem VATRegistration
CustomerSupplierAddress CustomerSupplierAddress
TaxType strp TaxType
TargetTaxCode TargetTaxCode
ClearingDate I_OperationalAcctgDocItem ClearingDate
ClearingAccountingDocument I_OperationalAcctgDocItem ClearingAccountingDocument
ClearingJournalEntry I_OperationalAcctgDocItem ClearingJournalEntry
ReportingCurrency ReportingCurrency
FiscalYearendasSortingNumber
TaxDeclnAmountType TaxDeclnAmountType
AmountInReportingCurrency AmountInReportingCurrency
PaymentPostingDateelseendasPaymentDate
@AbapCatalog.sqlViewName: 'PROVATDEFITM'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@AccessControl.personalData.blocking: #BLOCKED_DATA_INCLUDED
@ClientHandling.algorithm: #SESSION_VARIABLE
@EndUserText.label: 'RO: VAT 300 Deferred Items'
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.dataClass: #MIXED
@VDM.private: true
@VDM.viewType: #CONSUMPTION

define view P_RO_StRpDeferredItem  with parameters P_TaxReportingToDate : vatdate

  as select distinct from I_StRpTaxItemLog as strp
  
  left outer join P_DEFTAX_ITEM_3(P_TaxReportingToDate :$parameters.P_TaxReportingToDate) as dti on strp.CompanyCode = dti.CompanyCode and
                                           strp.AccountingDocument = dti.AccountingDocument and
                                           strp.FiscalYear = dti.FiscalYear and
                                           strp.TransactionTypeDetermination = dti.TransactionTypeDetermination and
                                           strp.TaxCode = dti.TaxCode //and

                                           //dti.TaxTransferDocument <> '' and

                                          //  dti.TaxTransferDocumentYear =  strp.FiscalYear

                                           
  left outer join P_DEFTAX_ITEM_2 as trdti on strp.CompanyCode = trdti.CompanyCode and   
                                              strp.AccountingDocument = trdti.TaxTransferDocument and
                                              strp.FiscalYear = trdti.TaxTransferDocumentYear
                                   
  left outer join I_OperationalAcctgDocItem as oadi on strp.CompanyCode = oadi.CompanyCode and
                                                       strp.AccountingDocument = oadi.AccountingDocument and
                                                       strp.FiscalYear = oadi.FiscalYear and
                                                       ( strp.TaxCode = oadi.TaxCode or oadi.TaxCode = '**' ) and
                                                       ( oadi.FinancialAccountType = 'K' or oadi.FinancialAccountType = 'D' )                                                       

{
  key strp.CompanyCode,
  key strp.AccountingDocument,
  key strp.FiscalYear,
  key StatryRptgEntity,
  key StatryRptCategory,
  key StatryRptRunID,
  key strp.TaxCode,
  key strp.TransactionTypeDetermination,
  key ValidFrom,
  key TaxBoxStructureType,
  
      strp.PostingDate,
      strp.DocumentDate,
      TaxReportingDate,
      ReportingDate,
      strp.FiscalPeriod,
      strp.AccountingDocumentType,
      DocumentReferenceID,
      CompanyCodeCountry,
      ReportingCountry,
      TaxReturnCountry,
      ExchangeRate,
      TaxRate,
      strp.GLAccount,
      strp.BusinessPlace,
      strp.TaxJurisdiction,
      LowestLevelTaxJurisdiction,
      TaxNumber1,
      TaxNumber2,
      TaxNumber3,
      BusinessPartner,
      BusinessPartnerName,
      oadi.VATRegistration,
      CustomerSupplierAddress,
      strp.TaxType,
      TargetTaxCode,
      oadi.ClearingDate,
      @API.element.releaseState: #DEPRECATED
      @API.element.successor:    'ClearingJournalEntry'
      @VDM.lifecycle.status:    #DEPRECATED
      @VDM.lifecycle.successor: 'ClearingJournalEntry'
      oadi.ClearingAccountingDocument,
      @Analytics.internalName: #LOCAL
      oadi.ClearingJournalEntry,
      @Semantics.currencyCode:true
      ReportingCurrency,
      
      case
        when TargetTaxCode is not initial
          then concat(strp.CompanyCode, concat('/',concat(strp.AccountingDocument,concat('/',strp.FiscalYear))))
        else concat(strp.CompanyCode, concat('/',concat(trdti.AccountingDocument,concat('/',trdti.FiscalYear))))
      end as SortingNumber,
      
      TaxDeclnAmountType,
      
      //NonEligibleBaseAmount

      @DefaultAggregation:#SUM
      @Semantics.amount.currencyCode: 'ReportingCurrency'
      case 
        when TaxDeclnAmountType = 'B' and CompanyCodeCountry = ReportingCountry
          then AmountInReportingCurrency - coalesce(dti.PartialBaseAmtInLocalCrcy,0)
        when TaxDeclnAmountType = 'B'
          then AmountInReportingCurrency - coalesce(dti.PartialBaseAmtInNationalCrcy,0)
        else
          0
      end as  TaxBox33AmtInReportingCurrency,
      
      //NonEligibleVatAmount

      @DefaultAggregation:#SUM
      @Semantics.amount.currencyCode: 'ReportingCurrency'
      case 
        when TaxDeclnAmountType = 'T' and CompanyCodeCountry = ReportingCountry
          then AmountInReportingCurrency - coalesce(dti.PartialTaxAmtInLocalCrcy,0)
        when TaxDeclnAmountType = 'T'
          then AmountInReportingCurrency - coalesce(dti.PartialTaxAmtInNationalCrcy,0)
        else
          0
      end as  TaxBox34AmtInReportingCurrency,
      
      AmountInReportingCurrency,
      
      case
      //invoice - full payment

        when strp.TargetTaxCode is not initial
          then  oadi.ClearingJournalEntry
      //transfer document

        when strp.TargetTaxCode is initial
          then trdti.PaymentAccountingDocument
        else ''
      end as PaymentDocument,
      
      case
      //invoice - full payment

        when strp.TargetTaxCode is not initial
          then  oadi.ClearingDate
      //transfer document

        when strp.TargetTaxCode is initial
          then trdti.PaymentPostingDate
        else ''
      end as PaymentDate

}
where
      TaxBox <> ''  and
      ReportingCountry =  'RO'  and
      TargetTaxCode <> '' and
      ( TaxDeclnAmountType = 'T' or TaxDeclnAmountType = 'B' )
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_OPERATIONALACCTGDOCITEM",
"I_STRPTAXITEMLOG",
"P_DEFTAX_ITEM_2",
"P_DEFTAX_ITEM_3"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/