P_RO_SAFTSalInvHdr1

DDL: P_RO_SAFTSALINVHDR1 SQL: PROSAFTSALIH1 Type: view CONSUMPTION

Sales Inv Header for RO SAFT Base 1

P_RO_SAFTSalInvHdr1 is a Consumption CDS View that provides data about "Sales Inv Header for RO SAFT Base 1" in SAP S/4HANA. It reads from 4 data sources (I_RO_SAFTDocumentTypeMap, I_StRpJournalEntryHeaderLog, P_RO_SAFTInvoiceItemCount, P_RO_SAFTJournalEntryItemExc) and exposes 9 fields with key fields StatryRptCategory, StatryRptgEntity, StatryRptRunID, SourceLedger, CompanyCode.

Data Sources (4)

SourceAliasJoin Type
I_RO_SAFTDocumentTypeMap DocType inner
I_StRpJournalEntryHeaderLog Log from
P_RO_SAFTInvoiceItemCount P_RO_SAFTInvoiceItemCount inner
P_RO_SAFTJournalEntryItemExc P_RO_SAFTJournalEntryItemExc inner

Parameters (1)

NameTypeDefault
P_AlternativeGLAccountIsUsed saft_ro_alt_gl_account_flag

Annotations (12)

NameValueLevelField
AbapCatalog.sqlViewName PROSAFTSALIH1 view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
VDM.viewType #CONSUMPTION view
VDM.private true view
EndUserText.label Sales Inv Header for RO SAFT Base 1 view
ClientHandling.algorithm #SESSION_VARIABLE view
ObjectModel.usageType.sizeCategory #L view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.dataClass #TRANSACTIONAL view
AccessControl.authorizationCheck #MANDATORY view
AccessControl.personalData.blocking #BLOCKED_DATA_INCLUDED view

Fields (9)

KeyFieldSource TableSource FieldDescription
KEY StatryRptCategory I_StRpJournalEntryHeaderLog StatryRptCategory
KEY StatryRptgEntity I_StRpJournalEntryHeaderLog StatryRptgEntity
KEY StatryRptRunID I_StRpJournalEntryHeaderLog StatryRptRunID
KEY SourceLedger Acdoca SourceLedger
KEY CompanyCode Acdoca CompanyCode
KEY FiscalYear Acdoca FiscalYear
KEY AccountingDocument Acdoca AccountingDocument
KEY Ledger Acdoca Ledger
AccountingDocumentItem
@AbapCatalog.sqlViewName:'PROSAFTSALIH1'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey:true
@VDM.viewType: #CONSUMPTION
@VDM.private:true
@EndUserText.label: 'Sales 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 sales invoice
    - The selected item is a customer item
    - In case of more customers it is the item whose AccountingDocumentItem is the highest
**/

define view P_RO_SAFTSalInvHdr1
  with parameters
    P_AlternativeGLAccountIsUsed : saft_ro_alt_gl_account_flag

  as select from           I_StRpJournalEntryHeaderLog                                                                          as Log

    inner join             P_RO_SAFTInvoiceItemCount(P_AlternativeGLAccountIsUsed: $parameters.P_AlternativeGLAccountIsUsed)    as ItemCount          on  ItemCount.AccountingDocument = Log.AccountingDocument
                                                                                                                                                      and ItemCount.CompanyCode        = Log.CompanyCode
                                                                                                                                                      and ItemCount.FiscalYear         = Log.FiscalYear

    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 = 'D'

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

    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.CompanyCode,
  key Acdoca.FiscalYear,
  key Acdoca.AccountingDocument,
  key Acdoca.Ledger,
      max(Acdoca.AccountingDocumentItem) as AccountingDocumentItem
}
where SpecialGLIndicator.SpecialGLCode is null

group by
  Log.StatryRptCategory,
  Log.StatryRptgEntity,
  Log.StatryRptRunID,
  Acdoca.SourceLedger,
  Acdoca.CompanyCode,
  Acdoca.FiscalYear,
  Acdoca.Ledger,
  Acdoca.AccountingDocument
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_RO_SAFTDOCUMENTTYPEMAP",
"I_RO_SAFTSPECIALGLINDICATOR",
"I_STRPJOURNALENTRYHEADERLOG",
"P_RO_SAFTINVOICEITEMCOUNT",
"P_RO_SAFTJOURNALENTRYITEMEXC"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/