VALUATIONINVOICE

DDL: VALUATIONINVOICE Type: view_entity Package: FINS_FI_CLS_VAL_COMMON

Valuation run: original invoices(before reorg)

VALUATIONINVOICE is a CDS View that provides data about "Valuation run: original invoices(before reorg)" in SAP S/4HANA. It reads from 1 data source (VALUATIONACDOCA) and exposes 138 fields with key fields CompanyCode, FiscalYear, AccountingDocument, LedgerGLLineItem, Ledger. Part of development package FINS_FI_CLS_VAL_COMMON.

Data Sources (1)

SourceAliasJoin Type
VALUATIONACDOCA acdoca from

Parameters (2)

NameTypeDefault
p_fiscal_year_period fiscalyearperiod
p_key_date fis_budat

Annotations (5)

NameValueLevelField
AccessControl.authorizationCheck #NOT_ALLOWED view
AccessControl.personalData.blocking #BLOCKED_DATA_EXCLUDED view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.sizeCategory #XXL view
ObjectModel.usageType.dataClass #MIXED view

Fields (138)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode VALUATIONACDOCA CompanyCode
KEY FiscalYear VALUATIONACDOCA FiscalYear
KEY AccountingDocument VALUATIONACDOCA AccountingDocument
KEY LedgerGLLineItem VALUATIONACDOCA LedgerGLLineItem
KEY Ledger VALUATIONACDOCA Ledger
p_is_mdc_on VALUATIONACDOCA p_is_mdc_on
SourceLedger VALUATIONACDOCA SourceLedger
AccountingDocumentItem VALUATIONACDOCA AccountingDocumentItem
ClearingAccountingDocument VALUATIONACDOCA ClearingAccountingDocument
ClearingDocFiscalYear VALUATIONACDOCA ClearingDocFiscalYear
ClearingDate VALUATIONACDOCA ClearingDate
NetDueDate VALUATIONACDOCA NetDueDate
ChartOfAccounts VALUATIONACDOCA ChartOfAccounts
IsReversal VALUATIONACDOCA IsReversal
OrganizationalChange VALUATIONACDOCA OrganizationalChange
GLAccount VALUATIONACDOCA GLAccount
OriginalGlAccount VALUATIONACDOCA OriginalGlAccount
CreationDateTime VALUATIONACDOCA CreationDateTime
SubLedgerAcctLineItemType VALUATIONACDOCA SubLedgerAcctLineItemType
DocumentDate VALUATIONACDOCA DocumentDate
PostingDate VALUATIONACDOCA PostingDate
OriginalPostingDate VALUATIONACDOCA PostingDate
AccountingDocumentCategory VALUATIONACDOCA AccountingDocumentCategory
LedgerFiscalYear VALUATIONACDOCA LedgerFiscalYear
ReferenceDocumentType VALUATIONACDOCA ReferenceDocumentType
FiscalYearPeriod VALUATIONACDOCA FiscalYearPeriod
IsOpenItemManaged VALUATIONACDOCA IsOpenItemManaged
DebitCreditCode
PostingKey VALUATIONACDOCA PostingKey
BusinessTransactionCategory VALUATIONACDOCA BusinessTransactionCategory
GLAccountType VALUATIONACDOCA GLAccountType
FinancialAccountType VALUATIONACDOCA FinancialAccountType
AssignmentReference VALUATIONACDOCA AssignmentReference
CUSTOMER_SUPPLIER_GROUP_KEY VALUATIONACDOCA CUSTOMER_SUPPLIER_GROUP_KEY
FiscalPeriod VALUATIONACDOCA FiscalPeriod
OffsettingAccount VALUATIONACDOCA OffsettingAccount
WBSElement VALUATIONACDOCA WBSElement
BalanceTransactionCurrency VALUATIONACDOCA BalanceTransactionCurrency
CompanyCodeCurrency VALUATIONACDOCA CompanyCodeCurrency
GlobalCurrency VALUATIONACDOCA GlobalCurrency
FreeDefinedCurrency1 VALUATIONACDOCA FreeDefinedCurrency1
FreeDefinedCurrency2 VALUATIONACDOCA FreeDefinedCurrency2
FreeDefinedCurrency3 VALUATIONACDOCA FreeDefinedCurrency3
FreeDefinedCurrency4 VALUATIONACDOCA FreeDefinedCurrency4
FreeDefinedCurrency5 VALUATIONACDOCA FreeDefinedCurrency5
FreeDefinedCurrency6 VALUATIONACDOCA FreeDefinedCurrency6
FreeDefinedCurrency7 VALUATIONACDOCA FreeDefinedCurrency7
FreeDefinedCurrency8 VALUATIONACDOCA FreeDefinedCurrency8
AmountInBalanceTransacCrcy VALUATIONACDOCA AmountInBalanceTransacCrcy
AmountInCompanyCodeCurrency VALUATIONACDOCA AmountInCompanyCodeCurrency
AmountInGlobalCurrency VALUATIONACDOCA AmountInGlobalCurrency
AmountInFreeDefinedCurrency1 VALUATIONACDOCA AmountInFreeDefinedCurrency1
AmountInFreeDefinedCurrency2 VALUATIONACDOCA AmountInFreeDefinedCurrency2
AmountInFreeDefinedCurrency3 VALUATIONACDOCA AmountInFreeDefinedCurrency3
AmountInFreeDefinedCurrency4 VALUATIONACDOCA AmountInFreeDefinedCurrency4
AmountInFreeDefinedCurrency5 VALUATIONACDOCA AmountInFreeDefinedCurrency5
AmountInFreeDefinedCurrency6 VALUATIONACDOCA AmountInFreeDefinedCurrency6
AmountInFreeDefinedCurrency7 VALUATIONACDOCA AmountInFreeDefinedCurrency7
AmountInFreeDefinedCurrency8 VALUATIONACDOCA AmountInFreeDefinedCurrency8
TaxCode VALUATIONACDOCA TaxCode
TaxCountry VALUATIONACDOCA TaxCountry
HouseBank VALUATIONACDOCA HouseBank
HouseBankAccount VALUATIONACDOCA HouseBankAccount
CostCtrActivityType VALUATIONACDOCA CostCtrActivityType
WBSElementInternalID VALUATIONACDOCA WBSElementInternalID
FinancialTransactionType VALUATIONACDOCA FinancialTransactionType
JointVenture VALUATIONACDOCA JointVenture
JointVentureEquityGroup VALUATIONACDOCA JointVentureEquityGroup
PartnerVenture VALUATIONACDOCA PartnerVenture
JointVenturePartner VALUATIONACDOCA JointVenturePartner
JointVentureCostRecoveryCode VALUATIONACDOCA JointVentureCostRecoveryCode
JointVentureEquityType VALUATIONACDOCA JointVentureEquityType
ProjectNetwork VALUATIONACDOCA ProjectNetwork
RelatedNetworkActivity VALUATIONACDOCA RelatedNetworkActivity
OrderID VALUATIONACDOCA OrderID
BusinessProcess VALUATIONACDOCA BusinessProcess
SalesOrder VALUATIONACDOCA SalesOrder
SalesOrderItem VALUATIONACDOCA SalesOrderItem
CostObject VALUATIONACDOCA CostObject
CostCenter VALUATIONACDOCA CostCenter
ProfitCenter VALUATIONACDOCA ProfitCenter
FunctionalArea VALUATIONACDOCA FunctionalArea
BusinessArea VALUATIONACDOCA BusinessArea
ControllingArea VALUATIONACDOCA ControllingArea
Segment VALUATIONACDOCA Segment
PartnerCostCenter VALUATIONACDOCA PartnerCostCenter
PartnerProfitCenter VALUATIONACDOCA PartnerProfitCenter
PartnerFunctionalArea VALUATIONACDOCA PartnerFunctionalArea
PartnerBusinessArea VALUATIONACDOCA PartnerBusinessArea
PartnerCompany VALUATIONACDOCA PartnerCompany
PartnerSegment VALUATIONACDOCA PartnerSegment
Supplier VALUATIONACDOCA Supplier
Customer VALUATIONACDOCA Customer
FinancialValuationObjectType VALUATIONACDOCA FinancialValuationObjectType
FinancialValuationObject VALUATIONACDOCA FinancialValuationObject
FinancialValuationSubobject VALUATIONACDOCA FinancialValuationSubobject
REBusinessEntity VALUATIONACDOCA REBusinessEntity
RealEstateBuilding VALUATIONACDOCA RealEstateBuilding
RealEstateProperty VALUATIONACDOCA RealEstateProperty
Fund VALUATIONACDOCA Fund
BudgetPeriod VALUATIONACDOCA BudgetPeriod
GrantID VALUATIONACDOCA GrantID
PubSecBudgetAccount VALUATIONACDOCA PubSecBudgetAccount
CashLedgerAccount VALUATIONACDOCA CashLedgerAccount
SponsoredProgram VALUATIONACDOCA SponsoredProgram
SponsoredClass VALUATIONACDOCA SponsoredClass
Plant VALUATIONACDOCA Plant
Product VALUATIONACDOCA Product
ShipToParty VALUATIONACDOCA ShipToParty
PartnerFund VALUATIONACDOCA PartnerFund
PartnerGrant VALUATIONACDOCA PartnerGrant
CashLedgerCompanyCode VALUATIONACDOCA CashLedgerCompanyCode
FundsCenter VALUATIONACDOCA FundsCenter
PartnerEquityGroup VALUATIONACDOCA PartnerEquityGroup
FundedProgram VALUATIONACDOCA FundedProgram
PartnerBudgetPeriod VALUATIONACDOCA PartnerBudgetPeriod
AccrualObjectType VALUATIONACDOCA AccrualObjectType
AccrualObject VALUATIONACDOCA AccrualObject
AccrualSubobject VALUATIONACDOCA AccrualSubobject
AccrualItemType VALUATIONACDOCA AccrualItemType
AccrualReferenceObject VALUATIONACDOCA AccrualReferenceObject
AccrualObjectLogicalSystem VALUATIONACDOCA AccrualObjectLogicalSystem
PubSecBudgetAccountCoCode VALUATIONACDOCA PubSecBudgetAccountCoCode
ServiceDocument VALUATIONACDOCA ServiceDocument
ServiceDocumentItem VALUATIONACDOCA ServiceDocumentItem
ServiceDocumentType VALUATIONACDOCA ServiceDocumentType
Material VALUATIONACDOCA Material
GLRecordType VALUATIONACDOCA GLRecordType
PrdcssrJournalEntryCompanyCode VALUATIONACDOCA CompanyCode
PrdcssrJournalEntryFiscalYear VALUATIONACDOCA FiscalYear
PredecessorJournalEntry VALUATIONACDOCA AccountingDocument
PredecessorJournalEntryItem VALUATIONACDOCA LedgerGLLineItem
BusinessPartner VALUATIONACDOCA BusinessPartner
CreditRiskClass VALUATIONACDOCA CreditRiskClass
group_id
MASTERDATARECNCLNACCT VALUATIONACDOCA MASTERDATARECNCLNACCT
MASTERDATAPARTNERCOMPANY VALUATIONACDOCA MASTERDATAPARTNERCOMPANY
SpecialGLCode VALUATIONACDOCA SpecialGLCode
@AccessControl.authorizationCheck: #NOT_ALLOWED
@AccessControl.personalData.blocking: #BLOCKED_DATA_EXCLUDED

@ObjectModel.usageType: { serviceQuality: #D, sizeCategory: #XXL, dataClass: #MIXED }

define view entity VALUATIONINVOICE
  with parameters
    p_fiscal_year_period : fiscalyearperiod,
    p_key_date           : fis_budat

  as select from           VALUATIONACDOCA as acdoca

    left outer to one join fins_cls_wl     as wl on  acdoca.CompanyCode        = wl.companycode
                                                 and acdoca.LedgerGLLineItem   = wl.ledgergllineitem
                                                 and acdoca.FiscalYear         = wl.fiscalyear
                                                 and acdoca.AccountingDocument = wl.accountingdocument
                                                 and acdoca.Ledger             = wl.ledger
{
  key acdoca.CompanyCode,
  key acdoca.FiscalYear,
  key acdoca.AccountingDocument,
  key acdoca.LedgerGLLineItem,
  key acdoca.Ledger,
      @Environment.sql.passValue: true
      acdoca.p_is_mdc_on,
      acdoca.SourceLedger,

      acdoca.AccountingDocumentItem,


      acdoca.ClearingAccountingDocument,
      acdoca.ClearingDocFiscalYear,
      acdoca.ClearingDate,
      acdoca.NetDueDate,
      acdoca.ChartOfAccounts,
      wl.jrnlperiodendclosingrunloguuid,
      wl.finclosinglineitemprocessstep,

      case
        when acdoca.ClearingDate is not initial and acdoca.ClearingDate <= $parameters.p_key_date
        then 'X'
        else ' '
      end                                                         as IsClearedAtKeydate,


      // Debitor$parameters. Debit items are invoices, credit items are payments

      // Creditor$parameters. Credit items are invoices, debit items are payments

      // others$parameters. Debit items are invoices, credit items are payments

      case acdoca.FinancialAccountType
        when 'K'
        then

          case  acdoca._PostingKey.DebitCreditCode
            when 'S'
            then
              case  when acdoca.FiscalYearPeriod = $parameters.p_fiscal_year_period
              then 'PAYMENT_CURRENT'
              when acdoca.FiscalYearPeriod < $parameters.p_fiscal_year_period
              then 'PAYMENT_PREVIOUS'
            end
            else 'INVOICE' end

      else

        case acdoca._PostingKey.DebitCreditCode
        when 'H'
        then
          case  when acdoca.FiscalYearPeriod = $parameters.p_fiscal_year_period
          then 'PAYMENT_CURRENT'
          when acdoca.FiscalYearPeriod < $parameters.p_fiscal_year_period
          then 'PAYMENT_PREVIOUS'
        end
        else 'INVOICE' end

      end                                                         as line_type,

      cast(case
      when acdoca.IsReversed = 'X' and acdoca.ClearingDate is not initial and acdoca.ClearingDate <= $parameters.p_key_date then 'R'
      else '' end as  cls_line_item_type)                         as financialclosinglineitemtype,

      // filtering

      acdoca.IsReversal,
      acdoca.OrganizationalChange,
      acdoca.GLAccount,
      acdoca.OriginalGlAccount,

      acdoca.CreationDateTime,
      acdoca.SubLedgerAcctLineItemType,
      acdoca.DocumentDate,
      acdoca.PostingDate,
      acdoca.PostingDate                                          as OriginalPostingDate,
      acdoca.AccountingDocumentCategory,
      acdoca.LedgerFiscalYear,
      acdoca.ReferenceDocumentType,
      acdoca.FiscalYearPeriod,
      acdoca.IsOpenItemManaged,
      acdoca._PostingKey.DebitCreditCode,
      acdoca.PostingKey,
      acdoca.BusinessTransactionCategory,
      // grouping

      acdoca.GLAccountType,
      acdoca.FinancialAccountType,
      acdoca.AssignmentReference,

      acdoca.CUSTOMER_SUPPLIER_GROUP_KEY,

      acdoca.FiscalPeriod,
      acdoca.OffsettingAccount,
      acdoca.WBSElement,

      acdoca.BalanceTransactionCurrency,
      acdoca.CompanyCodeCurrency,
      acdoca.GlobalCurrency,
      acdoca.FreeDefinedCurrency1,
      acdoca.FreeDefinedCurrency2,
      acdoca.FreeDefinedCurrency3,
      acdoca.FreeDefinedCurrency4,
      acdoca.FreeDefinedCurrency5,
      acdoca.FreeDefinedCurrency6,
      acdoca.FreeDefinedCurrency7,
      acdoca.FreeDefinedCurrency8,

      acdoca.AmountInBalanceTransacCrcy,
      acdoca.AmountInCompanyCodeCurrency,
      acdoca.AmountInGlobalCurrency,
      acdoca.AmountInFreeDefinedCurrency1,
      acdoca.AmountInFreeDefinedCurrency2,
      acdoca.AmountInFreeDefinedCurrency3,
      acdoca.AmountInFreeDefinedCurrency4,
      acdoca.AmountInFreeDefinedCurrency5,
      acdoca.AmountInFreeDefinedCurrency6,
      acdoca.AmountInFreeDefinedCurrency7,
      acdoca.AmountInFreeDefinedCurrency8,

      acdoca.TaxCode,
      acdoca.TaxCountry,
      acdoca.HouseBank,
      acdoca.HouseBankAccount,
      acdoca.CostCtrActivityType,
      acdoca.WBSElementInternalID,
      acdoca.FinancialTransactionType,
      acdoca.JointVenture,
      acdoca.JointVentureEquityGroup,
      acdoca.PartnerVenture,
      acdoca.JointVenturePartner,
      acdoca.JointVentureCostRecoveryCode,
      acdoca.JointVentureEquityType,
      acdoca.ProjectNetwork,
      acdoca.RelatedNetworkActivity,
      acdoca.OrderID,
      acdoca.BusinessProcess,
      acdoca.SalesOrder,
      acdoca.SalesOrderItem,
      acdoca.CostObject,
      acdoca.CostCenter,
      acdoca.ProfitCenter,
      acdoca.FunctionalArea,
      acdoca.BusinessArea,
      acdoca.ControllingArea,
      acdoca.Segment,
      acdoca.PartnerCostCenter,
      acdoca.PartnerProfitCenter,
      acdoca.PartnerFunctionalArea,
      acdoca.PartnerBusinessArea,
      acdoca.PartnerCompany,

      acdoca.PartnerSegment,
      acdoca.Supplier,
      acdoca.Customer,
      acdoca.FinancialValuationObjectType,
      acdoca.FinancialValuationObject,
      acdoca.FinancialValuationSubobject,
      acdoca.REBusinessEntity,
      acdoca.RealEstateBuilding,
      acdoca.RealEstateProperty,
      acdoca.Fund,
      acdoca.BudgetPeriod,
      acdoca.GrantID,
      acdoca.PubSecBudgetAccount,
      acdoca.CashLedgerAccount,
      acdoca.SponsoredProgram,
      acdoca.SponsoredClass,
      acdoca.Plant,
      acdoca.Product,
      acdoca.ShipToParty,
      acdoca.PartnerFund,
      acdoca.PartnerGrant,
      acdoca.CashLedgerCompanyCode,
      acdoca.FundsCenter,
      acdoca.PartnerEquityGroup,
      acdoca.FundedProgram,
      acdoca.PartnerBudgetPeriod,
      acdoca.AccrualObjectType,
      acdoca.AccrualObject,
      acdoca.AccrualSubobject,
      acdoca.AccrualItemType,
      acdoca.AccrualReferenceObject,
      acdoca.AccrualObjectLogicalSystem,
      acdoca.PubSecBudgetAccountCoCode,
      acdoca.ServiceDocument,
      acdoca.ServiceDocumentItem,
      acdoca.ServiceDocumentType,
      acdoca.Material,
      acdoca.GLRecordType,
      acdoca.relatednetworkactivityinternal,

      acdoca.CompanyCode                                          as PrdcssrJournalEntryCompanyCode,
      acdoca.FiscalYear                                           as PrdcssrJournalEntryFiscalYear,
      acdoca.AccountingDocument                                   as PredecessorJournalEntry,
      acdoca.LedgerGLLineItem                                     as PredecessorJournalEntryItem,


      acdoca.BusinessPartner,

      acdoca.CreditRiskClass,
      cast('' as cls_run_group_id)                                as group_id,
      cast('' as fins_val_grouping_rule)                          as grouping_rule,
      cast('0000' as fins_val_grouping_rule_step preserving type) as grouping_rule_step,
      cast('0000' as fins_val_rule_step preserving type)          as valuation_rule_step,

      acdoca.MASTERDATARECNCLNACCT,

      acdoca.MASTERDATAPARTNERCOMPANY,
      acdoca.SpecialGLCode
}

where
  (
          // invoice

          (
            acdoca.InvoiceReference                          is initial
            and acdoca.InvoiceItemReference                  is initial
            and acdoca.InvoiceReferenceFiscalYear            is initial
            // reisdual item

            or  acdoca.FollowOnDocumentType                  = 'V'
          )
    and(
          acdoca.Supplier                                    is initial
      or  acdoca._SupplierCompany.IsBusinessPurposeCompleted = ''
    )
    and(
          acdoca.Customer                                    is initial
      or  acdoca._CustomerCompany.IsBusinessPurposeCompleted = ''
    )
  )