I_PT_SAFTAccountingHeader

DDL: I_PT_SAFTACCOUNTINGHEADER SQL: IPTSAFTACCHEADER Type: view COMPOSITE

SAF-T PT Accounting Header

I_PT_SAFTAccountingHeader is a Composite CDS View that provides data about "SAF-T PT Accounting Header" in SAP S/4HANA. It reads from 3 data sources (I_PT_AcctgDocDgtlSgntr, P_PT_SAFTFIlterInvType, P_PT_SAFTTAXLAND) and exposes 46 fields with key field PortugueseInvoiceNumber. It has 3 associations to related views.

Data Sources (3)

SourceAliasJoin Type
I_PT_AcctgDocDgtlSgntr b inner
P_PT_SAFTFIlterInvType c inner
P_PT_SAFTTAXLAND t left_outer

Associations (3)

CardinalityTargetAliasCondition
[0..1] I_CustomerPaymentTerms _Terms _Terms.CustomerPaymentTerms = a.CustomerPaymentTerms
[0..1] I_PT_SAFTAcctgDocCustAddrHist _CustHist _CustHist.AccountingDocument = a.AccountingDocument and _CustHist.CompanyCode = a.CompanyCode and _CustHist.FiscalYear = a.FiscalYear and _CustHist.Customer = a.Customer
[0..1] I_PT_SAFTAcctgOneTimeCustomer _OneTimeAccount _OneTimeAccount.CompanyCode = a.CompanyCode and _OneTimeAccount.AccountingDocument = a.AccountingDocument and _OneTimeAccount.FiscalYear = a.FiscalYear

Annotations (11)

NameValueLevelField
AbapCatalog.sqlViewName IPTSAFTACCHEADER view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
AccessControl.authorizationCheck #CHECK view
AccessControl.personalData.blocking #BLOCKED_DATA_INCLUDED view
VDM.viewType #COMPOSITE view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.serviceQuality #D view
ClientHandling.algorithm #SESSION_VARIABLE view
EndUserText.label SAF-T PT Accounting Header view

Fields (46)

KeyFieldSource TableSource FieldDescription
KEY PortugueseInvoiceNumber I_PT_AcctgDocDgtlSgntr PortugueseInvoiceNumber
PortugueseInvoiceDate I_PT_AcctgDocDgtlSgntr PortugueseInvoiceDate Date
DocumentType P_PT_SAFTFIlterInvType CustomerInvoiceType
CreatedByUserendasLastChangedByUser
PTDgtlSgntrSystemDateTimeText I_PT_AcctgDocDgtlSgntr PTDgtlSgntrSystemDateTimeText Sys. Date-Time
PortugueseDigitalSignature I_PT_AcctgDocDgtlSgntr PortugueseDigitalSignature Digital Signature
PortugueseDgtlSgntrKeyVersion I_PT_AcctgDocDgtlSgntr PortugueseDgtlSgntrKeyVersion Key Version
AccountingDocumentItem a AccountingDocumentItem Posting View Item
AccountingDocument a AccountingDocument Journal Entry
CompanyCode a CompanyCode Receiver Company Code
FiscalYear a FiscalYear G/L Fiscal Year
ReverseDocument a ReverseDocument Reversed With
IsReversed a IsReversed Reversed?
ReverseDocumentFiscalYear a ReverseDocumentFiscalYear Year
AccountingDocumentCreationDate a AccountingDocumentCreationDate Journal Entry Date
CreationTime a CreationTime Time of Change
ReversalReason a ReversalReason Reversal Reason
AmountInTransactionCurrency a AmountInTransactionCurrency Pt Crcy Amt
AccountingDocumentCategory a AccountingDocumentCategory Journal Entry Category
FiscalPeriod a FiscalPeriod Tax period
DocumentDate a DocumentDate Journal Entry Date
PostingDate a PostingDate Posting Date for GR
AccountingDocumentType a AccountingDocumentType Journal Entry Type
CompanyCodeCurrency a CompanyCodeCurrency Local Currency
CreatedByUser a CreatedByUser User Name
ExchangeRateelse0endasExchangeRate
TotalGrossAmount I_PT_AcctgDocDgtlSgntr TotalGrossAmount Total Gross Amount
TotalNetAmount
TotalTaxAmount
Customer a Customer Sold-to Party
CustomerPaymentTerms a CustomerPaymentTerms Pyt Terms
CashDiscount1DueDate a CashDiscount1DueDate Cash Discount 1
CashDiscount2DueDate a CashDiscount2DueDate Cash Discount 2
CashDiscountAmtInCoCodeCrcy
IsOneTimeAccount a IsOneTimeAccount One-time acct
PT_SeriesDocumentNumber I_PT_AcctgDocDgtlSgntr PT_SeriesDocumentNumber ATCUD Code
PT_SeriesDocumentType I_PT_AcctgDocDgtlSgntr PT_SeriesDocumentType SAF-T Document Type
_Terms _Terms
_OneTimeAccount _OneTimeAccount
_CustHist _CustHist
_TotalItems _TotalItems
_AccountingDocumentCategory _AccountingDocumentCategory
_CompanyCode a _CompanyCode
_OperationalAcctgDocItem _OperationalAcctgDocItem
_ReversalDocument _ReversalDocument
_RevReason _RevReason

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_SAFTAccountingHeader.
-- 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: IPTSAFTACCHEADER

CREATE VIEW I_PT_SAFTAccountingHeader AS
SELECT
  b.PortugueseInvoiceNumber AS PortugueseInvoiceNumber,
  b.PortugueseInvoiceDate AS PortugueseInvoiceDate,
  c.CustomerInvoiceType AS DocumentType,
  case when a.ReverseDocument is not initial and a.IsReversed <> '' then _ReversalDocument.AccountingDocCreatedByUser else a.CreatedByUser end as LastChangedByUser AS CreatedByUserendasLastChangedByUser,
  b.PTDgtlSgntrSystemDateTimeText AS PTDgtlSgntrSystemDateTimeText,
  b.PortugueseDigitalSignature AS PortugueseDigitalSignature,
  b.PortugueseDgtlSgntrKeyVersion AS PortugueseDgtlSgntrKeyVersion,
  a.AccountingDocumentItem AS AccountingDocumentItem,
  a.AccountingDocument AS AccountingDocument,
  a.CompanyCode AS CompanyCode,
  a.FiscalYear AS FiscalYear,
  a.ReverseDocument AS ReverseDocument,
  a.IsReversed AS IsReversed,
  a.ReverseDocumentFiscalYear AS ReverseDocumentFiscalYear,
  a.AccountingDocumentCreationDate AS AccountingDocumentCreationDate,
  a.CreationTime AS CreationTime,
  a.ReversalReason AS ReversalReason,
  a.AmountInTransactionCurrency AS AmountInTransactionCurrency,
  a.AccountingDocumentCategory AS AccountingDocumentCategory,
  a.FiscalPeriod AS FiscalPeriod,
  a.DocumentDate AS DocumentDate,
  a.PostingDate AS PostingDate,
  a.AccountingDocumentType AS AccountingDocumentType,
  a.CompanyCodeCurrency AS CompanyCodeCurrency,
  a.CreatedByUser AS CreatedByUser,
  case when a.TransactionCurrency <> a._CompanyCode.Currency and a.TransactionCurrency is not initial then a.ExchangeRate else 0 end as ExchangeRate AS ExchangeRateelse0endasExchangeRate,
  b.TotalGrossAmount AS TotalGrossAmount,
  (b.TotalGrossAmount - abs(coalesce(_TotalItems.TaxAmountInCoCodeCrcy,0))) AS TotalNetAmount,
  abs(coalesce(_TotalItems.TaxAmountInCoCodeCrcy,0)) AS TotalTaxAmount,
  a.Customer AS Customer,
  a.CustomerPaymentTerms AS CustomerPaymentTerms,
  a.CashDiscount1DueDate AS CashDiscount1DueDate,
  a.CashDiscount2DueDate AS CashDiscount2DueDate,
  cast( division(( a.CashDiscountBaseAmount * a.CashDiscount1Percent),100,2) as dmbtr ) AS CashDiscountAmtInCoCodeCrcy,
  a.IsOneTimeAccount AS IsOneTimeAccount,
  b.PT_SeriesDocumentNumber AS PT_SeriesDocumentNumber,
  b.PT_SeriesDocumentType AS PT_SeriesDocumentType,
  a._CompanyCode AS _CompanyCode
INNER JOIN I_PT_AcctgDocDgtlSgntr AS b ON /* join condition not captured in parsed metadata */
INNER JOIN P_PT_SAFTFIlterInvType AS c ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN P_PT_SAFTTAXLAND AS t ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN I_CustomerPaymentTerms AS _Terms ON _Terms.CustomerPaymentTerms = a.CustomerPaymentTerms  -- association [0..1]
LEFT OUTER JOIN I_PT_SAFTAcctgDocCustAddrHist AS _CustHist ON _CustHist.AccountingDocument = a.AccountingDocument AND _CustHist.CompanyCode = a.CompanyCode AND _CustHist.FiscalYear = a.FiscalYear AND _CustHist.Customer = a.Customer  -- association [0..1]
LEFT OUTER JOIN I_PT_SAFTAcctgOneTimeCustomer AS _OneTimeAccount ON _OneTimeAccount.CompanyCode = a.CompanyCode AND _OneTimeAccount.AccountingDocument = a.AccountingDocument AND _OneTimeAccount.FiscalYear = a.FiscalYear  -- association [0..1]
;