P_RO_SAFTPaymentHeader

DDL: P_RO_SAFTPAYMENTHEADER SQL: PROSAFTPAYHDR Type: view CONSUMPTION

P_RO_SAFTPaymentHeader is a Consumption CDS View in SAP S/4HANA. It reads from 2 data sources (C_RO_SAFTJournalEntryItemC, C_RO_SAFTJournalEntryItemC) and exposes 35 fields with key fields SourceLedger, Ledger, CompanyCode, AccountingDocument, FiscalYear.

Data Sources (2)

SourceAliasJoin Type
C_RO_SAFTJournalEntryItemC C_RO_SAFTJournalEntryItemC from
C_RO_SAFTJournalEntryItemC C_RO_SAFTJournalEntryItemC union

Parameters (2)

NameTypeDefault
P_AlternativeGLAccountIsUsed saft_ro_alt_gl_account_flag
P_UserSystemIdentifier sysid

Annotations (11)

NameValueLevelField
AbapCatalog.sqlViewName PROSAFTPAYHDR view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
VDM.viewType #CONSUMPTION view
VDM.private true view
ObjectModel.usageType.serviceQuality #X view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.dataClass #MIXED view
ClientHandling.algorithm #SESSION_VARIABLE view
AccessControl.personalData.blocking #NOT_REQUIRED view
AccessControl.authorizationCheck #NOT_REQUIRED view

Fields (35)

KeyFieldSource TableSource FieldDescription
KEY SourceLedger Item SourceLedger
KEY Ledger Item Ledger
KEY CompanyCode Item CompanyCode
KEY AccountingDocument Item AccountingDocument
KEY FiscalYear Item FiscalYear
FiscalPeriod Item FiscalPeriod
RO_SAFTJournalTransaction Item RO_SAFTJournalTransaction
DocumentDate Item DocumentDate
RO_SAFTPaymentMethod
DocumentItemText Item DocumentItemText
AccountingDocCreatedByUser Item AccountingDocCreatedByUser
TransactionCurrency Item TransactionCurrency
AmountInTransactionCurrency
StatryRptCategory Item StatryRptCategory
StatryRptgEntity Item StatryRptgEntity
StatryRptRunID Item StatryRptRunID
P_AlternativeGLAccountIsUsed
SourceLedger
KEY Ledger Item Ledger
KEY CompanyCode Item CompanyCode
KEY AccountingDocument Item AccountingDocument
KEY FiscalYear Item FiscalYear
FiscalPeriod Item FiscalPeriod
RO_SAFTJournalTransaction Item RO_SAFTJournalTransaction
DocumentDate Item DocumentDate
RO_SAFTPaymentMethod
DocumentItemText Item DocumentItemText
AccountingDocCreatedByUser Item AccountingDocCreatedByUser
TransactionCurrency Item TransactionCurrency
AmountInTransactionCurrency
StatryRptCategory Item StatryRptCategory
StatryRptgEntity Item StatryRptgEntity
StatryRptRunID Item StatryRptRunID
AccountIsMatched
ItemIsReportingRelevant
@AbapCatalog.sqlViewName: 'PROSAFTPAYHDR'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@VDM.viewType: #CONSUMPTION
@VDM.private:true
@ObjectModel.usageType.serviceQuality: #X
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.dataClass: #MIXED
@ClientHandling.algorithm: #SESSION_VARIABLE
@AccessControl.personalData.blocking: #NOT_REQUIRED
@AccessControl.authorizationCheck: #NOT_REQUIRED
define view P_RO_SAFTPaymentHeader
  with parameters
    P_AlternativeGLAccountIsUsed : saft_ro_alt_gl_account_flag,
    P_UserSystemIdentifier       : sysid

  // PaymentMapping to GL Account

  as select from C_RO_SAFTJournalEntryItemC(
                 P_AlternativeGLAccountIsUsed : $parameters.P_AlternativeGLAccountIsUsed,
                 P_VATRegistration : '' ) as Item

    join         I_RO_SAFTPaymentMapping  as PaymentMapping on PaymentMapping.CompanyCode               = Item.CompanyCode
                                                            and(
                                                              (
                                                                PaymentMapping.AccountingDocumentType   = Item.AccountingDocumentType
                                                                and(
                                                                  PaymentMapping.GLAccount              = Item.GLAccount
                                                                )
                                                                or(
                                                                  PaymentMapping.AccountingDocumentType = Item.AccountingDocumentType
                                                                  and PaymentMapping.GLAccount          is initial
                                                                  and Item.BusinessPartner              is not initial
                                                                )
                                                              )
                                                            )
    join         I_RO_SAFTAccountingItem  as AccountingItem on  AccountingItem.CompanyCode            = Item.CompanyCode
                                                            and AccountingItem.AccountingDocument     = Item.AccountingDocument
                                                            and AccountingItem.FiscalYear             = Item.FiscalYear
                                                            and AccountingItem.AccountingDocumentItem = Item.AccountingDocumentItem
    join         I_RO_SAFTPaymentMethod   as PaymentMethod  on  PaymentMethod.CompanyCode   = Item.CompanyCode
                                                            and PaymentMethod.PaymentMethod = AccountingItem.PaymentMethod


{
  key Item.SourceLedger,
  key Item.Ledger,
  key Item.CompanyCode,
  key Item.AccountingDocument,
  key Item.FiscalYear,
      Item.FiscalPeriod,
      Item.RO_SAFTJournalTransaction,
      Item.DocumentDate,
      max( PaymentMethod.RO_SAFTPaymentMethod ) as RO_SAFTPaymentMethod,
      Item.DocumentItemText,
      cast(concat( $parameters.P_UserSystemIdentifier,
        concat( concat( concat( '/', cast( $session.client as char3 )), '/' ) ,
        Item.AccountingDocument ) ) as text18)  as RO_SAFTSystemID,
      Item.AccountingDocCreatedByUser,
      Item.TransactionCurrency,
      sum( Item.AmountInTransactionCurrency )   as AmountInTransactionCurrency,
      Item.StatryRptCategory,
      Item.StatryRptgEntity,
      Item.StatryRptRunID,
      case $parameters.P_AlternativeGLAccountIsUsed
        when 'X' then ''
        else 'X'
      end                                       as AccountIsMatched,
      'X'                                       as ItemIsReportingRelevant
}
group by
  Item.SourceLedger,
  Item.Ledger,
  Item.CompanyCode,
  Item.AccountingDocument,
  Item.FiscalYear,
  Item.FiscalPeriod,
  Item.RO_SAFTJournalTransaction,
  Item.DocumentDate,
  Item.DocumentItemText,
  Item.AccountingDocCreatedByUser,
  Item.TransactionCurrency,
  Item.StatryRptCategory,
  Item.StatryRptgEntity,
  Item.StatryRptRunID

// PaymentMapping to Alternative GL Account

union select from C_RO_SAFTJournalEntryItemC(
                  P_AlternativeGLAccountIsUsed : $parameters.P_AlternativeGLAccountIsUsed,
                  P_VATRegistration : '' ) as Item

  join            I_RO_SAFTPaymentMapping  as PaymentMapping on PaymentMapping.CompanyCode               = Item.CompanyCode
                                                             and(
                                                               (
                                                                 PaymentMapping.AccountingDocumentType   = Item.AccountingDocumentType
                                                                 and(
                                                                   PaymentMapping.GLAccount              = Item.AlternativeGLAccount
                                                                   and Item.AlternativeGLAccount         is not initial
                                                                 )
                                                                 or(
                                                                   PaymentMapping.AccountingDocumentType = Item.AccountingDocumentType
                                                                   and PaymentMapping.GLAccount          is initial
                                                                   and Item.BusinessPartner              is not initial
                                                                 )
                                                               )
                                                             )
  join            I_RO_SAFTAccountingItem  as AccountingItem on  AccountingItem.CompanyCode            = Item.CompanyCode
                                                             and AccountingItem.AccountingDocument     = Item.AccountingDocument
                                                             and AccountingItem.FiscalYear             = Item.FiscalYear
                                                             and AccountingItem.AccountingDocumentItem = Item.AccountingDocumentItem
  join            I_RO_SAFTPaymentMethod   as PaymentMethod  on  PaymentMethod.CompanyCode   = Item.CompanyCode
                                                             and PaymentMethod.PaymentMethod = AccountingItem.PaymentMethod


{
  key Item.SourceLedger,
  key Item.Ledger,
  key Item.CompanyCode,
  key Item.AccountingDocument,
  key Item.FiscalYear,
      Item.FiscalPeriod,
      Item.RO_SAFTJournalTransaction,
      Item.DocumentDate,
      max( PaymentMethod.RO_SAFTPaymentMethod ) as RO_SAFTPaymentMethod,
      Item.DocumentItemText,
      cast(concat( $parameters.P_UserSystemIdentifier,
        concat( concat( concat( '/', cast( $session.client as char3 )), '/' ) ,
        Item.AccountingDocument ) ) as text18)  as RO_SAFTSystemID,
      Item.AccountingDocCreatedByUser,
      Item.TransactionCurrency,
      sum( Item.AmountInTransactionCurrency )   as AmountInTransactionCurrency,
      Item.StatryRptCategory,
      Item.StatryRptgEntity,
      Item.StatryRptRunID,
      $parameters.P_AlternativeGLAccountIsUsed  as AccountIsMatched,
      'X'                                       as ItemIsReportingRelevant
}
group by
  Item.SourceLedger,
  Item.Ledger,
  Item.CompanyCode,
  Item.AccountingDocument,
  Item.FiscalYear,
  Item.FiscalPeriod,
  Item.RO_SAFTJournalTransaction,
  Item.DocumentDate,
  Item.DocumentItemText,
  Item.AccountingDocCreatedByUser,
  Item.TransactionCurrency,
  Item.StatryRptCategory,
  Item.StatryRptgEntity,
  Item.StatryRptRunID
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"C_RO_SAFTJOURNALENTRYITEMC",
"I_RO_SAFTACCOUNTINGITEM",
"I_RO_SAFTPAYMENTMAPPING",
"I_RO_SAFTPAYMENTMETHOD"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/