I_PrepaymentDocumentMarketVal

DDL: I_PREPAYMENTDOCUMENTMARKETVAL SQL: IPPMTDOCMKTVAL Type: view COMPOSITE

Market Value for the Prepayment Document

I_PrepaymentDocumentMarketVal 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_PrepaymentDocumentFixedVal) and exposes 6 fields with key fields PrepaymentAgrmtRefBusObject, PrepaymentRefDocCondition, PrepaymentRefDocConditionItem.

Data Sources (1)

SourceAliasJoin Type
I_PrepaymentDocumentFixedVal PricingVal from

Annotations (11)

NameValueLevelField
AbapCatalog.sqlViewName IPPMTDOCMKTVAL view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.dataClass #MIXED view
VDM.viewType #COMPOSITE view
ClientHandling.algorithm #SESSION_VARIABLE view
Metadata.ignorePropagatedAnnotations true view
AccessControl.authorizationCheck #NOT_REQUIRED view
EndUserText.label Market Value for the Prepayment Document view

Fields (6)

KeyFieldSource TableSource FieldDescription
KEY PrepaymentAgrmtRefBusObject I_PrepaymentDocumentFixedVal PrepaymentAgrmtRefBusObject
KEY PrepaymentRefDocCondition I_PrepaymentDocumentFixedVal PrepaymentRefDocCondition
KEY PrepaymentRefDocConditionItem I_PrepaymentDocumentFixedVal PrepaymentRefDocConditionItem
PurchasingDocumentItem
PrepaymentRefDocFixedPriceCrcy I_PrepaymentDocumentFixedVal PrepaymentRefDocFixedPriceCrcy
PrepaymentTotalAmtIsFixedPrice I_PrepaymentDocumentFixedVal PrepaymentTotalAmtIsFixedPrice
@AbapCatalog.sqlViewName                  : 'IPPMTDOCMKTVAL'
@AbapCatalog.compiler.compareFilter       : true
@AbapCatalog.preserveKey                  : true
@ObjectModel.usageType                    : 
                          {serviceQuality : #D, 
                           sizeCategory   : #XL, 
                           dataClass      : #MIXED}
@VDM.viewType                             : #COMPOSITE
@ClientHandling.algorithm                 : #SESSION_VARIABLE
@Metadata.ignorePropagatedAnnotations     : true
@AccessControl.authorizationCheck         : #NOT_REQUIRED
@EndUserText.label                        : 'Market Value for the Prepayment Document'

------------------------------------------------------------------------------------------------
-- 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 I_PrepaymentDocumentMarketVal 
  as select from I_PrepaymentDocumentFixedVal as PricingVal
  
{
  
  key PricingVal.PrepaymentAgrmtRefBusObject                                      as PrepaymentAgrmtRefBusObject,
  key PricingVal.PrepaymentRefDocCondition                                        as PrepaymentRefDocCondition,
  key PricingVal.PrepaymentRefDocConditionItem                                    as PrepaymentRefDocConditionItem,
      cast( RIGHT( PricingVal.PrepaymentRefDocConditionItem, 5 ) as abap.numc(5)) as PurchasingDocumentItem,
      
      @Semantics.amount.currencyCode: 'PrepaymentRefDocFixedPriceCrcy'
      sum(            
        case when PricingVal.PrepaymentTotalAmtIsFixedPrice = ' '       -- Price Fixation is partial
                  and PricingVal.MTMCalculationGroup = 'B'              -- Basis
             then PricingVal.PrepaymentRefDocFixedPrice + 
                  (PricingVal.PrepaymentDocCmmdtyMarketQty * 
                  COALESCE( cast(ROUND(PricingVal.PrepaymentRefDocBasisPrice,4) as abap.curr(13,4)), 
                            PricingVal.ConditionTermRate))
             
             when PricingVal.PrepaymentTotalAmtIsFixedPrice = ' '       -- Price Fixation is partial 
                    and PricingVal.MTMCalculationGroup = 'F'           -- Future
             then PricingVal.PrepaymentRefDocFixedPrice + 
                  (PricingVal.PrepaymentDocCmmdtyMarketQty * 
                  COALESCE( cast(ROUND(PricingVal.PrepaymentRefDocFuturePrice,4) as abap.curr(13,4)),
                            PricingVal.ConditionTermRate ) )
             
             when PricingVal.PrepaymentTotalAmtIsFixedPrice = 'X'       -- Price Fixation is complete
             then PricingVal.PrepaymentRefDocFixedPrice    
                          
             else 0 end )                                                       as PrepaymentTotalAmt,
      
      @Semantics.currencyCode: true
      PricingVal.PrepaymentRefDocFixedPriceCrcy                                   as PrepaymentRefDocFixedPriceCrcy,
           
      PricingVal.PrepaymentTotalAmtIsFixedPrice                                   as PrepaymentTotalAmtIsFixedPrice
}
 
where PricingVal.MTMConditionGroupCategory = '1'
         
group by PricingVal.PrepaymentAgrmtRefBusObject,
         PricingVal.PrepaymentRefDocCondition,
         PricingVal.PrepaymentRefDocConditionItem,
         PricingVal.PrepaymentRefDocFixedPriceCrcy,
         PricingVal.PrepaymentTotalAmtIsFixedPrice
    
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_PREPAYMENTDOCUMENTFIXEDVAL"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/