P_BG_SAFTSALESINVOICEITEM

DDL: P_BG_SAFTSALESINVOICEITEM Type: view_entity CONSUMPTION

P_BG_SAFTSALESINVOICEITEM is a Consumption CDS View in SAP S/4HANA. It reads from 5 data sources (I_JournalEntryItem, I_JournalEntry, I_OperationalAcctgDocItem, I_CompanyCode, I_BG_SAFTSourceDocumentTypeMap) and exposes 22 fields with key fields SourceLedger, CompanyCode, FiscalYear, AccountingDocument, LedgerGLLineItem.

Data Sources (5)

SourceAliasJoin Type
I_JournalEntryItem Acdoca from
I_JournalEntry Bkpf inner
I_OperationalAcctgDocItem Bseg inner
I_CompanyCode CompanyCode inner
I_BG_SAFTSourceDocumentTypeMap DocType inner

Parameters (1)

NameTypeDefault
P_AlternativeGLAccountIsUsed saft_bg_alt_gl_account_flag

Annotations (7)

NameValueLevelField
VDM.viewType #CONSUMPTION view
VDM.private true view
ObjectModel.usageType.serviceQuality #X view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.dataClass #MIXED view
AccessControl.personalData.blocking #NOT_REQUIRED view
AccessControl.authorizationCheck #NOT_REQUIRED view

Fields (22)

KeyFieldSource TableSource FieldDescription
KEY SourceLedger I_JournalEntryItem SourceLedger Source Ledger
KEY CompanyCode I_JournalEntryItem CompanyCode Receiver Company Code
KEY FiscalYear I_JournalEntryItem FiscalYear G/L Fiscal Year
KEY AccountingDocument I_JournalEntryItem AccountingDocument Journal Entry
KEY LedgerGLLineItem I_JournalEntryItem LedgerGLLineItem Journal Entry Item
KEY Ledger I_JournalEntryItem Ledger Ledger
AccountingDocumentItem I_JournalEntryItem AccountingDocumentItem Posting View Item
AccountingDocumentType I_JournalEntryItem AccountingDocumentType Journal Entry Type
TransactionTypeDetermination I_JournalEntryItem TransactionTypeDetermination Transaction Key
PostingDate I_JournalEntryItem PostingDate Posting Date for GR
BG_SAFTGoodsService GoodsService BG_SAFTGoodsService
Product I_JournalEntryItem Product Product Sold
ProductDescription
CompanyCodeCurrency I_JournalEntryItem CompanyCodeCurrency Local Currency
TransactionCurrency I_JournalEntryItem TransactionCurrency Transaction Currency
SourceUnitOfMeasureFactor
BaseUnitendasmeinsasBaseUnit
GLAccountendasActiveGLAccount
QuantityendasQuantity
TaxReportingDate I_JournalEntry TaxReportingDate Tax Reporting Date
ExchangeRate I_JournalEntry ExchangeRate Exchange rate
TransactionCurrencyDecimals TCurrency Decimals Rounding Places

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_BG_SAFTSALESINVOICEITEM.
-- 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.
-- Parameters: P_AlternativeGLAccountIsUsed : saft_bg_alt_gl_account_flag

CREATE VIEW P_BG_SAFTSALESINVOICEITEM AS
SELECT
  Acdoca.SourceLedger AS SourceLedger,
  Acdoca.CompanyCode AS CompanyCode,
  Acdoca.FiscalYear AS FiscalYear,
  Acdoca.AccountingDocument AS AccountingDocument,
  Acdoca.LedgerGLLineItem AS LedgerGLLineItem,
  Acdoca.Ledger AS Ledger,
  Acdoca.AccountingDocumentItem AS AccountingDocumentItem,
  Acdoca.AccountingDocumentType AS AccountingDocumentType,
  Acdoca.TransactionTypeDetermination AS TransactionTypeDetermination,
  Acdoca.PostingDate AS PostingDate,
  GoodsService.BG_SAFTGoodsService AS BG_SAFTGoodsService,
  Acdoca.Product AS Product,
  coalesce(ProductText.ProductName, ProductTextE.ProductName) AS ProductDescription,
  Acdoca.CompanyCodeCurrency AS CompanyCodeCurrency,
  Acdoca.TransactionCurrency AS TransactionCurrency,
  coalesce(UoM.BG_SAFTUnitOfMeasureFactor, RUoM.BG_SAFTUnitOfMeasureFactor) AS SourceUnitOfMeasureFactor,
  cast(case when Acdoca.BaseUnit = '' then Acdoca.ReferenceQuantityUnit else Acdoca.BaseUnit end as meins) as BaseUnit AS BaseUnitendasmeinsasBaseUnit,
  case when $parameters.P_AlternativeGLAccountIsUsed = 'X' then Acdoca.AlternativeGLAccount else Acdoca.GLAccount end as ActiveGLAccount AS GLAccountendasActiveGLAccount,
  case when Acdoca.Quantity = 0 then abs(Acdoca.ReferenceQuantity) else abs(Acdoca.Quantity) end as Quantity AS QuantityendasQuantity,
  Bkpf.TaxReportingDate AS TaxReportingDate,
  Bkpf.ExchangeRate AS ExchangeRate,
  TCurrency.Decimals AS TransactionCurrencyDecimals
FROM I_JournalEntryItem AS Acdoca
INNER JOIN I_JournalEntry AS Bkpf ON /* join condition not captured in parsed metadata */
INNER JOIN I_BG_SAFTSourceDocumentTypeMap AS DocType ON /* join condition not captured in parsed metadata */
INNER JOIN I_OperationalAcctgDocItem AS Bseg ON /* join condition not captured in parsed metadata */
INNER JOIN I_CompanyCode AS CompanyCode ON /* join condition not captured in parsed metadata */
;