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 P_Hu_FIInvItem.
-- 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: PHUFIINVITEM
CREATE VIEW P_Hu_FIInvItem AS
SELECT
I_StRpBPTaxItem.CompanyCode AS CompanyCode,
I_StRpBPTaxItem.AccountingDocument AS AccountingDocument,
I_StRpBPTaxItem.FiscalYear AS FiscalYear,
I_StRpBPTaxItem.AccountingDocumentItem AS AccountingDocumentItem,
I_StRpBPTaxItem.DocumentDate AS DocumentDate,
I_StRpBPTaxItem.PostingDate AS PostingDate,
I_StRpBPTaxItem._AccountingDocument.TaxReportingDate AS TaxReportingDate,
I_StRpBPTaxItem.TaxCode AS TaxCode,
I_StRpBPTaxItem.ReferenceDocumentType AS ReferenceDocumentType,
I_StRpBPTaxItem.DocumentReferenceID AS DocumentReferenceID,
I_StRpBPTaxItem.InvoiceReference AS InvoiceReference,
I_StRpBPTaxItem.InvoiceReferenceFiscalYear AS InvoiceReferenceFiscalYear,
I_StRpBPTaxItem.OriginalReferenceDocument AS OriginalReferenceDocument,
I_StRpBPTaxItem.TaxBaseAmountInCoCodeCrcy AS TaxBaseAmountInCoCodeCrcy,
I_StRpBPTaxItem.TaxAmountInCoCodeCrcy AS TaxAmountInCoCodeCrcy,
I_StRpBPTaxItem.CompanyCodeCurrency AS CompanyCodeCurrency,
I_StRpBPTaxItem.FinancialAccountType AS FinancialAccountType,
I_StRpBPTaxItem._BusinessPartner.BusinessPartner AS BusinessPartner,
I_StRpBPTaxItem.TaxRate AS TaxRate,
case FinancialAccountType when 'D' then I_StRpBPTaxItem._Customer.VATRegistration when 'K' then I_StRpBPTaxItem._Supplier.VATRegistration else '' end as VATRegistration AS VATRegistrationelseendasVATRegistration,
I_StRpBPTaxItem._BusinessPartner.BusinessPartnerName AS BusinessPartnerName,
case FinancialAccountType when 'D' then I_StRpBPTaxItem._Customer.TaxNumber1 when 'K' then I_StRpBPTaxItem._Supplier.TaxNumber1 else '' end as TaxNumber1 AS TaxNumber1elseendasTaxNumber1,
case FinancialAccountType when 'D' then I_StRpBPTaxItem._Customer.TaxNumber2 when 'K' then I_StRpBPTaxItem._Supplier.TaxNumber2 else '' end as TaxNumber2 AS TaxNumber2elseendasTaxNumber2,
case FinancialAccountType when 'D' then I_StRpBPTaxItem._Customer.TaxNumber3 when 'K' then I_StRpBPTaxItem._Supplier.TaxNumber3 else '' end as TaxNumber3 AS TaxNumber3elseendasTaxNumber3,
case FinancialAccountType when 'D' then I_StRpBPTaxItem._Customer.TaxNumber4 when 'K' then I_StRpBPTaxItem._Supplier.TaxNumber4 else '' end as TaxNumber4 AS TaxNumber4elseendasTaxNumber4,
case FinancialAccountType when 'D' then I_StRpBPTaxItem._Customer.TaxNumber5 when 'K' then I_StRpBPTaxItem._Supplier.TaxNumber5 else '' end as TaxNumber5 AS TaxNumber5elseendasTaxNumber5,
case FinancialAccountType when 'D' then I_StRpBPTaxItem._Customer.Country when 'K' then I_StRpBPTaxItem._Supplier.Country else '' end as Country AS CountryelseendasCountry,
P_Hu_FiInvoice.Invoice AS Invoice,
P_Hu_FiInvoice.InvoiceDate AS InvoiceDate,
ReferenceDocument,
P_Hu_FiInvoice.PredecessorReferenceDocument AS PredecessorReferenceDocument,
P_Hu_FiInvoice.PredecessorReferenceDocType AS PredecessorReferenceDocType,
I_StRpBPTaxItem.AuthorizationGroup AS AuthorizationGroup,
I_StRpBPTaxItem._BusinessPartner.DataControllerSet AS DataControllerSet,
I_StRpBPTaxItem._BusinessPartner.DataController1 AS DataController1,
I_StRpBPTaxItem._BusinessPartner.DataController2 AS DataController2,
I_StRpBPTaxItem._BusinessPartner.DataController3 AS DataController3,
I_StRpBPTaxItem._BusinessPartner.DataController4 AS DataController4,
I_StRpBPTaxItem._BusinessPartner.DataController5 AS DataController5,
I_StRpBPTaxItem._BusinessPartner.DataController6 AS DataController6,
I_StRpBPTaxItem._BusinessPartner.DataController7 AS DataController7,
I_StRpBPTaxItem._BusinessPartner.DataController8 AS DataController8,
I_StRpBPTaxItem._BusinessPartner.DataController9 AS DataController9,
I_StRpBPTaxItem._BusinessPartner.DataController10 AS DataController10
FROM I_StRpBPTaxItem
INNER JOIN P_Hu_FiInvoice ON /* join condition not captured in parsed metadata */
;