P_PE_StRpJournalEntryItem

DDL: P_PE_STRPJOURNALENTRYITEM SQL: PPESRJENTRYITEM Type: view CONSUMPTION

Journal Entry Item for Peru in StRp

P_PE_StRpJournalEntryItem is a Consumption CDS View that provides data about "Journal Entry Item for Peru in StRp" in SAP S/4HANA. It reads from 5 data sources (I_AddlCompanyCodeInformation, I_JournalEntryItem, P_PE_JrnlEntryWthOfclDocClass, I_OneTimeAccountBP, I_StRpJournalEntryLog) and exposes 93 fields with key fields SourceLedger, CompanyCode, FiscalYear, AccountingDocument, LedgerGLLineItem.

Data Sources (5)

SourceAliasJoin Type
I_AddlCompanyCodeInformation CompanyCodeInfo inner
I_JournalEntryItem JournalEntryItem from
P_PE_JrnlEntryWthOfclDocClass JrnlEntryWthOfclDocClass inner
I_OneTimeAccountBP OneTimeAccountBP left_outer
I_StRpJournalEntryLog StRpJournalEntryLog inner

Parameters (1)

NameTypeDefault
P_ReportingCurrency glo_reporting_currency

Annotations (11)

NameValueLevelField
AbapCatalog.sqlViewName PPESRJENTRYITEM view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
AccessControl.authorizationCheck #NOT_REQUIRED view
ClientHandling.algorithm #SESSION_VARIABLE view
VDM.private true view
VDM.viewType #CONSUMPTION view
EndUserText.label Journal Entry Item for Peru in StRp view
ObjectModel.usageType.sizeCategory #XXL view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.serviceQuality #P view

Fields (93)

KeyFieldSource TableSource FieldDescription
KEY SourceLedger SourceLedger
KEY CompanyCode I_JournalEntryItem CompanyCode
KEY FiscalYear I_JournalEntryItem FiscalYear
KEY AccountingDocument I_JournalEntryItem AccountingDocument
KEY LedgerGLLineItem LedgerGLLineItem
KEY Ledger I_JournalEntryItem Ledger
KEY StatryRptCategory I_StRpJournalEntryLog StatryRptCategory
KEY StatryRptgEntity I_StRpJournalEntryLog StatryRptgEntity
KEY StatryRptRunID I_StRpJournalEntryLog StatryRptRunID
ExternalItemID
CalendarYearMonth
AccountingDocumentItem I_JournalEntryItem AccountingDocumentItem
LedgerFiscalYear LedgerFiscalYear
FiscalYearVariant FiscalYearVariant
ChartOfAccounts ChartOfAccounts
CountryChartOfAccounts CountryChartOfAccounts
ControllingArea ControllingArea
AccountingDocumentType I_JournalEntryItem AccountingDocumentType
FinancialTransactionType FinancialTransactionType
BusinessTransactionType I_JournalEntryItem BusinessTransactionType
ReferenceDocument ReferenceDocument
ReferenceDocumentItem ReferenceDocumentItem
ReferenceDocumentItemGroup ReferenceDocumentItemGroup
IsReversal I_JournalEntryItem IsReversal
IsReversed I_JournalEntryItem IsReversed
ReversalReferenceDocumentCntxt I_JournalEntryItem ReversalReferenceDocumentCntxt
ReversalReferenceDocument I_JournalEntryItem ReversalReferenceDocument
DocumentReferenceID P_PE_JrnlEntryWthOfclDocClass DocumentReferenceID
Customer Customer
Supplier Supplier
TaxNumber1elseendasstcd1asTaxNumber1
DocumentItemText DocumentItemText
GLAccount GLAccount
AlternativeGLAccount AlternativeGLAccount
FinancialAccountType FinancialAccountType
CostCenter CostCenter
ProfitCenter ProfitCenter
FunctionalArea FunctionalArea
BusinessArea BusinessArea
Segment Segment
PartnerCostCenter PartnerCostCenter
PartnerProfitCenter PartnerProfitCenter
PartnerBusinessArea PartnerBusinessArea
ODNDocumentClass P_PE_JrnlEntryWthOfclDocClass ODNDocumentClass
DocumentDate P_PE_JrnlEntryWthOfclDocClass DocumentDate
PostingDate P_PE_JrnlEntryWthOfclDocClass PostingDate
ReportingDate P_PE_JrnlEntryWthOfclDocClass ReportingDate
ClearingDate ClearingDate
CompanyCodeCurrency I_JournalEntryItem CompanyCodeCurrency
TransactionCurrency I_JournalEntryItem TransactionCurrency
GlobalCurrency GlobalCurrency
BalanceTransactionCurrency BalanceTransactionCurrency
ReportingCurrency
PE_CompanyCodeTaxNumber I_AddlCompanyCodeInformation CompanyCodeParameterValue
CreditAmountInCoCodeCrcy CreditAmountInCoCodeCrcy
CreditAmountInTransCrcy CreditAmountInTransCrcy
CreditAmountInGlobalCrcy CreditAmountInGlobalCrcy
CreditAmountInBalanceTransCrcy CreditAmountInBalanceTransCrcy
DebitAmountInCoCodeCrcy DebitAmountInCoCodeCrcy
DebitAmountInTransCrcy DebitAmountInTransCrcy
DebitAmountInGlobalCrcy DebitAmountInGlobalCrcy
DebitAmountInBalanceTransCrcy DebitAmountInBalanceTransCrcy
_SourceLedger _SourceLedger
_CompanyCode I_JournalEntryItem _CompanyCode
_FiscalYear I_JournalEntryItem _FiscalYear
_FiscalYearVariant _FiscalYearVariant
_JournalEntry _JournalEntry
_Ledger I_JournalEntryItem _Ledger
_LedgerFiscalYearForVariant _LedgerFiscalYearForVariant
_ChartOfAccounts _ChartOfAccounts
_CountryChartOfAccounts _CountryChartOfAccounts
_ControllingArea _ControllingArea
_AccountingDocumentType I_JournalEntryItem _AccountingDocumentType
_FinancialTransactionType _FinancialTransactionType
_BusinessTransactionType I_JournalEntryItem _BusinessTransactionType
_Customer _Customer
_Supplier _Supplier
_GLAccountInChartOfAccounts _GLAccountInChartOfAccounts
_AlternativeGLAccount _AlternativeGLAccount
_FinancialAccountType _FinancialAccountType
_CostCenter _CostCenter
_ProfitCenter _ProfitCenter
_FunctionalArea _FunctionalArea
_BusinessArea _BusinessArea
_PartnerBusinessArea _PartnerBusinessArea
_Segment _Segment
_PartnerCostCenter _PartnerCostCenter
_PartnerProfitCenter _PartnerProfitCenter
_CompanyCodeCurrency I_JournalEntryItem _CompanyCodeCurrency
_TransactionCurrency I_JournalEntryItem _TransactionCurrency
_GlobalCurrency _GlobalCurrency
_BalanceTransactionCurrency _BalanceTransactionCurrency
AssignmentReference I_JournalEntryItem AssignmentReference
@AbapCatalog.sqlViewName: 'PPESRJENTRYITEM'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ClientHandling.algorithm: #SESSION_VARIABLE
@VDM.private:true
@VDM.viewType: #CONSUMPTION
@EndUserText.label: 'Journal Entry Item for Peru in StRp'
@ObjectModel.usageType.sizeCategory: #XXL
@ObjectModel.usageType.dataClass: #MIXED
@ObjectModel.usageType.serviceQuality: #P

define view P_PE_StRpJournalEntryItem
  with parameters
    P_ReportingCurrency : glo_reporting_currency

  as select from I_JournalEntryItem           as JournalEntryItem

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

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

    inner join I_AddlCompanyCodeInformation   as CompanyCodeInfo          on  CompanyCodeInfo.CompanyCode              = JournalEntryItem.CompanyCode
                                                                          and CompanyCodeInfo.CompanyCodeParameterType = 'TAXNR'

    left outer join I_OneTimeAccountBP        as OneTimeAccountBP         on  JournalEntryItem.CompanyCode            = OneTimeAccountBP.CompanyCode
                                                                          and JournalEntryItem.FiscalYear             = OneTimeAccountBP.FiscalYear
                                                                          and JournalEntryItem.AccountingDocument     = OneTimeAccountBP.AccountingDocument
                                                                          and JournalEntryItem.AccountingDocumentItem = OneTimeAccountBP.AccountingDocumentItem

{
  key SourceLedger,
  key JournalEntryItem.CompanyCode,
  key JournalEntryItem.FiscalYear,
  key JournalEntryItem.AccountingDocument,
  key LedgerGLLineItem,
  key JournalEntryItem.Ledger,
  key StRpJournalEntryLog.StatryRptCategory,
  key StRpJournalEntryLog.StatryRptgEntity,
  key StRpJournalEntryLog.StatryRptRunID,

      cast( ( JournalEntryItem.AccountingDocument )
      as fipe_unique_identifier )     as AccountingDocumentExtendedID,

      cast(( concat( 'M', LedgerGLLineItem )) as fipe_external_item_id ) as ExternalItemID,

      cast( concat( substring( ReportingDate, 1, 6 ) , '00' ) as fipe_calendar_year_month_day  ) as CalendarYearMonth,

      JournalEntryItem.AccountingDocumentItem,
      LedgerFiscalYear,
      FiscalYearVariant,
      ChartOfAccounts,
      CountryChartOfAccounts,
      ControllingArea,
      JournalEntryItem.AccountingDocumentType,
      FinancialTransactionType,
      JournalEntryItem.BusinessTransactionType,
      ReferenceDocument,
      ReferenceDocumentItem,
      ReferenceDocumentItemGroup,
      JournalEntryItem.IsReversal,
      JournalEntryItem.IsReversed,
      JournalEntryItem.ReversalReferenceDocumentCntxt,
      JournalEntryItem.ReversalReferenceDocument,
      JrnlEntryWthOfclDocClass.DocumentReferenceID,

      cast( case
              when JrnlEntryWthOfclDocClass.DocumentReferenceID is not initial
                then case instr(substring(JrnlEntryWthOfclDocClass.DocumentReferenceID,1,3), '-')
                  when 3
                    then substring(JrnlEntryWthOfclDocClass.DocumentReferenceID,1,2)
                  else ''
                end
              else JrnlEntryWthOfclDocClass.ODNDocumentClass
            end
      as fipe_document_type ) as PE_OfficialDocumentType,

      cast( case
              when JrnlEntryWthOfclDocClass.DocumentReferenceID is not initial
                then
                  case instr(substring(JrnlEntryWthOfclDocClass.DocumentReferenceID,4,13), '-')
                    when 2
                      then substring(JrnlEntryWthOfclDocClass.DocumentReferenceID,4,1)
                    when 3
                      then substring(JrnlEntryWthOfclDocClass.DocumentReferenceID,4,2)
                    when 4
                      then substring(JrnlEntryWthOfclDocClass.DocumentReferenceID,4,3)
                    when 5
                      then substring(JrnlEntryWthOfclDocClass.DocumentReferenceID,4,4)
                  end
            end
      as fipe_serial_number) as PE_DocumentSerialNumber,

      cast( case substring(JrnlEntryWthOfclDocClass.DocumentReferenceID,1,2)
              when '50'
                then
                  case
                    when JrnlEntryWthOfclDocClass.DocumentReferenceID is not initial
                      then
                        case instr(substring(JrnlEntryWthOfclDocClass.DocumentReferenceID,4,13), '-')
                          when 2
                            then substring(JrnlEntryWthOfclDocClass.DocumentReferenceID,11,6)
                          when 3
                            then substring(JrnlEntryWthOfclDocClass.DocumentReferenceID,12,5)
                          when 4
                            then substring(JrnlEntryWthOfclDocClass.DocumentReferenceID,13,4)
                          when 5
                            then substring(JrnlEntryWthOfclDocClass.DocumentReferenceID,14,3)
                        end
                  end
              when '51'
                then
                  case
                    when JrnlEntryWthOfclDocClass.DocumentReferenceID is not initial
                      then
                        case instr(substring(JrnlEntryWthOfclDocClass.DocumentReferenceID,4,13), '-')
                          when 2
                            then substring(JrnlEntryWthOfclDocClass.DocumentReferenceID,11,6)
                          when 3
                            then substring(JrnlEntryWthOfclDocClass.DocumentReferenceID,12,5)
                          when 4
                            then substring(JrnlEntryWthOfclDocClass.DocumentReferenceID,13,4)
                          when 5
                            then substring(JrnlEntryWthOfclDocClass.DocumentReferenceID,14,3)
                        end
                  end
              else
                case instr(substring(JrnlEntryWthOfclDocClass.DocumentReferenceID,4,13), '-')
                  when 2
                    then substring(JrnlEntryWthOfclDocClass.DocumentReferenceID,6,11)
                  when 3
                    then substring(JrnlEntryWthOfclDocClass.DocumentReferenceID,7,10)
                  when 4
                    then substring(JrnlEntryWthOfclDocClass.DocumentReferenceID,8,9)
                  when 5
                    then substring(JrnlEntryWthOfclDocClass.DocumentReferenceID,9,8)
                end
            end
      as fipe_official_doc_number) as PE_OfficialDocumentNumber,

      Customer,
      Supplier,

      cast( case
              when OneTimeAccountBP.AccountingDocument is not null
                then OneTimeAccountBP.TaxNumberType
              when FinancialAccountType = 'K'
                then _Supplier.TaxNumberType
              when FinancialAccountType = 'D'
                then _Customer.TaxNumberType
              else
                ''
            end
      as j_1atoid ) as TaxNumberType,

      cast( case
              when OneTimeAccountBP.AccountingDocument is not null
                then OneTimeAccountBP.TaxID1
              when FinancialAccountType = 'K'
                then _Supplier.TaxNumber1
              when FinancialAccountType = 'D'
                then _Customer.TaxNumber1
              else
                ''
            end
      as stcd1 ) as TaxNumber1,

      cast( case
              when OneTimeAccountBP.AccountingDocument is not null
                then OneTimeAccountBP.Country
              when FinancialAccountType = 'K'
                then _Supplier.Country
              when FinancialAccountType = 'D'
                then _Customer.Country
              else
                ''
            end
      as glo_partner_country ) as BusinessPartnerCountry,

      DocumentItemText,
      GLAccount,
      AlternativeGLAccount,
      FinancialAccountType,
      CostCenter,
      ProfitCenter,
      FunctionalArea,
      BusinessArea,
      Segment,
      PartnerCostCenter,
      PartnerProfitCenter,
      PartnerBusinessArea,
      JrnlEntryWthOfclDocClass.ODNDocumentClass,
      JrnlEntryWthOfclDocClass.DocumentDate,
      JrnlEntryWthOfclDocClass.PostingDate,
      JrnlEntryWthOfclDocClass.ReportingDate,
      ClearingDate,
      JournalEntryItem.CompanyCodeCurrency,
      JournalEntryItem.TransactionCurrency,
      GlobalCurrency,
      BalanceTransactionCurrency,

      cast( $parameters.P_ReportingCurrency as glo_reporting_currency ) as ReportingCurrency,

      @Semantics.amount.currencyCode: 'ReportingCurrency'
      cast(
        case $parameters.P_ReportingCurrency
          when JournalEntryItem.CompanyCodeCurrency
            then JournalEntryItem.CreditAmountInCoCodeCrcy
          when JournalEntryItem.TransactionCurrency
            then JournalEntryItem.CreditAmountInTransCrcy
          when JournalEntryItem.GlobalCurrency
            then JournalEntryItem.CreditAmountInGlobalCrcy
          when JournalEntryItem.BalanceTransactionCurrency
            then JournalEntryItem.CreditAmountInBalanceTransCrcy
          when JournalEntryItem.FreeDefinedCurrency1
            then JournalEntryItem.CreditAmountInFreeDefinedCrcy1
          when JournalEntryItem.FreeDefinedCurrency2
            then JournalEntryItem.CreditAmountInFreeDefinedCrcy2
          when JournalEntryItem.FreeDefinedCurrency3
            then JournalEntryItem.CreditAmountInFreeDefinedCrcy3
          when JournalEntryItem.FreeDefinedCurrency4
            then JournalEntryItem.CreditAmountInFreeDefinedCrcy4
          when JournalEntryItem.FreeDefinedCurrency5
            then JournalEntryItem.CreditAmountInFreeDefinedCrcy5
          when JournalEntryItem.FreeDefinedCurrency6
            then JournalEntryItem.CreditAmountInFreeDefinedCrcy6
          when JournalEntryItem.FreeDefinedCurrency7
            then JournalEntryItem.CreditAmountInFreeDefinedCrcy7
          when JournalEntryItem.FreeDefinedCurrency8
            then JournalEntryItem.CreditAmountInFreeDefinedCrcy8
          else
            0
        end as glo_credit_amount_rptg_crcy ) as CreditAmountInReportingCrcy,

      @Semantics.amount.currencyCode: 'ReportingCurrency'
      cast(
        case $parameters.P_ReportingCurrency
          when JournalEntryItem.CompanyCodeCurrency
            then JournalEntryItem.DebitAmountInCoCodeCrcy
          when JournalEntryItem.TransactionCurrency
            then JournalEntryItem.DebitAmountInTransCrcy
          when JournalEntryItem.GlobalCurrency
            then JournalEntryItem.DebitAmountInGlobalCrcy
          when JournalEntryItem.BalanceTransactionCurrency
            then JournalEntryItem.DebitAmountInBalanceTransCrcy
          when JournalEntryItem.FreeDefinedCurrency1
            then JournalEntryItem.DebitAmountInFreeDefinedCrcy1
          when JournalEntryItem.FreeDefinedCurrency2
            then JournalEntryItem.DebitAmountInFreeDefinedCrcy2
          when JournalEntryItem.FreeDefinedCurrency3
            then JournalEntryItem.DebitAmountInFreeDefinedCrcy3
          when JournalEntryItem.FreeDefinedCurrency4
            then JournalEntryItem.DebitAmountInFreeDefinedCrcy4
          when JournalEntryItem.FreeDefinedCurrency5
            then JournalEntryItem.DebitAmountInFreeDefinedCrcy5
          when JournalEntryItem.FreeDefinedCurrency6
            then JournalEntryItem.DebitAmountInFreeDefinedCrcy6
          when JournalEntryItem.FreeDefinedCurrency7
            then JournalEntryItem.DebitAmountInFreeDefinedCrcy7
          when JournalEntryItem.FreeDefinedCurrency8
            then JournalEntryItem.DebitAmountInFreeDefinedCrcy8
          else
            0
        end
      as glo_debit_amount_rptg_crcy ) as DebitAmountInReportingCurrency,

      CompanyCodeInfo.CompanyCodeParameterValue as PE_CompanyCodeTaxNumber,

      CreditAmountInCoCodeCrcy,
      CreditAmountInTransCrcy,
      CreditAmountInGlobalCrcy,
      CreditAmountInBalanceTransCrcy,
      DebitAmountInCoCodeCrcy,
      DebitAmountInTransCrcy,
      DebitAmountInGlobalCrcy,
      DebitAmountInBalanceTransCrcy,
      _SourceLedger,
      JournalEntryItem._CompanyCode,
      JournalEntryItem._FiscalYear,
      _FiscalYearVariant,
      _JournalEntry,
      JournalEntryItem._Ledger,
      _LedgerFiscalYearForVariant,
      _ChartOfAccounts,
      _CountryChartOfAccounts,
      _ControllingArea,
      JournalEntryItem._AccountingDocumentType,
      _FinancialTransactionType,
      JournalEntryItem._BusinessTransactionType,
      _Customer,
      _Supplier,
      _GLAccountInChartOfAccounts,
      _AlternativeGLAccount,
      _FinancialAccountType,
      _CostCenter,
      _ProfitCenter,
      _FunctionalArea,
      _BusinessArea,
      _PartnerBusinessArea,
      _Segment,
      _PartnerCostCenter,
      _PartnerProfitCenter,
      JournalEntryItem._CompanyCodeCurrency,
      JournalEntryItem._TransactionCurrency,
      _GlobalCurrency,
      _BalanceTransactionCurrency,
      JournalEntryItem.AssignmentReference
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_ADDLCOMPANYCODEINFORMATION",
"I_CUSTOMER",
"I_JOURNALENTRYITEM",
"I_ONETIMEACCOUNTBP",
"I_STRPJOURNALENTRYLOG",
"I_SUPPLIER",
"P_PE_JRNLENTRYWTHOFCLDOCCLASS"
],
"ASSOCIATED":
[
"I_ACCOUNTINGDOCUMENTTYPE",
"I_BUSINESSAREA",
"I_BUSINESSTRANSACTIONTYPE",
"I_CHARTOFACCOUNTS",
"I_COMPANYCODE",
"I_CONTROLLINGAREA",
"I_COSTCENTER",
"I_CURRENCY",
"I_CUSTOMER",
"I_FINANCIALACCOUNTTYPE",
"I_FINANCIALTRANSACTIONTYPE",
"I_FISCALYEARFORCOMPANYCODE",
"I_FISCALYEARFORVARIANT",
"I_FISCALYEARVARIANT",
"I_FUNCTIONALAREA",
"I_GLACCOUNTINCHARTOFACCOUNTS",
"I_JOURNALENTRY",
"I_LEDGER",
"I_PROFITCENTER",
"I_SEGMENT",
"I_SUPPLIER"
],
"BASE":
[
"I_JOURNALENTRYITEM"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/