C_RO_StRpTaxItemWithEUTaxClfnC

DDL: C_RO_STRPTAXITEMWITHEUTAXCLFNC SQL: CSRROEUTAXCLFNC Type: view CONSUMPTION

EU Sales Tax Item View for RO

C_RO_StRpTaxItemWithEUTaxClfnC is a Consumption CDS View (Cube) that provides data about "EU Sales Tax Item View for RO" in SAP S/4HANA. It reads from 3 data sources (I_Customer, I_Supplier, I_StRpTaxItmWithEUTaxClass) and exposes 30 fields with key fields CompanyCode, AccountingDocument, FiscalYear, TaxCode, TaxItem.

Data Sources (3)

SourceAliasJoin Type
I_Customer Customer left_outer
I_Supplier Supplier left_outer
I_StRpTaxItmWithEUTaxClass TaxItems from

Annotations (12)

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

Fields (30)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode I_StRpTaxItmWithEUTaxClass CompanyCode
KEY AccountingDocument I_StRpTaxItmWithEUTaxClass AccountingDocument
KEY FiscalYear I_StRpTaxItmWithEUTaxClass FiscalYear
KEY TaxCode I_StRpTaxItmWithEUTaxClass TaxCode
KEY TaxItem I_StRpTaxItmWithEUTaxClass TaxItem
KEY TransactionTypeDetermination I_StRpTaxItmWithEUTaxClass TransactionTypeDetermination
KEY StatryRptCategory StatryRptCategory
KEY StatryRptRunID StatryRptRunID
KEY StatryRptgEntity StatryRptgEntity
Debtor Debtor
Creditor Creditor
VATRegistration I_StRpTaxItmWithEUTaxClass VATRegistration
TaxItemGroup TaxItemGroup
TaxJurisdiction I_StRpTaxItmWithEUTaxClass TaxJurisdiction
Country I_StRpTaxItmWithEUTaxClass Country
ReportingCountry I_StRpTaxItmWithEUTaxClass ReportingCountry
ReportingCurrency ReportingCurrency
IsReversal I_StRpTaxItmWithEUTaxClass IsReversal
IsReversed I_StRpTaxItmWithEUTaxClass IsReversed
TaxableEntity TaxableEntity
ReportingDate ReportingDate
PostingDate I_StRpTaxItmWithEUTaxClass PostingDate
DocumentDate I_StRpTaxItmWithEUTaxClass DocumentDate
TaxReportingDate TaxReportingDate
IsEUTriangularDeal IsEUTriangularDeal
DelivOfGoodsOriginCountry DelivOfGoodsOriginCountry
EUTaxClassification EUTaxClassification
TaxType TaxType
BusinessPartner I_StRpTaxItmWithEUTaxClass BusinessPartner
BusinessPartnerName BusinessPartnerName
@AbapCatalog.sqlViewName: 'CSRROEUTAXCLFNC'
@AbapCatalog.compiler.compareFilter: true
@ClientHandling.algorithm: #SESSION_VARIABLE
@EndUserText.label: 'EU Sales Tax Item View for RO'
@VDM.viewType: #CONSUMPTION
//@Search.searchable: true

@Analytics: { dataCategory: #CUBE }
@AccessControl.authorizationCheck: #CHECK
@AccessControl.personalData.blocking: #BLOCKED_DATA_INCLUDED
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.dataClass: #MIXED
@Metadata.allowExtensions:true


define view C_RO_StRpTaxItemWithEUTaxClfnC as 

  select from I_StRpTaxItmWithEUTaxClass as TaxItems
  
  // Join with customer's master record to retrieve fiskn

  left outer join I_Customer as Customer on Debtor = Customer.Customer

  // Join with supplier's master record to retrieve fiskn

  left outer join I_Supplier as Supplier on Creditor = Supplier.Supplier

{
  key TaxItems.CompanyCode,
  key TaxItems.AccountingDocument,
  key TaxItems.FiscalYear,  
  key TaxItems.TaxCode,
  key TaxItems.TaxItem,
  key TaxItems.TransactionTypeDetermination,
  key StatryRptCategory,
  key StatryRptRunID,
  key StatryRptgEntity,
  
  // Customer

  Debtor,
  
  // Supplier

  Creditor,
  
  // VAT number of the business partner

  TaxItems.VATRegistration,
  
  // VAT number under which this partner will be reported

  cast (
    case
      // Customer's VAT number is not on the line item => take it from the master record

      when Debtor <> '' and TaxItems.VATRegistration = '' then Customer.VATRegistration
      // Supplier's VAT number is not on the line item => take it from the master record

      when Creditor <> '' and TaxItems.VATRegistration = '' then Supplier.VATRegistration    
      else TaxItems.VATRegistration
    end as fies_ecsl_reporting_vat
  ) as ReportingVATRegistration,
  
  cast (
    case
      // Customer's VAT number is not on the line item => take it from the master record

      when Debtor <> '' and TaxItems.VATRegistration = '' then substring(Customer.VATRegistration, 1, 2)
      // Supplier's VAT number is not on the line item => take it from the master record

      when Creditor <> '' and TaxItems.VATRegistration = '' then substring(Supplier.VATRegistration, 1, 2)    
      else substring(TaxItems.VATRegistration, 1, 2)
    end as stceg_l
  ) as VATRegistrationCountry,

  cast (
    case
      // Customer's VAT number is not on the line item => take the Country from the master record

      when Debtor <> '' and TaxItems.VATRegistration = '' then Customer.Country
      // Supplier's VAT number is not on the line item => take the Country from the master record

      when Creditor <> '' and TaxItems.VATRegistration = '' then Supplier.Country
      when TaxItems.VATRegistration <> '' and TaxItems.DelivOfGoodsDestCountry <> '' then TaxItems.DelivOfGoodsDestCountry
      else substring(TaxItems.VATRegistration, 1, 2)           
//      else TaxItems.DelivOfGoodsDestCountry

    end as egbld
  ) as DelivOfGoodsDestCountry,

  
  // Name of the busniness partner

  cast(
    case   
      when TaxItems.IsOneTimeAccount = '' and Debtor <> '' then TaxItems.CustomerName
      when TaxItems.IsOneTimeAccount = '' and Creditor <> '' then TaxItems.SupplierName 
      else _OneTimeAccount.BusinessPartnerName1
    end as md_customer_name)
  as Name,        
  
  // Operation code is determined by EU code

  cast(
    case
      when TaxItems.IsEUTriangularDeal = '' and TaxItems.EUTaxClassification = '1' then 'L'
      when TaxItems.IsEUTriangularDeal = 'X' and TaxItems.EUTaxClassification = '1' then 'T'
      when TaxItems.EUTaxClassification = '9' then 'A'
      when TaxItems.EUTaxClassification = '4' then 'P'
      when TaxItems.EUTaxClassification = '5' then 'S'
      when TaxItems.EUTaxClassification = 'R' then 'R'
      when TaxItems.EUTaxClassification = 'C' and AmountInReportingCurrency >= 0 then 'B'
      when TaxItems.EUTaxClassification = 'C' and AmountInReportingCurrency <  0 then 'A'
      else '?'
    end as ecslxx_operation)
  as Operation,
  
  TaxItemGroup,
  TaxItems.TaxJurisdiction,
  TaxItems.Country,
  TaxItems.ReportingCountry,
  @Semantics.currencyCode:true
  ReportingCurrency,
  @DefaultAggregation:#SUM
  @Semantics.amount.currencyCode: 'ReportingCurrency'
  cast(
    (case 
      when TaxType = 'A' then (AmountInReportingCurrency * -1) 
      else AmountInReportingCurrency 
    end)          
  as glo_amount_rptg_crcy) as AmountInReportingCurrency, 
  TaxItems.IsReversal,
  TaxItems.IsReversed,
  TaxableEntity,
  ReportingDate,
  TaxItems.PostingDate,
  TaxItems.DocumentDate,
  TaxReportingDate,
  IsEUTriangularDeal,
  DelivOfGoodsOriginCountry,
  EUTaxClassification,
  TaxType,
  TaxItems.BusinessPartner,
  BusinessPartnerName 
}
where
 ReportingCountry = 'RO'    
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_CUSTOMER",
"I_ONETIMEACCOUNTBP",
"I_STRPTAXITMWITHEUTAXCLASS",
"I_SUPPLIER"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/