C_TH_StRpWhldgTaxItemCube

DDL: C_TH_STRPWHLDGTAXITEMCUBE Type: view_entity CONSUMPTION

Withholding Tax Item View for Thailand

C_TH_StRpWhldgTaxItemCube is a Consumption CDS View (Cube) that provides data about "Withholding Tax Item View for Thailand" in SAP S/4HANA. It reads from 5 data sources (I_TH_BranchCode, C_TH_CreditMemoCube, P_TH_CustomerBranchCode, P_TH_StRpWhldgTaxItem, I_Withholdingtaxitem) and exposes 57 fields with key fields CompanyCode, AccountingDocument, FiscalYear, AccountingDocumentItem, WithholdingTaxType. It has 1 association to related views.

Data Sources (5)

SourceAliasJoin Type
I_TH_BranchCode bpbranchadr left_outer
C_TH_CreditMemoCube CreditMemoDoc left_outer
P_TH_CustomerBranchCode custbranchadr left_outer
P_TH_StRpWhldgTaxItem doc from
I_Withholdingtaxitem wht inner

Associations (1)

CardinalityTargetAliasCondition
[0..1] P_Withholdingtxtype _TaxType _TaxType.land1 = doc.Country and _TaxType.witht = doc.WithholdingTaxType

Annotations (10)

NameValueLevelField
EndUserText.label Withholding Tax Item View for Thailand view
VDM.viewType #CONSUMPTION view
Analytics.dataCategory #CUBE view
Analytics.technicalName CSRTHTAXITEMC view
AccessControl.authorizationCheck #CHECK view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.dataClass #MIXED view
Metadata.allowExtensions true view
AccessControl.personalData.blocking #BLOCKED_DATA_INCLUDED view

Fields (57)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode P_TH_StRpWhldgTaxItem CompanyCode Receiver Company Code
KEY AccountingDocument P_TH_StRpWhldgTaxItem AccountingDocument Journal Entry
KEY FiscalYear P_TH_StRpWhldgTaxItem FiscalYear G/L Fiscal Year
KEY AccountingDocumentItem P_TH_StRpWhldgTaxItem AccountingDocumentItem Posting View Item
KEY WithholdingTaxType P_TH_StRpWhldgTaxItem WithholdingTaxType WTax Type
KEY StatryRptgEntity P_TH_StRpWhldgTaxItem StatryRptgEntity Reporting Entity
KEY StatryRptCategory P_TH_StRpWhldgTaxItem StatryRptCategory Report ID
KEY StatryRptRunID P_TH_StRpWhldgTaxItem StatryRptRunID Report Run ID
WithholdingTaxCode P_TH_StRpWhldgTaxItem WithholdingTaxCode WTax Code
WhldgTaxCodeName
PostingDate P_TH_StRpWhldgTaxItem PostingDate Posting Date for GR
DocumentDate P_TH_StRpWhldgTaxItem DocumentDate Journal Entry Date
InvoiceReference P_TH_StRpWhldgTaxItem InvoiceReference Invoice Reference
VATRegistration
BusinessPlace P_TH_StRpWhldgTaxItem BusinessPlace Business place
BranchLongCodeendasBranchLongCode
Customer
CustomerName
CustomerFullName
BusinessPartner P_TH_StRpWhldgTaxItem BusinessPartner Issuing Authority
BranchCodeendasTH_DefaultBranch
Supplier
AddressIDendendelseendasAddressID
CompanyCodeCountry
TaxNumber1endasTaxNumber1
TaxNumber3endendendasTaxNumber3
SupplierFullName
MiddleName
CountryName
CityNameendasCityName
CountryendasCountry
StreetAddressNameendasStreetName
PostalCodeendasPostalCode
PostalCode11endasFullName
Language
PostingDateendasClearingDate
WithholdingTaxIncomeType
CustomerSupplierAccount I_Withholdingtaxitem CustomerSupplierAccount Cust./Vend. Acct
WithholdingTaxPercent
WhldgTaxRelevantPercent
CompanyCodeCurrency
WhldgTaxBaseAmtInTransacCrcy
WhldgTaxAmtInTransacCrcy
TransactionCurrency P_TH_StRpWhldgTaxItem TransactionCurrency Transaction Currency
DocumentCurrency I_Withholdingtaxitem DocumentCurrency Document Currency
WithholdingTaxPostingRule
SupplierRecipientType I_Withholdingtaxitem SupplierRecipientType Recipient Type
WithholdingTaxCertificate I_Withholdingtaxitem WithholdingTaxCertificate WHT Certificate
WhldgTaxDocumentType P_TH_StRpWhldgTaxItem WhldgTaxDocumentType 3-Byte field
DocumentReferenceID P_TH_StRpWhldgTaxItem DocumentReferenceID Reference
OfficialWhldgTaxCode
FinancialAccountType P_TH_StRpWhldgTaxItem FinancialAccountType Fin. Account Type
IsReversal P_TH_StRpWhldgTaxItem IsReversal Reversal doc.
IsReversed P_TH_StRpWhldgTaxItem IsReversed Reversed?
ItemIsReportingRelevant P_TH_StRpWhldgTaxItem ItemIsReportingRelevant Item Reporting Relv
BankAccountendelseendasBankAccount
TH_FiscalYear

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 C_TH_StRpWhldgTaxItemCube.
-- 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 C_TH_StRpWhldgTaxItemCube 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,
  doc.WithholdingTaxCode AS WithholdingTaxCode,
  cast('' as abap.char(40) ) AS WhldgTaxCodeName,
  doc.PostingDate AS PostingDate,
  doc.DocumentDate AS DocumentDate,
  doc.InvoiceReference AS InvoiceReference,
  doc._CompanyCode.VATRegistration AS VATRegistration,
  doc.BusinessPlace AS BusinessPlace,
  case when doc._Branch.BranchLongCode is initial then lpad( doc.BusinessPlace, 5 , '0' ) else doc._Branch.BranchLongCode end as BranchLongCode AS BranchLongCodeendasBranchLongCode,
  doc._Customer.Customer AS Customer,
  doc._Customer.CustomerName AS CustomerName,
  doc._Customer.CustomerFullName AS CustomerFullName,
  doc.BusinessPartner AS BusinessPartner,
  case when doc.BranchCode <> 'NVAT' and doc.BranchCode <> 'NOVAT' then doc.BranchCode end as TH_DefaultBranch AS BranchCodeendasTH_DefaultBranch,
  doc._Supplier.Supplier AS Supplier,
  case when doc._Onetime.AccountingDocument is null then case when bpbranchadr.AddressID is not initial then bpbranchadr.AddressID when custbranchadr.AddressID is not initial then custbranchadr.AddressID else case when doc._Supplier.AddressID is not initial then doc._Supplier.AddressID when doc._Customer.AddressID is not initial then doc._Customer.AddressID end end else '' end as AddressID AS AddressIDendendelseendasAddressID,
  doc._CompanyCode.Country AS CompanyCodeCountry,
  case when doc._Supplier.Supplier is not null then doc._Supplier.TaxNumber1 when doc._Customer.Customer is not null then doc._Customer.TaxNumber1 end as TaxNumber1 AS TaxNumber1endasTaxNumber1,
  case when doc._Onetime.AccountingDocument is not null then case when doc._Supplier.Supplier is not null then case when doc._Supplier._SupplierToBusinessPartner._BusinessPartner.BusinessPartnerCategory = '1' then doc._Onetime.TaxID1 else doc._Onetime.TaxID3 end when doc._Customer.Customer is not null then case when doc._Customer._CustomerToBusinessPartner._BusinessPartner.BusinessPartnerCategory = '1' then doc._Onetime.TaxID1 else doc._Onetime.TaxID3 end end else case when doc._Supplier.Supplier is not null then case when doc._Supplier._SupplierToBusinessPartner._BusinessPartner.BusinessPartnerCategory = '1' then doc._Supplier.TaxNumber1 else doc._Supplier.TaxNumber3 end when doc._Customer.Customer is not null then case when doc._Customer._CustomerToBusinessPartner._BusinessPartner.BusinessPartnerCategory = '1' then doc._Customer.TaxNumber1 else doc._Customer.TaxNumber3 end end end as TaxNumber3 AS TaxNumber3endendendasTaxNumber3,
  doc._Supplier.SupplierFullName AS SupplierFullName,
  cast('' as char40) AS MiddleName,
  cast('' as char50) AS CountryName,
  case when doc._Onetime.AccountingDocument is null then cast('' as char40) else doc._Onetime.CityName end as CityName AS CityNameendasCityName,
  case when doc._Onetime.AccountingDocument is null then cast('' as char3) else doc._Onetime.Country end as Country AS CountryendasCountry,
  case when doc._Onetime.AccountingDocument is null then cast('' as ad_street) else doc._Onetime.StreetAddressName end as StreetName AS StreetAddressNameendasStreetName,
  case when doc._Onetime.AccountingDocument is null then cast('' as ad_pstcd1) else doc._Onetime.PostalCode end as PostalCode AS PostalCodeendasPostalCode,
  case when doc._Onetime.AccountingDocument is null then cast('' as ad_namtext) else concat_with_space(doc._Onetime.StreetAddressName, concat_with_space(doc._Onetime.CityName, doc._Onetime.PostalCode, 1), 1) end as FullName AS PostalCode11endasFullName,
  $session.system_language AS Language,
  case when ( _TaxType.wt_postm = '1') then doc.PostingDate when ( _TaxType.wt_postm = '2' and wht.ClearingDate is not initial) then wht.ClearingDate else doc.PostingDate end as ClearingDate AS PostingDateendasClearingDate,
  doc._WithholdingTaxCode.WithholdingTaxIncomeType AS WithholdingTaxIncomeType,
  wht.CustomerSupplierAccount AS CustomerSupplierAccount,
  cast(doc._WithholdingTaxCode.WithholdingTaxPercent as qsatz ) AS WithholdingTaxPercent,
  cast(doc._WithholdingTaxCode.WhldgTaxRelevantPercent as qproz) AS WhldgTaxRelevantPercent,
  doc._CompanyCode.Currency AS CompanyCodeCurrency,
  ( wht.WhldgTaxBaseAmtInTransacCrcy ) AS WhldgTaxBaseAmtInTransacCrcy,
  ( wht.WhldgTaxAmtInTransacCrcy ) AS WhldgTaxAmtInTransacCrcy,
  doc.TransactionCurrency AS TransactionCurrency,
  wht.DocumentCurrency AS DocumentCurrency,
  wht._WithholdingTaxCode.WithholdingTaxPostingRule AS WithholdingTaxPostingRule,
  wht.SupplierRecipientType AS SupplierRecipientType,
  wht.WithholdingTaxCertificate AS WithholdingTaxCertificate,
  doc.WhldgTaxDocumentType AS WhldgTaxDocumentType,
  doc.DocumentReferenceID AS DocumentReferenceID,
  wht._WithholdingTaxCode.OfficialWhldgTaxCode AS OfficialWhldgTaxCode,
  doc.FinancialAccountType AS FinancialAccountType,
  doc.IsReversal AS IsReversal,
  doc.IsReversed AS IsReversed,
  doc.ItemIsReportingRelevant AS ItemIsReportingRelevant,
  case left(doc._WithholdingTaxCode.WithholdingTaxIncomeType,3) when '14A' then case when doc._Onetime.AccountingDocument is not null then '' else doc._OperationalAcctgDocItem._SupplierBankDetails.BankAccount end else '' end as BankAccount AS BankAccountendelseendasBankAccount,
  cast( doc.FiscalYear as int4 ) + 543 AS TH_FiscalYear
FROM P_TH_StRpWhldgTaxItem AS doc
INNER JOIN I_Withholdingtaxitem AS wht ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN C_TH_CreditMemoCube AS CreditMemoDoc ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN I_TH_BranchCode AS bpbranchadr ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN P_TH_CustomerBranchCode AS custbranchadr ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN P_Withholdingtxtype AS _TaxType ON _TaxType.land1 = doc.Country AND _TaxType.witht = doc.WithholdingTaxType  -- association [0..1]
;