P_PL_SAFTInvcHeaderBscVersion2

DDL: P_PL_SAFTINVCHEADERBSCVERSION2 Type: view_entity COMPOSITE Package: GLO_FIN_IS_SAFT_PL

SAFT PL FA Invoice Header Basic Data

P_PL_SAFTInvcHeaderBscVersion2 is a Composite CDS View that provides data about "SAFT PL FA Invoice Header Basic Data" in SAP S/4HANA. It reads from 3 data sources (I_JournalEntry, I_OperationalAcctgDocItem, P_PL_SAFTINVOICETAXD) and exposes 28 fields with key fields CompanyCode, AccountingDocument, FiscalYear, AccountingDocumentItem. It has 1 association to related views. Part of development package GLO_FIN_IS_SAFT_PL.

Data Sources (3)

SourceAliasJoin Type
I_JournalEntry Entry from
I_OperationalAcctgDocItem Item inner
P_PL_SAFTINVOICETAXD Tax inner

Parameters (2)

NameTypeDefault
P_StartDate datum
P_EndDate datum

Associations (1)

CardinalityTargetAliasCondition
[0..1] I_JournalEntryItemOneTimeData _OneTimeAccountBP $projection.CompanyCode = _OneTimeAccountBP.CompanyCode and $projection.FiscalYear = _OneTimeAccountBP.FiscalYear and $projection.AccountingDocument = _OneTimeAccountBP.AccountingDocument and $projection.AccountingDocumentItem = _OneTimeAccountBP.AccountingDocumentItem

Annotations (7)

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

Fields (28)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode I_JournalEntry CompanyCode
KEY AccountingDocument I_JournalEntry AccountingDocument
KEY FiscalYear I_JournalEntry FiscalYear
KEY AccountingDocumentItem
BusinessTransactionType I_JournalEntry BusinessTransactionType
TaxReportingDate I_JournalEntry TaxReportingDate
PostingDate I_JournalEntry PostingDate
DocumentDate I_JournalEntry DocumentDate
ReferenceDocumentType I_JournalEntry ReferenceDocumentType
TransactionCurrency I_JournalEntry TransactionCurrency
CompanyCodeCurrency I_JournalEntry CompanyCodeCurrency
DocumentReferenceID I_JournalEntry DocumentReferenceID
AlternativeReferenceDocument I_JournalEntry AlternativeReferenceDocument
Customer I_OperationalAcctgDocItem Customer
Supplier I_OperationalAcctgDocItem Supplier
DocumentItemText I_OperationalAcctgDocItem DocumentItemText
InvoiceReference I_OperationalAcctgDocItem InvoiceReference
InvoiceReferenceFiscalYear I_OperationalAcctgDocItem InvoiceReferenceFiscalYear
BillingDocument I_OperationalAcctgDocItem BillingDocument
IsEUTriangularDeal I_OperationalAcctgDocItem IsEUTriangularDeal
VATRegistration I_OperationalAcctgDocItem VATRegistration
TaxCountry I_OperationalAcctgDocItem TaxCountry
AmountInTransactionCurrency
AmountInCompanyCodeCurrency
_CompanyCode I_JournalEntry _CompanyCode
_Customer I_OperationalAcctgDocItem _Customer
_Supplier I_OperationalAcctgDocItem _Supplier
_OneTimeAccountBP _OneTimeAccountBP
@AccessControl.authorizationCheck: #NOT_REQUIRED
@AccessControl.personalData.blocking : #NOT_REQUIRED
@VDM.viewType: #COMPOSITE
@VDM.private:true
@ObjectModel.usageType.serviceQuality: #P
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.dataClass: #MIXED

define view entity P_PL_SAFTInvcHeaderBscVersion2
   with parameters
    P_StartDate : datum,
    P_EndDate   : datum
  as select from I_JournalEntry            as Entry
    inner join   I_OperationalAcctgDocItem as Item       on  Item.CompanyCode          = Entry.CompanyCode
                                                         and Item.AccountingDocument   = Entry.AccountingDocument
                                                         and Item.FiscalYear           = Entry.FiscalYear
                                                         and Item.FinancialAccountType = 'D'

//    inner join   P_PL_SAFTMapTaxCode       as MapTaxCode on  Entry.CompanyCode        = MapTaxCode.CompanyCode

//                                                         and Entry.FiscalYear         = MapTaxCode.FiscalYear

//                                                         and Entry.AccountingDocument = MapTaxCode.AccountingDocument

                                                         
   inner join   P_PL_SAFTINVOICETAXD       as Tax  on  Tax.CompanyCode        = Item.CompanyCode
                                                   and Tax.AccountingDocument = Item.AccountingDocument
                                                   and Tax.FiscalYear         = Item.FiscalYear
                                                   and Tax.TaxCode            = Item.TaxCode
    

  association [0..1] to I_JournalEntryItemOneTimeData as _OneTimeAccountBP on  $projection.CompanyCode            = _OneTimeAccountBP.CompanyCode
                                                                and $projection.FiscalYear             = _OneTimeAccountBP.FiscalYear
                                                                and $projection.AccountingDocument     = _OneTimeAccountBP.AccountingDocument
                                                                and $projection.AccountingDocumentItem = _OneTimeAccountBP.AccountingDocumentItem

{
  key Entry.CompanyCode,
  key Entry.AccountingDocument,
  key Entry.FiscalYear,
  key max(Item.AccountingDocumentItem)                 as AccountingDocumentItem,

      Entry.BusinessTransactionType,

      Entry.TaxReportingDate,
      Entry.PostingDate,
      Entry.DocumentDate,
      Entry.ReferenceDocumentType,

      Entry.TransactionCurrency,
      Entry.CompanyCodeCurrency,

      Entry.DocumentReferenceID,
      Entry.AlternativeReferenceDocument,

      Item.Customer,
      Item.Supplier,

      Item.DocumentItemText,

      Item.InvoiceReference,
      Item.InvoiceReferenceFiscalYear,
      
      Item.BillingDocument,

      Item.IsEUTriangularDeal,

      Item.VATRegistration,
      Item.TaxCountry,

      @Semantics.amount.currencyCode: 'TransactionCurrency'
      sum (Item.AmountInTransactionCurrency) * -1 as AmountInTransactionCurrency,
      @Semantics.amount.currencyCode: 'CompanyCodeCurrency'
      sum(Item.AmountInCompanyCodeCurrency) * -1 as AmountInCompanyCodeCurrency,

      Entry._CompanyCode,
      Item._Customer,
      Item._Supplier,
      _OneTimeAccountBP
}
where
          Entry.TaxReportingDate        between $parameters.P_StartDate and $parameters.P_EndDate
  and(
          Entry.BusinessTransactionType = 'SD00'
    or    Entry.BusinessTransactionType = 'RFBU'
  )
  and(
    (
          Item.Supplier                is not null
      and Item.Supplier                is not initial
    )
    or(
          Item.Customer                is not null
      and Item.Customer                is not initial
    )
  )
group by
  Entry.CompanyCode,
  Entry.AccountingDocument,
  Entry.FiscalYear,
  Entry.BusinessTransactionType,
  Entry.TaxReportingDate,
  Entry.PostingDate,
  Entry.DocumentDate,
  Entry.TransactionCurrency,
  Entry.CompanyCodeCurrency,
  Entry.DocumentReferenceID,
  Entry.AlternativeReferenceDocument,
  Entry.ReferenceDocumentType,
  Item.Customer,
  Item.Supplier,
  Item.DocumentItemText,
  Item.InvoiceReference,
  Item.InvoiceReferenceFiscalYear,
  Item.BillingDocument,
  Item.IsEUTriangularDeal,
  Item.TaxCountry,
  Item.VATRegistration