P_PL_SAFTInvoiceHeaderBasic

DDL: P_PL_SAFTINVOICEHEADERBASIC SQL: PPLSAFTINVHDRBSC Type: view COMPOSITE

P_PL_SAFTInvoiceHeaderBasic is a Composite CDS View in SAP S/4HANA. It reads from 3 data sources (I_JournalEntry, I_OperationalAcctgDocItem, P_PL_SAFTMapTaxCode) and exposes 28 fields with key fields CompanyCode, AccountingDocument, FiscalYear, AccountingDocumentItem. It has 1 association to related views.

Data Sources (3)

SourceAliasJoin Type
I_JournalEntry Entry from
I_OperationalAcctgDocItem Item inner
P_PL_SAFTMapTaxCode MapTaxCode 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 (10)

NameValueLevelField
AbapCatalog.sqlViewName PPLSAFTINVHDRBSC view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
AccessControl.authorizationCheck #CHECK view
VDM.private true view
VDM.viewType #COMPOSITE view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.serviceQuality #P view
ClientHandling.algorithm #SESSION_VARIABLE 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 Customer
Supplier Supplier
DocumentItemText DocumentItemText
InvoiceReference InvoiceReference
InvoiceReferenceFiscalYear InvoiceReferenceFiscalYear
BillingDocument BillingDocument
IsEUTriangularDeal IsEUTriangularDeal
VATRegistration I_OperationalAcctgDocItem VATRegistration
TaxCountry I_OperationalAcctgDocItem TaxCountry
AmountInTransactionCurrency
AmountInCompanyCodeCurrency
_CompanyCode _CompanyCode
_Customer _Customer
_Supplier _Supplier
_OneTimeAccountBP _OneTimeAccountBP
@AbapCatalog.sqlViewName: 'PPLSAFTINVHDRBSC'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@VDM.private: true
@VDM.viewType: #COMPOSITE
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.dataClass:  #MIXED
@ObjectModel.usageType.serviceQuality: #P
@ClientHandling.algorithm: #SESSION_VARIABLE
define view P_PL_SAFTInvoiceHeaderBasic
  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

  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(AccountingDocumentItem)                 as AccountingDocumentItem,

      Entry.BusinessTransactionType,

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

      @Semantics.currencyCode: true
      Entry.TransactionCurrency,
      @Semantics.currencyCode: true
      Entry.CompanyCodeCurrency,

      Entry.DocumentReferenceID,
      Entry.AlternativeReferenceDocument,

      Customer,
      Supplier,

      DocumentItemText,

      InvoiceReference,
      InvoiceReferenceFiscalYear,
      
      BillingDocument,

      IsEUTriangularDeal,

      Item.VATRegistration,
      Item.TaxCountry,

      @Semantics.amount.currencyCode: 'TransactionCurrency'
      sum(MapTaxCode.AmountInTransactionCurrency) as AmountInTransactionCurrency,
      @Semantics.amount.currencyCode: 'CompanyCodeCurrency'
      sum(MapTaxCode.AmountInCompanyCodeCurrency) as AmountInCompanyCodeCurrency,

      _CompanyCode,
      _Customer,
      _Supplier,
      _OneTimeAccountBP
}
where
          TaxReportingDate        between $parameters.P_StartDate and $parameters.P_EndDate
  and(
          BusinessTransactionType = 'SD00'
    or    BusinessTransactionType = 'RFBU'
  )
  and(
    (
          Supplier                is not null
      and Supplier                is not initial
    )
    or(
          Customer                is not null
      and 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,
  Customer,
  Supplier,
  DocumentItemText,
  InvoiceReference,
  InvoiceReferenceFiscalYear,
  BillingDocument,
  IsEUTriangularDeal,
  Item.TaxCountry,
  Item.VATRegistration
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_JOURNALENTRY",
"I_OPERATIONALACCTGDOCITEM",
"P_PL_SAFTMAPTAXCODE"
],
"ASSOCIATED":
[
"I_COMPANYCODE",
"I_CUSTOMER",
"I_JOURNALENTRYITEMONETIMEDATA",
"I_SUPPLIER"
],
"BASE":
[
"I_JOURNALENTRY",
"I_OPERATIONALACCTGDOCITEM"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/