I_PrepaymentDocumentMarketData

DDL: I_PREPAYMENTDOCUMENTMARKETDATA Type: view_entity COMPOSITE

Market Value for the Prepayment Document

I_PrepaymentDocumentMarketData is a Composite CDS View that provides data about "Market Value for the Prepayment Document" in SAP S/4HANA. It reads from 1 data source (I_PrepaymentDocFixedValData) and exposes 10 fields with key fields PrepaymentRefDocCondition, PrepaymentRefDocConditionItem.

Data Sources (1)

SourceAliasJoin Type
I_PrepaymentDocFixedValData PricingVal from

Annotations (7)

NameValueLevelField
AccessControl.authorizationCheck #NOT_REQUIRED view
EndUserText.label Market Value for the Prepayment Document view
Metadata.ignorePropagatedAnnotations true view
VDM.viewType #COMPOSITE view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.sizeCategory #L view
ObjectModel.usageType.dataClass #MIXED view

Fields (10)

KeyFieldSource TableSource FieldDescription
KEY PrepaymentRefDocCondition I_PrepaymentDocFixedValData PrepaymentRefDocCondition
KEY PrepaymentRefDocConditionItem I_PrepaymentDocFixedValData PrepaymentRefDocConditionItem
TradingContract I_PrepaymentDocFixedValData TradingContract
CompanyCode I_PrepaymentDocFixedValData CompanyCode
Counterparty I_PrepaymentDocFixedValData Counterparty
PurchasingDocumentItem
curr232asPrepaymentTotalAmt
PrepaymentRefDocFixedPriceCrcy I_PrepaymentDocFixedValData PrepaymentRefDocFixedPriceCrcy
PrepaymentTotalAmtIsFixedPrice I_PrepaymentDocFixedValData PrepaymentTotalAmtIsFixedPrice
PrepaymentWrkCtrDocPricingOptn I_PrepaymentDocFixedValData PrepaymentWrkCtrDocPricingOptn
@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Market Value for the Prepayment Document'
@Metadata.ignorePropagatedAnnotations: true
@VDM.viewType                             : #COMPOSITE
@ObjectModel.usageType                    :
                          {serviceQuality : #D,
                           sizeCategory   : #L,
                           dataClass      : #MIXED}
------------------------------------------------------------------------------------------------
-- This view will calculate Market Price and Document Item Total Amount in Document Currency
-- Document Item Total Amount = Fixed Price + Market Price
--      where Market Price = Market Quantity * Market Unit Price (Basis/Future)
------------------------------------------------------------------------------------------------

define view entity I_PrepaymentDocumentMarketData
  as select from I_PrepaymentDocFixedValData as PricingVal

{
  key PricingVal.PrepaymentRefDocCondition                                        as PrepaymentRefDocCondition,
  key PricingVal.PrepaymentRefDocConditionItem                                    as PrepaymentRefDocConditionItem,
      PricingVal.TradingContract,
      PricingVal.CompanyCode,
      PricingVal.Counterparty, 
      cast( right( PricingVal.PrepaymentRefDocConditionItem, 5 ) as abap.numc(5)) as PurchasingDocumentItem,

      @Semantics.amount.currencyCode: 'PrepaymentRefDocFixedPriceCrcy'

     cast(cast( sum(
        case when PricingVal.MTMCalculationGroup = 'B'              -- Basis
             then curr_to_decfloat_amount(PricingVal.PrepaymentRefDocFixedPrice) +
                  PricingVal.PrepaymentDocCmmdtyMarketQty *
                  coalesce(round(curr_to_decfloat_amount(PricingVal.PrepaymentRefDocBasisPrice),4) ,
                            curr_to_decfloat_amount(PricingVal.ConditionTermRate))

             when  PricingVal.MTMCalculationGroup = 'F'           -- Future
             then  curr_to_decfloat_amount(PricingVal.PrepaymentRefDocFixedPrice) +
                   PricingVal.PrepaymentDocCmmdtyMarketQty *
                  coalesce( round( curr_to_decfloat_amount(PricingVal.PrepaymentRefDocFuturePrice) ,4),
                            curr_to_decfloat_amount(PricingVal.ConditionTermRate ))

             else 0  end )   as abap.dec(23,2))  as abap.curr(23,2))              as PrepaymentTotalAmt,

      PricingVal.PrepaymentRefDocFixedPriceCrcy                                   as PrepaymentRefDocFixedPriceCrcy,

      PricingVal.PrepaymentTotalAmtIsFixedPrice                                   as PrepaymentTotalAmtIsFixedPrice,
      
      PricingVal.PrepaymentWrkCtrDocPricingOptn                                   as PrepaymentWrkCtrDocPricingOptn
      
}

group by    PricingVal.PrepaymentRefDocCondition,
  PricingVal.TradingContract,
  PricingVal.PrepaymentRefDocConditionItem,
  PricingVal.PrepaymentRefDocFixedPriceCrcy,
  PricingVal.PrepaymentTotalAmtIsFixedPrice,
  PricingVal.CompanyCode,
  PricingVal.Counterparty,
  PricingVal.PrepaymentWrkCtrDocPricingOptn