C_PE_StRpPurLdgrFrgnSuplrC

DDL: C_PE_STRPPURLDGRFRGNSUPLRC SQL: CPEPRLDFRC Type: view CONSUMPTION

Purchase Ledger Foreign Vendors - Cube

C_PE_StRpPurLdgrFrgnSuplrC is a Consumption CDS View (Cube) that provides data about "Purchase Ledger Foreign Vendors - Cube" in SAP S/4HANA. It reads from 3 data sources (P_PE_PurFrgnSuplrEntryAggrgd, P_PE_JrnlEntryWthOfclDocClass, I_StRpJournalEntryLog) and exposes 21 fields with key fields CompanyCode, FiscalYear, AccountingDocument, StatryRptCategory, StatryRptgEntity.

Data Sources (3)

SourceAliasJoin Type
P_PE_PurFrgnSuplrEntryAggrgd JournalEntry from
P_PE_JrnlEntryWthOfclDocClass JrnlEntryWthOfclDocClass inner
I_StRpJournalEntryLog StRpJournalEntryLog inner

Parameters (2)

NameTypeDefault
P_PE_ClassfctnRevenueType hryid
P_PE_ClassfctnServiceType hryid

Annotations (13)

NameValueLevelField
AbapCatalog.sqlViewName CPEPRLDFRC view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #MANDATORY view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.dataClass #MIXED view
VDM.viewType #CONSUMPTION view
Analytics.dataCategory #CUBE view
Analytics.internalName #LOCAL view
ClientHandling.algorithm #SESSION_VARIABLE view
AccessControl.personalData.blocking #BLOCKED_DATA_INCLUDED view
EndUserText.label Purchase Ledger Foreign Vendors - Cube view
Metadata.allowExtensions true view

Fields (21)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode P_PE_PurFrgnSuplrEntryAggrgd CompanyCode
KEY FiscalYear P_PE_PurFrgnSuplrEntryAggrgd FiscalYear
KEY AccountingDocument P_PE_PurFrgnSuplrEntryAggrgd AccountingDocument
KEY StatryRptCategory I_StRpJournalEntryLog StatryRptCategory
KEY StatryRptgEntity I_StRpJournalEntryLog StatryRptgEntity
KEY StatryRptRunID I_StRpJournalEntryLog StatryRptRunID
KEY Ledger P_PE_PurFrgnSuplrEntryAggrgd Ledger
ReportingDate P_PE_PurFrgnSuplrEntryAggrgd ReportingDate
FiscalPeriod P_PE_PurFrgnSuplrEntryAggrgd FiscalPeriod
CalendarYearMonth P_PE_PurFrgnSuplrEntryAggrgd CalendarYearMonth
FiscalPeriodDate P_PE_PurFrgnSuplrEntryAggrgd FiscalPeriodDate
DocumentDate P_PE_PurFrgnSuplrEntryAggrgd DocumentDate
PE_DocumentSerialNumber P_PE_PurFrgnSuplrEntryAggrgd PE_DocumentSerialNumber
PE_OfficialDocumentNumber P_PE_PurFrgnSuplrEntryAggrgd PE_OfficialDocumentNumber
TransactionCurrency P_PE_PurFrgnSuplrEntryAggrgd TransactionCurrency
CountryCurrency P_PE_PurFrgnSuplrEntryAggrgd CountryCurrency
PE_SUNATCountryCode P_PE_PurFrgnSuplrEntryAggrgd PE_SUNATCountryCode
SupplierName P_PE_PurFrgnSuplrEntryAggrgd SupplierName
TaxNumber1 P_PE_PurFrgnSuplrEntryAggrgd TaxNumber1
PE_ConventionAvoidDoubleTxn P_PE_PurFrgnSuplrEntryAggrgd PE_ConventionAvoidDoubleTxn
WhldgTaxBaseAmtInCoCodeCrcy P_PE_PurFrgnSuplrEntryAggrgd WhldgTaxBaseAmtInCoCodeCrcy
@AbapCatalog.sqlViewName: 'CPEPRLDFRC'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #MANDATORY
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.dataClass: #MIXED
@VDM.viewType: #CONSUMPTION
@Analytics: { dataCategory: #CUBE }
@Analytics.internalName: #LOCAL
@ClientHandling.algorithm: #SESSION_VARIABLE
@AccessControl.personalData.blocking: #BLOCKED_DATA_INCLUDED
@EndUserText.label: 'Purchase Ledger Foreign Vendors - Cube'
@Metadata.allowExtensions:true

define view C_PE_StRpPurLdgrFrgnSuplrC
  with parameters
    P_PE_ClassfctnRevenueType : hryid,
    P_PE_ClassfctnServiceType : hryid

  as select from           P_PE_PurFrgnSuplrEntryAggrgd  as JournalEntry

    inner join             I_StRpJournalEntryLog         as StRpJournalEntryLog      on  StRpJournalEntryLog.CompanyCode                   = JournalEntry.CompanyCode
                                                                                     and StRpJournalEntryLog.AccountingDocument            = JournalEntry.AccountingDocument
                                                                                     and StRpJournalEntryLog.FiscalYear                    = JournalEntry.FiscalYear

    inner join             P_PE_JrnlEntryWthOfclDocClass as JrnlEntryWthOfclDocClass on  JrnlEntryWthOfclDocClass.CompanyCode              = JournalEntry.CompanyCode
                                                                                     and JrnlEntryWthOfclDocClass.AccountingDocument       = JournalEntry.AccountingDocument
                                                                                     and JrnlEntryWthOfclDocClass.FiscalYear               = JournalEntry.FiscalYear

    left outer to one join I_ExchangeRate                as ExchangeRate             on  ExchangeRate.SourceCurrency                       =  JournalEntry.TransactionCurrency
                                                                                     and ExchangeRate.TargetCurrency                       =  JournalEntry.CountryCurrency
                                                                                     and JournalEntry.TransactionCurrency                  <> JournalEntry.CountryCurrency
                                                                                     and ExchangeRate.ExchangeRateType                     =  JournalEntry.ExchangeRateType
                                                                                     and ExchangeRate.ExchangeRateEffectiveDate            =  JournalEntry.ExchangeRateEffectiveDate

    left outer to one join P_PE_JournalEntryFSStructure  as FinancialStatement1      on  FinancialStatement1.CompanyCode                   = JournalEntry.CompanyCode
                                                                                     and FinancialStatement1.FiscalYear                    = JournalEntry.FiscalYear
                                                                                     and FinancialStatement1.AccountingDocument            = JournalEntry.AccountingDocument
                                                                                     and FinancialStatement1.Ledger                        = JournalEntry.Ledger
                                                                                     and FinancialStatement1.FinancialStatementHierarchy   = $parameters.P_PE_ClassfctnRevenueType

    left outer to one join P_PE_JournalEntryFSStructure  as FinancialStatement2      on  FinancialStatement2.CompanyCode                   = JournalEntry.CompanyCode
                                                                                     and FinancialStatement2.FiscalYear                    = JournalEntry.FiscalYear
                                                                                     and FinancialStatement2.AccountingDocument            = JournalEntry.AccountingDocument
                                                                                     and FinancialStatement2.Ledger                        = JournalEntry.Ledger
                                                                                     and FinancialStatement2.FinancialStatementHierarchy   = $parameters.P_PE_ClassfctnServiceType

{
  key JournalEntry.CompanyCode,
  key JournalEntry.FiscalYear,
  key JournalEntry.AccountingDocument,
  key StRpJournalEntryLog.StatryRptCategory,
  key StRpJournalEntryLog.StatryRptgEntity,
  key StRpJournalEntryLog.StatryRptRunID,
  key JournalEntry.Ledger,

      JournalEntry.ReportingDate,
      JournalEntry.FiscalPeriod,
      JournalEntry.CalendarYearMonth,
      JournalEntry.FiscalPeriodDate,

      cast( case
              when JournalEntry.PE_OfficialDocumentType  is not initial
                then concat( JournalEntry.PE_OfficialDocumentType ,
                             concat( JournalEntry.PE_DocumentSerialNumber,
                                     JournalEntry.PE_OfficialDocumentNumber ) )
              else concat( JournalEntry.ODNDocumentClass,
                           concat( JournalEntry.PE_DocumentSerialNumber,
                                   JournalEntry.PE_OfficialDocumentNumber ) )
            end
      as fipe_car_sunat ) as PE_CARIdentifier,

      JournalEntry.DocumentDate,

      cast( case
              when JournalEntry.PE_OfficialDocumentType  is not initial
                then JournalEntry.PE_OfficialDocumentType
              else JournalEntry.ODNDocumentClass
            end
      as fipe_document_type ) as PE_OfficialDocumentType,

      JournalEntry.PE_DocumentSerialNumber,
      JournalEntry.PE_OfficialDocumentNumber,

      @Semantics.amount.currencyCode: 'CountryCurrency'
      cast( currency_conversion( amount             => JournalEntry.TaxBaseAmountInTransCrcy,
                                 source_currency    => JournalEntry.TransactionCurrency,
                                 target_currency    => JournalEntry.CountryCurrency,
                                 exchange_rate_date => JournalEntry.ExchangeRateEffectiveDate,
                                 error_handling     => 'SET_TO_NULL' )
      as fipe_value_of_acquisition_amt ) as PE_ValOfAcqnAmtInCtryCrcy,

      @Semantics.amount.currencyCode: 'CountryCurrency'
      cast( currency_conversion( amount             => JournalEntry.PE_AddlConceptAmtInCtryCrcy,
                                 source_currency    => JournalEntry.TransactionCurrency,
                                 target_currency    => JournalEntry.CountryCurrency,
                                 exchange_rate_date => JournalEntry.ExchangeRateEffectiveDate,
                                 error_handling     => 'SET_TO_NULL' )
      as fipe_other_taxes_charges ) as PE_OthTxAndChrgsAmtInCtryCrcy,

      @Semantics.amount.currencyCode: 'CountryCurrency'
      cast( currency_conversion( amount             => JournalEntry.AmountInTransactionCurrency,
                                 source_currency    => JournalEntry.TransactionCurrency,
                                 target_currency    => JournalEntry.CountryCurrency,
                                 exchange_rate_date => JournalEntry.ExchangeRateEffectiveDate,
                                 error_handling     => 'SET_TO_NULL' )
      as fipe_total_acquisition_amount ) as PE_TotAcqnAmtInCtryCrcy,

      @Semantics.currencyCode:true
      JournalEntry.TransactionCurrency,
      @Semantics.currencyCode:true
      JournalEntry.CountryCurrency,

      cast( case JournalEntry.TransactionCurrency
              when 'PEN'
                then 1
              else ExchangeRate.ExchangeRate
            end
      as fipe_exchange_rate ) as ExchangeRate,

      JournalEntry.PE_SUNATCountryCode,
      JournalEntry.SupplierName,
      JournalEntry.TaxNumber1,

      @Semantics.amount.currencyCode: 'CountryCurrency'
      cast( case
              when JournalEntry.ClearingDate is not initial
                then
                  currency_conversion( amount             => JournalEntry.TaxBaseAmountInTransCrcy,
                                       source_currency    => JournalEntry.TransactionCurrency,
                                       target_currency    => JournalEntry.CountryCurrency,
                                       exchange_rate_date => JournalEntry.ClearingDate,
                                       error_handling     => 'SET_TO_NULL' )
                else
                  0
            end
      as hwbas_shl ) as TaxBaseAmountInCoCodeCrcy,

      @Semantics.amount.currencyCode: 'CountryCurrency'
      cast( case
              when JournalEntry.ClearingDate is not initial
                then
                  currency_conversion( amount             => JournalEntry.PE_AddlConceptAmtInCtryCrcy,
                                       source_currency    => JournalEntry.TransactionCurrency,
                                       target_currency    => JournalEntry.CountryCurrency,
                                       exchange_rate_date => JournalEntry.ClearingDate,
                                       error_handling     => 'SET_TO_NULL' )
                else
                  0
            end
      as fipe_deduction_amount ) as PE_DeductionAmtInCtryCrcy,

      @Semantics.amount.currencyCode: 'CountryCurrency'
      cast( case
              when JournalEntry.ClearingDate is not initial
                then
                  currency_conversion( amount             => JournalEntry.AmountInTransactionCurrency,
                                       source_currency    => JournalEntry.TransactionCurrency,
                                       target_currency    => JournalEntry.CountryCurrency,
                                       exchange_rate_date => JournalEntry.ClearingDate,
                                       error_handling     => 'SET_TO_NULL' )
                else
                  0
            end
      as fis_hsl ) as AmountInCompanyCodeCurrency,

      cast( case
              when JournalEntry.ClearingDate is initial
                then
                  0
                else
                  JournalEntry.WithholdingTaxPercent
            end
      as qsatz ) as WithholdingTaxPercent,

      @Semantics.amount.currencyCode: 'CountryCurrency'
      cast( case
              when JournalEntry.ClearingDate is not initial
                then
                  currency_conversion( amount             => JournalEntry.WhldgTaxAmtInTransacCrcy,
                                       source_currency    => JournalEntry.TransactionCurrency,
                                       target_currency    => JournalEntry.CountryCurrency,
                                       exchange_rate_date => JournalEntry.ClearingDate,
                                       error_handling     => 'SET_TO_NULL' )
                else
                  0
            end
      as fis_qbshh ) as WhldgTaxAmtInCoCodeCrcy,

      JournalEntry.PE_ConventionAvoidDoubleTxn,

      cast( case
              when FinancialStatement1.FinancialStatementHierarchy = $parameters.P_PE_ClassfctnRevenueType
                then FinancialStatement1.HierarchyParentNodeVal
              else ''
            end
      as fipe_classfctn_revenue_type ) as PE_ClassificationRevenueType,

      cast( case
              when FinancialStatement2.FinancialStatementHierarchy = $parameters.P_PE_ClassfctnServiceType
                then FinancialStatement2.HierarchyParentNodeVal
              else ''
            end
      as fipe_classfctn_service_type ) as PE_ClassificationServiceType,

    @Semantics.amount.currencyCode: 'CountryCurrency'
    JournalEntry.WhldgTaxBaseAmtInCoCodeCrcy
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_EXCHANGERATE",
"I_STRPJOURNALENTRYLOG",
"P_PE_JOURNALENTRYFSSTRUCTURE",
"P_PE_JRNLENTRYWTHOFCLDOCCLASS",
"P_PE_PURFRGNSUPLRENTRYAGGRGD"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/