I_ES_StRpWhldgTaxItem

DDL: I_ES_STRPWHLDGTAXITEM Type: view_entity COMPOSITE

Spain Withholding Tax Reporting

I_ES_StRpWhldgTaxItem is a Composite CDS View (Cube) that provides data about "Spain Withholding Tax Reporting" in SAP S/4HANA. It reads from 2 data sources (I_StRpWhldgTaxItem, I_ES_WithholdingKey) and exposes 72 fields with key fields CompanyCode, AccountingDocument, FiscalYear, AccountingDocumentItem, WithholdingTaxType. It has 5 associations to related views.

Data Sources (2)

SourceAliasJoin Type
I_StRpWhldgTaxItem doc from
I_ES_WithholdingKey wthkey inner

Associations (5)

CardinalityTargetAliasCondition
[0..1] P_ES_CreditMemoCube CreditMemoDoc doc.CompanyCode = CreditMemoDoc.CompanyCode and doc.AccountingDocument = CreditMemoDoc.InvoiceReference and doc.FiscalYear = CreditMemoDoc.FiscalYear and doc.WithholdingTaxType = CreditMemoDoc.WithholdingTaxType and doc.StatryRptgEntity = CreditMemoDoc.StatryRptgEntity and doc.StatryRptCategory = CreditMemoDoc.StatryRptCategory and doc.StatryRptRunID = CreditMemoDoc.StatryRptRunID
[0..1] I_StRpWhldgTaxItem DownpaymentClearingDoc doc.CompanyCode = DownpaymentClearingDoc.CompanyCode and doc.ClearingAccountingDocument = DownpaymentClearingDoc.AccountingDocument and doc.ClearingAccountingDocument is not initial and doc.ClearingJournalEntryFiscalYear is not initial and doc.ClearingJournalEntryFiscalYear = DownpaymentClearingDoc.FiscalYear and doc.WithholdingTaxType = DownpaymentClearingDoc.WithholdingTaxType and doc.WhldgTaxDocumentType = '005' and DownpaymentClearingDoc.WhldgTaxDocumentType = '010' and doc.StatryRptgEntity = DownpaymentClearingDoc.StatryRptgEntity and doc.StatryRptCategory = DownpaymentClearingDoc.StatryRptCategory and doc.StatryRptRunID = DownpaymentClearingDoc.StatryRptRunID
[0..1] I_Currency _ReportingCurrency $projection.ReportingCurrency = _ReportingCurrency.Currency
[0..1] I_OperationalAcctgDocItem _DownpaymentReference $projection.CompanyCode = _DownpaymentReference.CompanyCode and $projection.ClearingAccountingDocument = _DownpaymentReference.AccountingDocument and doc.ClearingJournalEntryFiscalYear = _DownpaymentReference.FiscalYear and $projection.ClearingAccountingDocument <> $projection.AccountingDocument and _DownpaymentReference.SpecialGLCode is initial and doc.WhldgTaxDocumentType = '005'
[0..1] I_OperationalAcctgDocItem _DPCReference $projection.CompanyCode = _DPCReference.CompanyCode and $projection.AccountingDocument = _DPCReference.AccountingDocument and $projection.FiscalYear = _DPCReference.FiscalYear and _DPCReference.SpecialGLCode is initial and doc.WhldgTaxDocumentType = '010'

Annotations (10)

NameValueLevelField
VDM.viewType #COMPOSITE view
Analytics.dataCategory #CUBE view
AccessControl.authorizationCheck #MANDATORY view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.sizeCategory #XXL view
ObjectModel.usageType.dataClass #MIXED view
Metadata.allowExtensions true view
AccessControl.personalData.blocking #BLOCKED_DATA_INCLUDED view
Analytics.internalName #LOCAL view
EndUserText.label Spain Withholding Tax Reporting view

Fields (72)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode I_StRpWhldgTaxItem CompanyCode Receiver Company Code
KEY AccountingDocument I_StRpWhldgTaxItem AccountingDocument Journal Entry
KEY FiscalYear I_StRpWhldgTaxItem FiscalYear G/L Fiscal Year
KEY AccountingDocumentItem I_StRpWhldgTaxItem AccountingDocumentItem Posting View Item
KEY WithholdingTaxType I_StRpWhldgTaxItem WithholdingTaxType WTax Type
KEY StatryRptgEntity I_StRpWhldgTaxItem StatryRptgEntity Reporting Entity
KEY StatryRptCategory I_StRpWhldgTaxItem StatryRptCategory Report ID
KEY StatryRptRunID I_StRpWhldgTaxItem StatryRptRunID Report Run ID
KEY ES_WhldgReportType I_ES_WithholdingKey ES_WhldgReportType Report Type
WithholdingTaxCode I_StRpWhldgTaxItem WithholdingTaxCode WTax Code
ProvincialTaxCode
Country I_StRpWhldgTaxItem Country Venue: Ctry/Reg
Creditor I_StRpWhldgTaxItem Creditor Supplier
Debtor I_StRpWhldgTaxItem Debtor Debtor
BusinessPartnerNumber I_StRpWhldgTaxItem BusinessPartnerNumber
BusinessPlace I_StRpWhldgTaxItem BusinessPlace Business place
FinancialAccountType I_StRpWhldgTaxItem FinancialAccountType Fin. Account Type
PostingDate I_StRpWhldgTaxItem PostingDate Posting Date for GR
DocumentDate I_StRpWhldgTaxItem DocumentDate Journal Entry Date
SupplierRecipientType I_StRpWhldgTaxItem SupplierRecipientType Recipient Type
ClearingDate I_StRpWhldgTaxItem ClearingDate Clearing Date
ClearingAccountingDocument I_StRpWhldgTaxItem ClearingAccountingDocument Clearing Journal Entry
WhldgTaxReferenceText I_ES_WithholdingKey WhldgTaxReferenceText WTax Key
EsIncTypeClassfctn Subkey
ReportingDate I_StRpWhldgTaxItem ReportingDate
ReportingCurrency I_StRpWhldgTaxItem ReportingCurrency Currency
WhldgTaxExmptAmtInCoCodeCrcy I_StRpWhldgTaxItem WhldgTaxExmptAmtInCoCodeCrcy
WhldgTaxExmptAmtInTransacCrcy I_StRpWhldgTaxItem WhldgTaxExmptAmtInTransacCrcy
IsReversed I_StRpWhldgTaxItem IsReversed Reversed?
IsReversal I_StRpWhldgTaxItem IsReversal Reversal doc.
WhldgTaxBaseAmtInCoCodeCrcy I_StRpWhldgTaxItem WhldgTaxBaseAmtInCoCodeCrcy Tax Base Amount
WhldgTaxAmtInCoCodeCrcy I_StRpWhldgTaxItem WhldgTaxAmtInCoCodeCrcy Wht Tax Amount
WithholdingTaxPercent I_StRpWhldgTaxItem WithholdingTaxPercent
ItemIsReportingRelevant I_StRpWhldgTaxItem ItemIsReportingRelevant Item Is reporting Relevant
char1asOpenInvoiceSelection Open invoice is selected
WhldgTaxDocumentType I_StRpWhldgTaxItem WhldgTaxDocumentType 3-Byte field
AuthorizationGroup
SupplierAccountGroup
Supplier
BusinessPartner
CustomerSupplierCityName Supplier City Name
RegionNameendasRegionName Supplier Region Name
RegionendasRegion Supplier Region
CustomerSupplierPostalCode Supplier Postal Code
RegionendasPostalCode Province
BusinessPartnerCountry Business Partner Country
SupplierVATRegistration I_StRpWhldgTaxItem VATRegistration Tax Number
TaxNumber1 Tax Number1
TaxNumber2 I_StRpWhldgTaxItem TaxNumber2 Tax Number2
TaxNumber3 I_StRpWhldgTaxItem TaxNumber3 Tax Number3
TaxNumber4 I_StRpWhldgTaxItem TaxNumber4 Tax Number4
TaxNumber5 I_StRpWhldgTaxItem TaxNumber5 Tax Number5
BirthDate
BusinessPartnerBirthplaceName
NonResidentCompanyOriginCntry
BusinessPartnerCategory
FiscalAddress
Language
TaxNumberResponsible
VATRegistration Company Code VAT Registration Number
CompanyCodeName Company Code Name
CityName Company Code City Name
InvoiceReferenceendasInvoiceReference
ES_ServiceRenderedRegion
_Supplier I_StRpWhldgTaxItem _Supplier
_CompanyCode I_StRpWhldgTaxItem _CompanyCode
_Customer I_StRpWhldgTaxItem _Customer
_JournalEntry I_StRpWhldgTaxItem _JournalEntry
_ReportingCurrency _ReportingCurrency
_Onetime I_StRpWhldgTaxItem _Onetime
_Branch I_StRpWhldgTaxItem _Branch
SpecialGLCode I_StRpWhldgTaxItem SpecialGLCode Special G/L Ind

Derived SQL interpretation, reconstructed from the parsed view metadata (data sources, associations, and field mappings). SAP annotations are omitted and the structure is reformulated as SQL — this is a functional approximation, not the verbatim SAP source.

-- Derived SQL interpretation of CDS view I_ES_StRpWhldgTaxItem.
-- Reconstructed from parsed metadata (data sources, associations, fields).
-- SAP annotations are omitted and the structure is reformulated as SQL;
-- this is a functional approximation, not the verbatim SAP source. Some join
-- conditions may be unavailable and a few CDS constructs are kept as-is.

CREATE VIEW I_ES_StRpWhldgTaxItem AS
SELECT
  doc.CompanyCode AS CompanyCode,
  doc.AccountingDocument AS AccountingDocument,
  doc.FiscalYear AS FiscalYear,
  doc.AccountingDocumentItem AS AccountingDocumentItem,
  doc.WithholdingTaxType AS WithholdingTaxType,
  doc.StatryRptgEntity AS StatryRptgEntity,
  doc.StatryRptCategory AS StatryRptCategory,
  doc.StatryRptRunID AS StatryRptRunID,
  wthkey.ES_WhldgReportType AS ES_WhldgReportType,
  doc.WithholdingTaxCode AS WithholdingTaxCode,
  doc._WithholdingTaxCode.ProvincialTaxCode AS ProvincialTaxCode,
  doc.Country AS Country,
  doc.Creditor AS Creditor,
  doc.Debtor AS Debtor,
  doc.BusinessPartnerNumber AS BusinessPartnerNumber,
  doc.BusinessPlace AS BusinessPlace,
  doc.FinancialAccountType AS FinancialAccountType,
  doc.PostingDate AS PostingDate,
  doc.DocumentDate AS DocumentDate,
  doc.SupplierRecipientType AS SupplierRecipientType,
  doc.ClearingDate AS ClearingDate,
  doc.ClearingAccountingDocument AS ClearingAccountingDocument,
  wthkey.WhldgTaxReferenceText AS WhldgTaxReferenceText,
  right( wthkey.WhldgTaxReferenceText, 2) AS EsIncTypeClassfctn,
  doc.ReportingDate AS ReportingDate,
  doc.ReportingCurrency AS ReportingCurrency,
  doc.WhldgTaxExmptAmtInCoCodeCrcy AS WhldgTaxExmptAmtInCoCodeCrcy,
  doc.WhldgTaxExmptAmtInTransacCrcy AS WhldgTaxExmptAmtInTransacCrcy,
  doc.IsReversed AS IsReversed,
  doc.IsReversal AS IsReversal,
  doc.WhldgTaxBaseAmtInCoCodeCrcy AS WhldgTaxBaseAmtInCoCodeCrcy,
  doc.WhldgTaxAmtInCoCodeCrcy AS WhldgTaxAmtInCoCodeCrcy,
  doc.WithholdingTaxPercent AS WithholdingTaxPercent,
  doc.ItemIsReportingRelevant AS ItemIsReportingRelevant,
  cast( case doc.WhldgTaxDocumentType when '001' then '0' when '003' then '0' when '017' then '0' else '2' end as abap.char( 1 ) ) as OpenInvoiceSelection AS char1asOpenInvoiceSelection,
  doc.WhldgTaxDocumentType AS WhldgTaxDocumentType,
  doc._Supplier.AuthorizationGroup AS AuthorizationGroup,
  doc._Supplier.SupplierAccountGroup AS SupplierAccountGroup,
  doc._Supplier.Supplier AS Supplier,
  doc._Supplier._SupplierToBusinessPartner._BusinessPartner.BusinessPartner AS BusinessPartner,
  coalesce( doc._Onetime.CityName, doc.CityName ) AS CustomerSupplierCityName,
  case when doc._Onetime._Address._Region._RegionText[1:Language = $session.system_language].RegionName is not initial then doc._Onetime._Address._Region._RegionText[1:Language = $session.system_language].RegionName else doc._Supplier._StandardAddress._Region._RegionText[1:Language = $session.system_language].RegionName end as RegionName AS RegionNameendasRegionName,
  case when doc._Onetime.Region is not initial then doc._Onetime.Region else doc._Supplier._StandardAddress.Region end as Region AS RegionendasRegion,
  coalesce( doc._Onetime.PostalCode, doc._Supplier._StandardAddress.PostalCode ) AS CustomerSupplierPostalCode,
  case when doc.Region is initial then substring( doc._Supplier._StandardAddress.PostalCode, 1, 2 ) else doc._Supplier._StandardAddress.Region end as PostalCode AS RegionendasPostalCode,
  coalesce( doc._Onetime.Country, doc._Supplier.Country ) AS BusinessPartnerCountry,
  doc.VATRegistration AS SupplierVATRegistration,
  cast( doc.TaxNumber1 as stcd1 ) AS TaxNumber1,
  doc.TaxNumber2 AS TaxNumber2,
  doc.TaxNumber3 AS TaxNumber3,
  doc.TaxNumber4 AS TaxNumber4,
  doc.TaxNumber5 AS TaxNumber5,
  doc._Supplier.BirthDate AS BirthDate,
  doc._Supplier._SupplierToBusinessPartner._BusinessPartner.BusinessPartnerBirthplaceName AS BusinessPartnerBirthplaceName,
  doc._Supplier._SupplierToBusinessPartner._BusinessPartner.NonResidentCompanyOriginCntry AS NonResidentCompanyOriginCntry,
  doc._Supplier._SupplierToBusinessPartner._BusinessPartner.BusinessPartnerCategory AS BusinessPartnerCategory,
  doc._Supplier.FiscalAddress AS FiscalAddress,
  cast( 'S' as spras ) AS Language,
  doc._Supplier.TaxNumberResponsible AS TaxNumberResponsible,
  cast( substring( doc._CompanyCode.VATRegistration, 3, 11 ) as farp_stceg ) AS VATRegistration,
  concat_with_space (doc._CompanyCode._Address.BusinessPartnerName1 , doc._CompanyCode._Address.BusinessPartnerName2 , 1) AS CompanyCodeName,
  doc._CompanyCode._Address.CityName AS CityName,
  case when ( doc.WhldgTaxDocumentType = '005' and _DownpaymentReference.InvoiceReference <> _DownpaymentReference.AccountingDocument ) then _DownpaymentReference.InvoiceReference when doc.WhldgTaxDocumentType = '010' then _DPCReference.InvoiceReference else doc.InvoiceReference end as InvoiceReference AS InvoiceReferenceendasInvoiceReference,
  cast ( doc._JournalEntry.JrnlEntryCntrySpecificRef3 as fiwtes_servicerenderedregion ) AS ES_ServiceRenderedRegion,
  doc._Supplier AS _Supplier,
  doc._CompanyCode AS _CompanyCode,
  doc._Customer AS _Customer,
  doc._JournalEntry AS _JournalEntry,
  doc._Onetime AS _Onetime,
  doc._Branch AS _Branch,
  doc.SpecialGLCode AS SpecialGLCode
FROM I_StRpWhldgTaxItem AS doc
INNER JOIN I_ES_WithholdingKey AS wthkey ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN P_ES_CreditMemoCube AS CreditMemoDoc ON doc.CompanyCode = CreditMemoDoc.CompanyCode AND doc.AccountingDocument = CreditMemoDoc.InvoiceReference AND doc.FiscalYear = CreditMemoDoc.FiscalYear AND doc.WithholdingTaxType = CreditMemoDoc.WithholdingTaxType AND doc.StatryRptgEntity = CreditMemoDoc.StatryRptgEntity AND doc.StatryRptCategory = CreditMemoDoc.StatryRptCategory AND doc.StatryRptRunID = CreditMemoDoc.StatryRptRunID  -- association [0..1]
LEFT OUTER JOIN I_StRpWhldgTaxItem AS DownpaymentClearingDoc ON doc.CompanyCode = DownpaymentClearingDoc.CompanyCode AND doc.ClearingAccountingDocument = DownpaymentClearingDoc.AccountingDocument AND doc.ClearingAccountingDocument is not initial AND doc.ClearingJournalEntryFiscalYear is not initial AND doc.ClearingJournalEntryFiscalYear = DownpaymentClearingDoc.FiscalYear AND doc.WithholdingTaxType = DownpaymentClearingDoc.WithholdingTaxType AND doc.WhldgTaxDocumentType = '005' AND DownpaymentClearingDoc.WhldgTaxDocumentType = '010' AND doc.StatryRptgEntity = DownpaymentClearingDoc.StatryRptgEntity AND doc.StatryRptCategory = DownpaymentClearingDoc.StatryRptCategory AND doc.StatryRptRunID = DownpaymentClearingDoc.StatryRptRunID  -- association [0..1]
LEFT OUTER JOIN I_Currency AS _ReportingCurrency ON ReportingCurrency = _ReportingCurrency.Currency  -- association [0..1]
LEFT OUTER JOIN I_OperationalAcctgDocItem AS _DownpaymentReference ON CompanyCode = _DownpaymentReference.CompanyCode AND ClearingAccountingDocument = _DownpaymentReference.AccountingDocument AND doc.ClearingJournalEntryFiscalYear = _DownpaymentReference.FiscalYear AND ClearingAccountingDocument <> AccountingDocument AND _DownpaymentReference.SpecialGLCode is initial AND doc.WhldgTaxDocumentType = '005'  -- association [0..1]
LEFT OUTER JOIN I_OperationalAcctgDocItem AS _DPCReference ON CompanyCode = _DPCReference.CompanyCode AND AccountingDocument = _DPCReference.AccountingDocument AND FiscalYear = _DPCReference.FiscalYear AND _DPCReference.SpecialGLCode is initial AND doc.WhldgTaxDocumentType = '010'  -- association [0..1]
;