I_PT_SAFTInvoiceListItem

DDL: I_PT_SAFTINVOICELISTITEM SQL: IPTSAFTLITEM Type: view COMPOSITE

SAF-T PT Invoice List Item

I_PT_SAFTInvoiceListItem is a Composite CDS View that provides data about "SAF-T PT Invoice List Item" in SAP S/4HANA. It reads from 4 data sources (I_SAFTBillingItem, I_PT_BillgDocDgtlSgntr, I_SAFTBillingHeader, P_PT_SAFT_BillDocOnInvoiceList) and exposes 48 fields with key fields PortugueseInvoiceNumber, FormattedDocumentKey. It has 3 associations to related views.

Data Sources (4)

Associations (3)

CardinalityTargetAliasCondition
[0..1] I_PT_SAFTBillingTax _TaxInfo $projection.PortugueseInvoiceNumber = _TaxInfo.PortugueseInvoiceNumber and $projection.TaxCode = _TaxInfo.TaxCode
[1..1] I_PT_SAFTBillgDocMatlHist _MaterialHist $projection.BillingDocument = _MaterialHist.BillingDocument and $projection.Material = _MaterialHist.Material
[0..*] I_PT_SAFTTaxNotConfigured _TaxNotConf _TaxNotConf.TaxCode = ''

Annotations (11)

NameValueLevelField
AbapCatalog.sqlViewName IPTSAFTLITEM view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
AccessControl.authorizationCheck #CHECK view
VDM.viewType #COMPOSITE view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.serviceQuality #X view
AccessControl.personalData.blocking #NOT_REQUIRED view
ClientHandling.algorithm #SESSION_VARIABLE view
EndUserText.label SAF-T PT Invoice List Item view

Fields (48)

KeyFieldSource TableSource FieldDescription
KEY PortugueseInvoiceNumber P_PT_SAFT_BillDocOnInvoiceList PortugueseInvoiceNumber
KEY FormattedDocumentKey
PortugueseInvoiceDate I_PT_BillgDocDgtlSgntr PortugueseInvoiceDate Date
Material
Quantity I_SAFTBillingItem Quantity Value
UnitOfMeasure I_SAFTBillingItem UnitOfMeasure Unit Protected Qty
Quantity2endendasNetPriceAmount
Quantity2endasNetAmount
ConditionAmount
BillingDocumentItemText I_SAFTBillingItem BillingDocumentItemText Item Descr.
ReferenceSDDocument I_SAFTBillingItem ReferenceSDDocument Reference Doc.
ReferenceSDDocumentItem I_SAFTBillingItem ReferenceSDDocumentItem Reference Item
ReferenceSDDocumentCategory I_SAFTBillingItem ReferenceSDDocumentCategory Prec.Doc.Categ.
SalesDocument I_SAFTBillingItem SalesDocument SD Document
SalesDocumentItem I_SAFTBillingItem SalesDocumentItem Sales Document Item
SDDocumentReason I_SAFTBillingItem SDDocumentReason Order Reason
BillingDocument I_SAFTBillingItem BillingDocument SD Document
BillingDocumentItem I_SAFTBillingItem BillingDocumentItem Item
CompanyCode I_SAFTBillingHeader CompanyCode Receiver Company Code
CompanyCodeCurrency I_PT_BillgDocDgtlSgntr CompanyCodeCurrency Local Currency
TransactionCurrency I_SAFTBillingHeader TransactionCurrency Transaction Currency
SDDocumentCategory P_PT_SAFT_BillDocOnInvoiceList SDDocumentCategory Document Cat.
ExchangeRate I_SAFTBillingHeader AccountingExchangeRate Exch.Rate Acct.
ExchangeRateDate I_SAFTBillingItem ExchangeRateDate Translatn Date
char5asWorkType
TaxCode
ConditionRateValue
TargetTaxCodeendasControlNature
TaxAmountendasTaxAmount
char4asActiveTaxType
TaxReturnCountryendasCountryCreditRating
ExemptionReasonelseendasExemptionReason
BillingPlanRule I_SAFTBillingItem BillingPlanRule
_CompanyCode I_SAFTBillingHeader _CompanyCode
_ReferenceDeliveryDocumentItem _ReferenceDeliveryDocumentItem
_BillingQuantityUnit _BillingQuantityUnit
_SalesDocument _SalesDocument
_SDDocumentReason _SDDocumentReason
_MaterialHist _MaterialHist
_ItemDiscount _ItemDiscount
_TaxInfo _TaxInfo
_Currency _Currency
_TransactionCurrency I_SAFTBillingHeader _TransactionCurrency
_BillingDocument I_SAFTBillingItem _BillingDocument
_ReferenceSDDocumentCategory _ReferenceSDDocumentCategory
_SalesDocumentItem _SalesDocumentItem
_BillingPlanRule _BillingPlanRule
_TaxNotConf _TaxNotConf

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_PT_SAFTInvoiceListItem.
-- 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: IPTSAFTLITEM

CREATE VIEW I_PT_SAFTInvoiceListItem AS
SELECT
  p.PortugueseInvoiceNumber AS PortugueseInvoiceNumber,
  cast(concat( a.BillingDocument, a.BillingDocumentItem) as abap.char(18)) AS FormattedDocumentKey,
  b.PortugueseInvoiceDate AS PortugueseInvoiceDate,
  cast(a.Material as matnr ) AS Material,
  a.Quantity AS Quantity,
  a.UnitOfMeasure AS UnitOfMeasure,
  case a.BillingDocumentItem when RoundDiff.BillingDocumentItem2Updt then case when t.ConditionAmount is not initial and t.ConditionAmount is not null then division(abs(a.NetAmount - abs(t.ConditionAmount) + Discount.FinalAmount + RoundDiff.RoundDifference),a.Quantity,2) when PrcgCndnItem.ConditionAmount is not initial and PrcgCndnItem.ConditionAmount is not null then division(abs(a.NetAmount - abs(PrcgCndnItem.ConditionAmount) + Discount.FinalAmount + RoundDiff.RoundDifference),a.Quantity,2) else abs(a.NetAmount + Discount.FinalAmount + RoundDiff.RoundDifference) end else case when t.ConditionAmount is not initial and t.ConditionAmount is not null then division(abs(a.NetAmount - abs(t.ConditionAmount) + Discount.FinalAmount),a.Quantity,2) when PrcgCndnItem.ConditionAmount is not initial and PrcgCndnItem.ConditionAmount is not null then division(abs(a.NetAmount - abs(PrcgCndnItem.ConditionAmount) + Discount.FinalAmount),a.Quantity,2) else division(abs(a.NetAmount + Discount.FinalAmount),a.Quantity,2) end end as NetPriceAmount AS Quantity2endendasNetPriceAmount,
  case a.BillingDocumentItem when RoundDiff.BillingDocumentItem2Updt then division(abs(a.NetAmount + Discount.FinalAmount + RoundDiff.RoundDifference),a.Quantity,2) else division(abs(a.NetAmount + Discount.FinalAmount),a.Quantity,2) end as NetAmount AS Quantity2endasNetAmount,
  coalesce(a._LineDiscount.ConditionAmount,0) AS ConditionAmount,
  a.BillingDocumentItemText AS BillingDocumentItemText,
  a.ReferenceSDDocument AS ReferenceSDDocument,
  a.ReferenceSDDocumentItem AS ReferenceSDDocumentItem,
  a.ReferenceSDDocumentCategory AS ReferenceSDDocumentCategory,
  a.SalesDocument AS SalesDocument,
  a.SalesDocumentItem AS SalesDocumentItem,
  a.SDDocumentReason AS SDDocumentReason,
  a.BillingDocument AS BillingDocument,
  a.BillingDocumentItem AS BillingDocumentItem,
  h.CompanyCode AS CompanyCode,
  b.CompanyCodeCurrency AS CompanyCodeCurrency,
  h.TransactionCurrency AS TransactionCurrency,
  p.SDDocumentCategory AS SDDocumentCategory,
  h.AccountingExchangeRate AS ExchangeRate,
  a.ExchangeRateDate AS ExchangeRateDate,
  cast (case when w.WorkType is not initial then w.WorkType when h.SDDocumentCategory = 'U' then 'PF' else ' ' end as abap.char(5)) as WorkType AS char5asWorkType,
  coalesce(ItemTax.TaxCode,'') AS TaxCode,
  coalesce(ItemTax.ConditionRateValue, 0) AS ConditionRateValue,
  case when TaxData.TargetTaxCode is not null or TaxData.TargetTaxCode is not initial then TaxData.TargetTaxCode else _TaxNotConf.TargetTaxCode end as ControlNature AS TargetTaxCodeendasControlNature,
  case when TaxData.TaxAmount is not null or TaxData.TaxAmount is not initial then TaxData.TaxAmount else _TaxNotConf.TaxAmount end as TaxAmount AS TaxAmountendasTaxAmount,
  cast(case when TaxData.TaxType is not null or TaxData.TaxType is not initial then TaxData.TaxType else _TaxNotConf.TaxType end as abap.char(4)) as ActiveTaxType AS char4asActiveTaxType,
  case when TaxData.TaxReturnCountry is not null or TaxData.TaxReturnCountry is not initial then TaxData.TaxReturnCountry else _TaxNotConf.TaxReturnCountry end as CountryCreditRating AS TaxReturnCountryendasCountryCreditRating,
  case when TaxData.ExemptionReason is not null or TaxData.ExemptionReason is not initial then TaxData.ExemptionReason when TaxData.TaxCode is null then _TaxNotConf.ExemptionReason else '' end as ExemptionReason AS ExemptionReasonelseendasExemptionReason,
  a.BillingPlanRule AS BillingPlanRule,
  h._CompanyCode AS _CompanyCode,
  h._TransactionCurrency AS _TransactionCurrency,
  a._BillingDocument AS _BillingDocument
FROM I_SAFTBillingItem AS a
INNER JOIN I_SAFTBillingHeader AS h ON /* join condition not captured in parsed metadata */
INNER JOIN I_PT_BillgDocDgtlSgntr AS b ON /* join condition not captured in parsed metadata */
INNER JOIN P_PT_SAFT_BillDocOnInvoiceList AS p ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN I_PT_SAFTBillingTax AS _TaxInfo ON PortugueseInvoiceNumber = _TaxInfo.PortugueseInvoiceNumber AND TaxCode = _TaxInfo.TaxCode  -- association [0..1]
LEFT OUTER JOIN I_PT_SAFTBillgDocMatlHist AS _MaterialHist ON BillingDocument = _MaterialHist.BillingDocument AND Material = _MaterialHist.Material  -- association [1..1]
LEFT OUTER JOIN I_PT_SAFTTaxNotConfigured AS _TaxNotConf ON _TaxNotConf.TaxCode = ''  -- association [0..*]
;