P_RO_SAFTPURINVHDR1

CDS View

Pur Inv Header for RO SAFT Base 1

P_RO_SAFTPURINVHDR1 is a CDS View in S/4HANA. Pur Inv Header for RO SAFT Base 1. 1 CDS views read from this table.

CDS Views using this table (1)

ViewTypeJoinVDMDescription
C_RO_SAFTPurInvoiceHeader view from CONSUMPTION Purchase invoice header for RO SAFT
@AbapCatalog.sqlViewName:'PROSAFTPURIH1'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey:true
@VDM.viewType: #CONSUMPTION
@VDM.private:true
@EndUserText.label: 'Pur Inv Header for RO SAFT Base 1'
@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.usageType.sizeCategory: #L
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.dataClass: #TRANSACTIONAL
@AccessControl.authorizationCheck: #MANDATORY
@AccessControl.personalData.blocking: #BLOCKED_DATA_INCLUDED

/**
    - This view selects exactly one item of each purchase invoice
    - The selected item is a supplier item
    - In case of more suppliers it is the item whose AccountingDocumentItem is the highest
**/

define view P_RO_SAFTPurInvHdr1
  with parameters
    P_AlternativeGLAccountIsUsed : saft_ro_alt_gl_account_flag

  as select from           I_StRpJournalEntryHeaderLog                                                                          as Log

    inner join             P_RO_SAFTJournalEntryItemExc(P_AlternativeGLAccountIsUsed: $parameters.P_AlternativeGLAccountIsUsed) as Acdoca             on  Acdoca.AccountingDocument   = Log.AccountingDocument
                                                                                                                                                      and Acdoca.CompanyCode          = Log.CompanyCode
                                                                                                                                                      and Acdoca.FiscalYear           = Log.FiscalYear
                                                                                                                                                      and Acdoca.FinancialAccountType = 'K'

    inner join             P_RO_SAFTInvoiceItemCount(P_AlternativeGLAccountIsUsed: $parameters.P_AlternativeGLAccountIsUsed)    as ItemCount          on  ItemCount.AccountingDocument     = Acdoca.AccountingDocument
                                                                                                                                                      and ItemCount.CompanyCode            = Acdoca.CompanyCode
                                                                                                                                                      and ItemCount.FiscalYear             = Acdoca.FiscalYear
                                                                                                                                                      and ItemCount.PostingDate            = Acdoca.PostingDate
                                                                                                                                                      and ItemCount.AccountingDocumentType = Acdoca.AccountingDocumentType
                                                                                                                                                      and ItemCount.TaxType                = 'V'

    inner join             I_RO_SAFTDocumentTypeMap                                                                             as DocType            on  DocType.AccountingDocumentType    = Acdoca.AccountingDocumentType
                                                                                                                                                      and DocType.CompanyCode               = Acdoca.CompanyCode
                                                                                                                                                      and DocType.RO_SAFTSourceDocumentType = '03'

    left outer to one join I_RO_SAFTSpecialGLIndicator                                                                          as SpecialGLIndicator on  Acdoca.CompanyCode          = SpecialGLIndicator.CompanyCode
                                                                                                                                                      and Acdoca.FinancialAccountType = SpecialGLIndicator.AccountType
                                                                                                                                                      and Acdoca.SpecialGLCode        = SpecialGLIndicator.SpecialGLCode

{
  key Log.StatryRptCategory,
  key Log.StatryRptgEntity,
  key Log.StatryRptRunID,
  key Acdoca.SourceLedger,
  key Acdoca.Ledger,
  key Acdoca.CompanyCode,
  key Acdoca.FiscalYear,
  key Acdoca.AccountingDocument,
      Acdoca.PostingDate,
      Acdoca.AccountingDocumentType,
      max(Acdoca.AccountingDocumentItem) as AccountingDocumentItem
}
where
  SpecialGLIndicator.SpecialGLCode is null

group by
  Log.StatryRptCategory,
  Log.StatryRptgEntity,
  Log.StatryRptRunID,
  Acdoca.SourceLedger,
  Acdoca.Ledger,
  Acdoca.CompanyCode,
  Acdoca.FiscalYear,
  Acdoca.AccountingDocument,
  Acdoca.PostingDate,
  Acdoca.AccountingDocumentType