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_PH_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.
-- SQL view name: ISRPHWHLDGTXITM
CREATE VIEW I_PH_Strpwhldgtaxitem AS
SELECT
I_StRpWhldgTaxItem.CompanyCode AS CompanyCode,
I_StRpWhldgTaxItem.AccountingDocument AS AccountingDocument,
I_StRpWhldgTaxItem.FiscalYear AS FiscalYear,
I_StRpWhldgTaxItem.AccountingDocumentItem AS AccountingDocumentItem,
I_StRpWhldgTaxItem.WithholdingTaxType AS WithholdingTaxType,
I_StRpWhldgTaxItem.StatryRptgEntity AS StatryRptgEntity,
I_StRpWhldgTaxItem.StatryRptCategory AS StatryRptCategory,
I_StRpWhldgTaxItem.StatryRptRunID AS StatryRptRunID,
I_StRpWhldgTaxItem.PostingDate AS PostingDate,
I_StRpWhldgTaxItem.DocumentDate AS DocumentDate,
I_StRpWhldgTaxItem.ClearingDate AS ClearingDate,
I_StRpWhldgTaxItem.ReportingDate AS ReportingDate,
I_StRpWhldgTaxItem.WithholdingTaxCode AS WithholdingTaxCode,
I_StRpWhldgTaxItem.FiscalPeriod AS FiscalPeriod,
I_StRpWhldgTaxItem.IsNaturalPerson AS IsNaturalPerson,
I_StRpWhldgTaxItem.IsReversed AS IsReversed,
I_StRpWhldgTaxItem.IsReversal AS IsReversal,
I_StRpWhldgTaxItem.WithholdingTaxPercent AS WithholdingTaxPercent,
cast( I_StRpWhldgTaxItem.BusinessPartner as /scdl/dl_partyno) AS BusinessPartner,
I_StRpWhldgTaxItem._CompanyCode.Country AS Country,
I_StRpWhldgTaxItem.BusinessPartnerCountry AS BusinessPartnerCountry,
I_StRpWhldgTaxItem.BusinessPartnerNumber AS BusinessPartnerNumber,
I_StRpWhldgTaxItem.WhldgTaxDocumentType AS WhldgTaxDocumentType,
replace(replace(replace(replace(replace(replace(replace(replace(replace (replace( I_StRpWhldgTaxItem.OrganizationBPName1 , ',' ,'') , '"', ''), '(', ''), ')',''),'|',''),'.',''),';',''),':',''),'&',''),'''','')as OrganizationBPName1 AS asOrganizationBPName1,
replace(replace(replace(replace(replace(replace(replace(replace(replace (replace( I_StRpWhldgTaxItem.OrganizationBPName2 , ',' ,'') , '"', ''), '(', ''), ')',''),'|',''),'.',''),';',''),':',''),'&',''),'''','')as OrganizationBPName2 AS asOrganizationBPName2,
I_StRpWhldgTaxItem.ReportingCurrency AS ReportingCurrency,
case I_StRpWhldgTaxItem.TaxNumber3 when ' ' then I_StRpWhldgTaxItem.TaxNumber1 else I_StRpWhldgTaxItem.TaxNumber3 end as BPTaxNumber AS TaxNumber3endasBPTaxNumber,
cast(I_StRpWhldgTaxItem.Name as glo_partner) AS Name,
cast(I_StRpWhldgTaxItem._Supplier._StandardAddress.HouseNumber as glo_partner_houseno) AS CustomerSupplierHouseNumber,
cast(I_StRpWhldgTaxItem.CityName as glo_partner_cityname) AS CustomerSupplierCityName,
cast(I_StRpWhldgTaxItem.StreetName as glo_partner_street) AS CustomerSupplierStreetName,
I_StRpWhldgTaxItem._Supplier._StandardAddress.StreetPrefixName AS StreetPrefixName1,
I_StRpWhldgTaxItem._Supplier._StandardAddress.AdditionalStreetPrefixName AS AdditionalStreetPrefixName,
I_StRpWhldgTaxItem._Supplier._StandardAddress.StreetSuffixName AS StreetSuffixName,
I_StRpWhldgTaxItem._Supplier._StandardAddress.AdditionalStreetSuffixName AS AdditionalStreetSuffixName,
cast(I_StRpWhldgTaxItem.PostalCode as glo_partner_pocode) AS CustomerSupplierPostalCode,
I_StRpWhldgTaxItem._CompanyCode.VATRegistration AS VATRegistration,
I_StRpWhldgTaxItem._CompanyCode.Company AS Company,
I_StRpWhldgTaxItem._CompanyCode.CompanyCodeName AS CompanyCodeName,
I_StRpWhldgTaxItem._CompanyCode._Address.HouseNumber AS HouseNumber,
I_StRpWhldgTaxItem._CompanyCode._Address.StreetName AS StreetName,
I_StRpWhldgTaxItem._CompanyCode._Address.StreetPrefixName AS StreetPrefixName,
I_StRpWhldgTaxItem._CompanyCode._Address.CityName AS CityName,
I_StRpWhldgTaxItem._CompanyCode._Address.POBox AS POBox,
I_StRpWhldgTaxItem._CompanyCode._Address.PostalCode AS PostalCode,
I_StRpWhldgTaxItem.Language AS Language,
I_StRpWhldgTaxItem.OfficialWhldgTaxCode AS OfficialWhldgTaxCode,
_offtext.OfficialWhldgTaxCodeDesc AS OfficialWhldgTaxCodeDesc,
I_StRpWhldgTaxItem.ItemIsReportingRelevant AS ItemIsReportingRelevant,
bp.type AS BusinessPartnerCategory,
case when bp.type = '1' then coalesce(replace(replace(replace(replace(replace(replace(replace(replace(replace (replace(I_StRpWhldgTaxItem._Onetime.BusinessPartnerName3 , ',' ,'') , '"', ''), '(', ''), ')',''),'|',''),'.',''),';',''),':',''),'&',''),'''',''), replace(replace(replace(replace(replace(replace(replace(replace(replace (replace(bp.name_last , ',' ,'') , '"', ''), '(', ''), ')',''),'|',''),'.',''),';',''),':',''),'&',''),'''','')) else '' end as LastName AS elseendasLastName,
case when bp.type = '1' then coalesce(replace(replace(replace(replace(replace(replace(replace(replace(replace (replace(I_StRpWhldgTaxItem._Onetime.BusinessPartnerName1 , ',' ,'') , '"', ''), '(', ''), ')',''),'|',''),'.',''),';',''),':',''),'&',''),'''',''), replace(replace(replace(replace(replace(replace(replace(replace(replace (replace(bp.name_first , ',' ,'') , '"', ''), '(', ''), ')',''),'|',''),'.',''),';',''),':',''),'&',''),'''','')) else '' end as FirstName AS elseendasFirstName,
case when bp.type = '1' then coalesce(replace(replace(replace(replace(replace(replace(replace(replace(replace (replace(I_StRpWhldgTaxItem._Onetime.BusinessPartnerName2 , ',' ,'') , '"', ''), '(', ''), ')',''),'|',''),'.',''),';',''),':',''),'&',''),'''',''), replace(replace(replace(replace(replace(replace(replace(replace(replace (replace(bp.namemiddle , ',' ,'') , '"', ''), '(', ''), ')',''),'|',''),'.',''),';',''),':',''),'&',''),'''','')) else '' end as MiddleName AS elseendasMiddleName,
case when bp.type = '2' then replace(replace(replace(replace(replace(replace(replace(replace(replace (replace(concat_with_space( concat_with_space(I_StRpWhldgTaxItem.OrganizationBPName1, I_StRpWhldgTaxItem.OrganizationBPName2, 1), concat_with_space( bp.name_org3, bp.name_org4, 1 ), 1 ) , ',' ,'') , '"', ''), '(', ''), ')',''),'|',''),'.',''),';',''),':',''),'&',''),'''','') else '' end as OrganizationBPName3 AS elseendasOrganizationBPName3
FROM P_PH_Strpwhldgtxitem AS I_StRpWhldgTaxItem
LEFT OUTER JOIN P_Fiwt_T059ot_Glo AS _offtext ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN I_Currency AS _ReportingCurrency ON ReportingCurrency = _ReportingCurrency.Currency -- association [0..1]
;