P_PURCHASECONTRACTTARGETAMOUNT

CDS View

Purchase Contract Target Amount

P_PURCHASECONTRACTTARGETAMOUNT is a CDS View in S/4HANA. Purchase Contract Target Amount. 1 CDS views read from this table.

CDS Views using this table (1)

ViewTypeJoinVDMDescription
P_PurContractPriceVariance2 view left_outer CONSUMPTION Purchase Contract Price Variance 2
@AbapCatalog.sqlViewName: 'PMMPCTARAMT'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@VDM.viewType : #CONSUMPTION
@VDM.private: true
@AccessControl.personalData.blocking: #NOT_REQUIRED
@AbapCatalog.viewEnhancementCategory: [#PROJECTION_LIST,#GROUP_BY] // Added for extensibility


define view P_PurchaseContractTargetAmount
  with parameters
    P_DisplayCurrency : displaycurrency,
    P_Material        : matnr,
    P_StartDate       : vdm_validitystart,
    P_EndDate         : vdm_validityend

  as select from I_PurchaseContractItem      as PurchaseContractItem

    inner join   I_PurchaseContract          as PurchaseContract       on PurchaseContractItem.PurchaseContract = PurchaseContract.ActivePurchasingDocument

    inner join   I_PurContractClassification as ContractClassification on PurchaseContract.PurchaseContractType = ContractClassification.PurchasingDocumentType

{
  key PurchaseContract.ActivePurchasingDocument as PurchaseContract,

      //included for DCL

      PurchaseContract.PurchasingGroup,
      PurchaseContract.PurchasingOrganization,
      Plant,

      case when ContractClassification.PurchaseContractClassification  = '0'           // WK : Amount type and MK : Quantity type

                then
                    currency_conversion
                    (
                       amount             => PurchaseContract.PurchaseContractTargetAmount,
                       source_currency    => PurchaseContract.DocumentCurrency,
                       target_currency    =>  :P_DisplayCurrency,
                       exchange_rate_date => PurchaseContract.CreationDate,
                       exchange_rate_type => 'M',
                       error_handling => 'FAIL_ON_ERROR'
                    )
               when ContractClassification.PurchaseContractClassification = '1'
                then   sum(case when ContractClassification.PurchaseContractClassification = '1' then
                              currency_conversion
                              (
                                 amount             => TargetAmount,
                                 source_currency    => PurchaseContract.DocumentCurrency,
                                 target_currency    =>  :P_DisplayCurrency,
                                 exchange_rate_date => PurchaseContract.CreationDate,
                                 exchange_rate_type => 'M',
                                 error_handling => 'FAIL_ON_ERROR'
                              ) else 0 end
                          )
               else 0
          end                                   as PurchaseContractTargetAmount

}
where
      PurchaseContract.PurchasingDocumentDeletionCode     = ''
  and PurchaseContractItem.PurchasingContractDeletionCode = ''
  and PurchaseContract.IsEndOfPurposeBlocked              = ''
  and Material                                            = $parameters.P_Material
  and CreationDate                                        between $parameters.P_StartDate and $parameters.P_EndDate


group by
  PurchaseContract.ActivePurchasingDocument,
  PurchaseContract.PurchasingGroup,
  PurchaseContract.PurchasingOrganization,
  Plant,
  ContractClassification.PurchaseContractClassification,
  PurchaseContract.PurchaseContractTargetAmount,
  PurchaseContract.DocumentCurrency,
  PurchaseContract.CreationDate