C_PL_StRpTxItmWithEUTxClCrrtnC

DDL: C_PL_STRPTXITMWITHEUTXCLCRRTNC SQL: CSRPLEUTXCLFNCC Type: view CONSUMPTION

EU Sales Tax Item View - Correction Run

C_PL_StRpTxItmWithEUTxClCrrtnC is a Consumption CDS View (Cube) that provides data about "EU Sales Tax Item View - Correction Run" in SAP S/4HANA. It reads from 6 data sources and exposes 32 fields with key fields CompanyCode, AccountingDocument, FiscalYear, TaxCode, TransactionTypeDetermination. It has 1 association to related views.

Data Sources (6)

SourceAliasJoin Type
I_StRpRepRun CurrRun left_outer
I_StRpJournalEntryLog I_StRpJournalEntryLog left_outer
I_StRpTaxItmWithEUTaxClass I_StRpTaxItmWithEUTaxClass from
I_StRpRepRun LastAccRun left_outer
P_PL_StRpReportingGroupsCr P_PL_StRpReportingGroupsCr inner
P_T007B_GLO P_T007B_GLO inner

Associations (1)

CardinalityTargetAliasCondition
[0..1] I_JournalEntry _JournalEntry $projection.AccountingDocument = _JournalEntry.AccountingDocument and $projection.CompanyCode = _JournalEntry.CompanyCode and $projection.FiscalYear = _JournalEntry.FiscalYear

Annotations (12)

NameValueLevelField
AbapCatalog.sqlViewName CSRPLEUTXCLFNCC view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #CHECK view
AccessControl.personalData.blocking #BLOCKED_DATA_INCLUDED view
Analytics.dataCategory #CUBE view
ClientHandling.algorithm #SESSION_VARIABLE view
EndUserText.label EU Sales Tax Item View - Correction Run view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.serviceQuality #X view
ObjectModel.usageType.sizeCategory #XL view
VDM.viewType #CONSUMPTION view
Metadata.allowExtensions true view

Fields (32)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode I_StRpTaxItmWithEUTaxClass CompanyCode
KEY AccountingDocument I_StRpTaxItmWithEUTaxClass AccountingDocument
KEY FiscalYear I_StRpTaxItmWithEUTaxClass FiscalYear
KEY TaxCode I_StRpTaxItmWithEUTaxClass TaxCode
KEY TransactionTypeDetermination I_StRpTaxItmWithEUTaxClass TransactionTypeDetermination
KEY TaxItem I_StRpTaxItmWithEUTaxClass TaxItem
KEY StatryRptCategory I_StRpTaxItmWithEUTaxClass StatryRptCategory
KEY StatryRptRunID I_StRpTaxItmWithEUTaxClass StatryRptRunID
KEY StatryRptgEntity I_StRpTaxItmWithEUTaxClass StatryRptgEntity
Debtor Debtor
VATRegistration I_StRpTaxItmWithEUTaxClass VATRegistration
VATRegistrationCountry
TaxItemGroup I_StRpTaxItmWithEUTaxClass TaxItemGroup
TaxJurisdiction I_StRpTaxItmWithEUTaxClass TaxJurisdiction
Country I_StRpTaxItmWithEUTaxClass Country
ReportingCurrency ReportingCurrency
ReportingCountry ReportingCountry
IsReversal IsReversal
IsReversed IsReversed
TaxableEntity TaxableEntity
ReportingDate ReportingDate
PostingDate PostingDate
DocumentDate DocumentDate
TaxReportingDate I_StRpTaxItmWithEUTaxClass TaxReportingDate
IsEUTriangularDeal I_StRpTaxItmWithEUTaxClass IsEUTriangularDeal
DelivOfGoodsDestCountry DelivOfGoodsDestCountry
DelivOfGoodsOriginCountry DelivOfGoodsOriginCountry
EUTaxClassification EUTaxClassification
TaxType I_StRpTaxItmWithEUTaxClass TaxType
BusinessPartner BusinessPartner
BusinessPartnerName BusinessPartnerName
DocumentReferenceID _JournalEntry DocumentReferenceID
@AbapCatalog.sqlViewName: 'CSRPLEUTXCLFNCC'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@AccessControl.personalData.blocking: #BLOCKED_DATA_INCLUDED
@Analytics.dataCategory: #CUBE
@ClientHandling.algorithm: #SESSION_VARIABLE
@EndUserText.label: 'EU Sales Tax Item View - Correction Run'
@ObjectModel.usageType.dataClass: #MIXED
@ObjectModel.usageType.serviceQuality: #X
@ObjectModel.usageType.sizeCategory: #XL
@VDM.viewType: #CONSUMPTION
@Metadata.allowExtensions:true


define view C_PL_StRpTxItmWithEUTxClCrrtnC
  as select from I_StRpTaxItmWithEUTaxClass

        inner join P_T007B_GLO
          on P_T007B_GLO.ktosl = I_StRpTaxItmWithEUTaxClass.TransactionTypeDetermination

        left outer join I_StRpRepRun as CurrRun on  I_StRpTaxItmWithEUTaxClass.StatryRptgEntity  = CurrRun.StatryRptgEntity
                                                and I_StRpTaxItmWithEUTaxClass.StatryRptCategory = CurrRun.StatryRptCategory
                                                and I_StRpTaxItmWithEUTaxClass.StatryRptRunID = CurrRun.StatryRptRunID

        left outer join I_StRpRepRun as LastAccRun on  I_StRpTaxItmWithEUTaxClass.StatryRptgEntity  = LastAccRun.StatryRptgEntity
                                                   and I_StRpTaxItmWithEUTaxClass.StatryRptCategory = LastAccRun.StatryRptCategory
                                                   and LastAccRun.StatryRptTaskUUID = CurrRun.StatryRptTaskUUID
                                                   and LastAccRun.StatryRptRunType = 'STAND'
                                                   and LastAccRun.StatryRptRunStatus = 'SOK'

        left outer join I_StRpJournalEntryLog on  LastAccRun.StatryRptgEntity  = I_StRpJournalEntryLog.StatryRptgEntity
                                              and LastAccRun.StatryRptCategory = I_StRpJournalEntryLog.StatryRptCategory
                                              and LastAccRun.StatryRptRunID    = I_StRpJournalEntryLog.StatryRptRunID
                                              and I_StRpJournalEntryLog.CompanyCode = I_StRpTaxItmWithEUTaxClass.CompanyCode
                                              and I_StRpJournalEntryLog.AccountingDocument = I_StRpTaxItmWithEUTaxClass.AccountingDocument
                                              and I_StRpJournalEntryLog.FiscalYear = I_StRpTaxItmWithEUTaxClass.FiscalYear

        inner join P_PL_StRpReportingGroupsCr on  I_StRpTaxItmWithEUTaxClass.StatryRptgEntity  = P_PL_StRpReportingGroupsCr.StatryRptgEntity
                                                and I_StRpTaxItmWithEUTaxClass.StatryRptCategory = P_PL_StRpReportingGroupsCr.StatryRptCategory
                                                and I_StRpTaxItmWithEUTaxClass.StatryRptRunID = P_PL_StRpReportingGroupsCr.StatryRptRunID
                                                and I_StRpTaxItmWithEUTaxClass.CompanyCode = P_PL_StRpReportingGroupsCr.CompanyCode
                                                and (I_StRpTaxItmWithEUTaxClass.VATRegistration = P_PL_StRpReportingGroupsCr.VATRegistration
                                                  or (I_StRpTaxItmWithEUTaxClass.VATRegistration is null and P_PL_StRpReportingGroupsCr.VATRegistration is null))
                                                and
                                                ((P_PL_StRpReportingGroupsCr.OfficialTaxOperationKey = 'G' and
                                                   (I_StRpTaxItmWithEUTaxClass.EUTaxClassification = '1' or I_StRpTaxItmWithEUTaxClass.EUTaxClassification = '3' or I_StRpTaxItmWithEUTaxClass.EUTaxClassification = '9'))
                                                 or
                                                 (P_PL_StRpReportingGroupsCr.OfficialTaxOperationKey = 'S' and
                                                   (I_StRpTaxItmWithEUTaxClass.EUTaxClassification = '4'))
                                                )
                                                and I_StRpTaxItmWithEUTaxClass.TaxType = P_PL_StRpReportingGroupsCr.TaxType
                                                and (I_StRpTaxItmWithEUTaxClass.IsEUTriangularDeal = P_PL_StRpReportingGroupsCr.IsEUTriangularDeal
                                                  or (I_StRpTaxItmWithEUTaxClass.IsEUTriangularDeal is null and P_PL_StRpReportingGroupsCr.IsEUTriangularDeal is null))

        association [0..1] to I_JournalEntry as _JournalEntry           on  $projection.AccountingDocument      = _JournalEntry.AccountingDocument
                                                                        and $projection.CompanyCode             = _JournalEntry.CompanyCode
                                                                        and $projection.FiscalYear              = _JournalEntry.FiscalYear

{
  key I_StRpTaxItmWithEUTaxClass.CompanyCode,
  key I_StRpTaxItmWithEUTaxClass.AccountingDocument,
  key I_StRpTaxItmWithEUTaxClass.FiscalYear,
  key I_StRpTaxItmWithEUTaxClass.TaxCode,
  key I_StRpTaxItmWithEUTaxClass.TransactionTypeDetermination,
  key I_StRpTaxItmWithEUTaxClass.TaxItem,
  key I_StRpTaxItmWithEUTaxClass.StatryRptCategory,
  key I_StRpTaxItmWithEUTaxClass.StatryRptRunID,
  key I_StRpTaxItmWithEUTaxClass.StatryRptgEntity,
      Debtor,
      case IsOneTimeAccount
        when 'X' then _OneTimeAccount.BusinessPartnerName1
        else CustomerName
      end as CustomerName,
      I_StRpTaxItmWithEUTaxClass.VATRegistration,
      cast(substring(I_StRpTaxItmWithEUTaxClass.VATRegistration, 1, 2) as stceg_l) as VATRegistrationCountry,
      cast(substring(I_StRpTaxItmWithEUTaxClass.VATRegistration, 3, 18) as farp_stceg )as ReportingVATRegistration,
      I_StRpTaxItmWithEUTaxClass.TaxItemGroup,
      I_StRpTaxItmWithEUTaxClass.TaxJurisdiction,
      I_StRpTaxItmWithEUTaxClass.Country,
      @Semantics.currencyCode:true
      ReportingCurrency,
      @DefaultAggregation:#SUM
      @Semantics.amount.currencyCode: 'ReportingCurrency'
      cast(
          (case
            when I_StRpTaxItmWithEUTaxClass.TaxType = 'A' and stgrp = '2' then AmountInReportingCurrency
            when I_StRpTaxItmWithEUTaxClass.TaxType = 'A' then (AmountInReportingCurrency * -1)
            when I_StRpTaxItmWithEUTaxClass.TaxType = 'V' and stgrp = '1' then (AmountInReportingCurrency * -1)
            else AmountInReportingCurrency
          end)
      as glo_amount_rptg_crcy) as AmountInReportingCurrency,
      ReportingCountry,
      IsReversal,
      IsReversed,
      TaxableEntity,
      ReportingDate,
      PostingDate,
      DocumentDate,
      I_StRpTaxItmWithEUTaxClass.TaxReportingDate,
      I_StRpTaxItmWithEUTaxClass.IsEUTriangularDeal,
      DelivOfGoodsDestCountry,
      DelivOfGoodsOriginCountry,
      EUTaxClassification,
      I_StRpTaxItmWithEUTaxClass.TaxType,
      cast((case
        when EUTaxClassification = '1' or EUTaxClassification = '3' or EUTaxClassification = '9' then 'G'
        when EUTaxClassification = '4' then 'S'
        when EUTaxClassification = 'C' then 'C'
      end) as fipl_ecsl_operation_key) as OfficialTaxOperationKey,
      cast((case
        when I_StRpJournalEntryLog.AccountingDocument is not null then '1'
        else '0'
      end) as fipl_ecsl_document_status) as InternalDocumentStatus,
      cast(case
        when EUTaxClassification = 'C' and TaxDebitCreditCode = 'H' then
          '1'
        when EUTaxClassification = 'C' and TaxDebitCreditCode = 'S' then
          '2'
        else
          ''
      end as fipl_ecsl_cos preserving type) as EUTaxClassForCallOffStock,
      BusinessPartner,
      BusinessPartnerName,
      _JournalEntry.DocumentReferenceID

}
where
      (EUTaxClassification = '1' or EUTaxClassification = '3' or EUTaxClassification = '9' or EUTaxClassification = '4' or EUTaxClassification = 'C') and
      ReportingCountry = 'PL'
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_JOURNALENTRY",
"I_ONETIMEACCOUNTBP",
"I_STRPJOURNALENTRYLOG",
"I_STRPREPRUN",
"I_STRPTAXITMWITHEUTAXCLASS",
"P_PL_STRPREPORTINGGROUPSCR",
"P_T007B_GLO"
],
"ASSOCIATED":
[
"I_JOURNALENTRY"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/