P_PrepaymentRefDocTotalAmtTC
Prepayment Document Total Amount
P_PrepaymentRefDocTotalAmtTC is a Composite CDS View that provides data about "Prepayment Document Total Amount" in SAP S/4HANA. It reads from 5 data sources (I_PreAgrmtTradingContractStat, I_PrepayWrkCtrAllowedDocTypes, I_PreAgrmtTradingContract, I_PreAgrmtTradingContractItem, I_PrepaymentMaterial) and exposes 20 fields with key fields PrepaymentAgrmtWorkCenterType, PrepaymentAgrmtRefDocumentCat, PrepaymentAgrmtRefBusObject, DocNumber, DocumentItemNumber. It has 2 associations to related views.
Data Sources (5)
| Source | Alias | Join Type |
|---|---|---|
| I_PreAgrmtTradingContractStat | ContractApplicationStatus | inner |
| I_PrepayWrkCtrAllowedDocTypes | DocTypes | from |
| I_PreAgrmtTradingContract | Document | inner |
| I_PreAgrmtTradingContractItem | DocumentItem | inner |
| I_PrepaymentMaterial | Material | inner |
Associations (2)
| Cardinality | Target | Alias | Condition |
|---|---|---|---|
| [0..1] | P_PrepayDocVersLogPrcgValTC | CMMPrice | CMMPrice.PrepaymentWrkCtrDocPricingOptn = WCPrcConfig.PrepaymentWrkCtrDocPricingOptn and Material.Commodity is not initial and CMMPrice.PrepaymentAgrmtRefBusObject = 'BUS2124' and CMMPrice.PrepaymentDocumentNumber = Document.TradingContract and CMMPrice.PrepaymentDocumentItemNumber = DocumentItem.TradingContractItem and CMMPrice.CompanyCode = Document.CompanyCode and CMMPrice.Counterparty = Document.SupplierName -- CPE Price |
| [0..1] | I_PrepaymentDocumentMarketData | CPEPrice | CPEPrice.PrepaymentWrkCtrDocPricingOptn = WCPrcConfig.PrepaymentWrkCtrDocPricingOptn and CPEPrice.TradingContract = Document.TradingContract and Material.Commodity is not initial and CPEPrice.PrepaymentRefDocCondition = Document.PrepaymentRefDocCondition and CPEPrice.PrepaymentRefDocConditionItem = DocumentItem.TradingContractItem and CPEPrice.CompanyCode = Document.CompanyCode and CPEPrice.Counterparty = Document.SupplierName |
Annotations (8)
| Name | Value | Level | Field |
|---|---|---|---|
| AccessControl.authorizationCheck | #NOT_REQUIRED | view | |
| VDM.private | true | view | |
| VDM.viewType | #COMPOSITE | view | |
| ObjectModel.usageType.sizeCategory | #L | view | |
| ObjectModel.usageType.serviceQuality | #A | view | |
| ObjectModel.usageType.dataClass | #TRANSACTIONAL | view | |
| Metadata.ignorePropagatedAnnotations | true | view | |
| EndUserText.label | Prepayment Document Total Amount | view |
Fields (20)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| KEY | PrepaymentAgrmtWorkCenterType | I_PrepayWrkCtrAllowedDocTypes | PrepaymentAgrmtWorkCenterType | |
| KEY | PrepaymentAgrmtRefDocumentCat | I_PrepayWrkCtrAllowedDocTypes | PrepaymentAgrmtRefDocumentCat | |
| KEY | PrepaymentAgrmtRefBusObject | |||
| KEY | DocNumber | I_PreAgrmtTradingContract | TradingContract | |
| KEY | DocumentItemNumber | I_PreAgrmtTradingContractItem | TradingContractItem | |
| PurchasingDocumentItem | ||||
| PrepaymentAgrmtRefDocument | ||||
| CompanyCode | I_PreAgrmtTradingContract | CompanyCode | ||
| DocumentType | I_PreAgrmtTradingContract | TradingContractType | ||
| Counterparty | I_PreAgrmtTradingContract | SupplierName | ||
| TrdgContrApplicationStatus | I_PreAgrmtTradingContract | TrdgContrApplicationStatus | ||
| PrepaymentRefDocItmValdFromDte | I_PreAgrmtTradingContractItem | PrepaymentRefDocItmValdFromDte | ||
| PrepaymentRefDocItmValdToDte | I_PreAgrmtTradingContractItem | PrepaymentRefDocItmValdToDte | ||
| Material | I_PreAgrmtTradingContractItem | Material | ||
| Commodity | I_PrepaymentMaterial | Commodity | ||
| TradingContractItemQuantity | I_PreAgrmtTradingContractItem | TradingContractItemQuantity | ||
| TrdgContractItemUnitOfMeasure | I_PreAgrmtTradingContractItem | TrdgContractItemUnitOfMeasure | ||
| curr232asPrepaymentTotalAmt | ||||
| PrepaymentTotalAmtCrcy | I_PreAgrmtTradingContractItem | TrdgContrTotalNetAmountCrcy | ||
| IncludeCropSeason | WCPrcConfig | IncludeCropSeason |
@AbapCatalog.viewEnhancementCategory: [#PROJECTION_LIST]
@AccessControl.authorizationCheck : #NOT_REQUIRED
@VDM.private : true
@VDM.viewType : #COMPOSITE
@ObjectModel.usageType.sizeCategory : #L
@ObjectModel.usageType.serviceQuality : #A
@ObjectModel.usageType.dataClass : #TRANSACTIONAL
@Metadata.ignorePropagatedAnnotations : true
@EndUserText.label: 'Prepayment Document Total Amount'
-- This view will get the Total price for Applicable documents in Work Center
-- Based on Pricing Option configuration, one of below 3 options will be used for
-- Total Amount derivations:
-- VLOGP: Using CMM_VLOGP data
-- CPE: Using CPE tables data
-- Net Price: Net Price from the document
-- This view retrieves data for Trading Contracts
define view entity P_PrepaymentRefDocTotalAmtTC
-- Valid Doc Types
as select from I_PrepayWrkCtrAllowedDocTypes as DocTypes
-- Document Header
inner join I_PreAgrmtTradingContract as Document on Document.TradingContractType = DocTypes.PrepaymentAgrmtRefDocumentType
and Document.CustomerName is initial
-- Document Item
inner join I_PreAgrmtTradingContractItem as DocumentItem on DocumentItem.TradingContract = Document.TradingContract
-- Material and Commodity
inner join I_PrepaymentMaterial as Material on Material.Material = DocumentItem.Material
-- Trading Contract Status
inner join I_PreAgrmtTradingContractStat as ContractApplicationStatus on ContractApplicationStatus.ContractApplicationStatus = Document.TrdgContrApplicationStatus
-- Pricing Options config
left outer to one join I_PrepaymentWrkCtrLinkConfign as WCPrcConfig on WCPrcConfig.PrepaymentAgrmtWorkCenterType = DocTypes.PrepaymentAgrmtWorkCenterType
-- CMM Price
association [0..1] to P_PrepayDocVersLogPrcgValTC as CMMPrice on CMMPrice.PrepaymentWrkCtrDocPricingOptn = WCPrcConfig.PrepaymentWrkCtrDocPricingOptn
and Material.Commodity is not initial
and CMMPrice.PrepaymentAgrmtRefBusObject = 'BUS2124'
and CMMPrice.PrepaymentDocumentNumber = Document.TradingContract
and CMMPrice.PrepaymentDocumentItemNumber = DocumentItem.TradingContractItem
and CMMPrice.CompanyCode = Document.CompanyCode
and CMMPrice.Counterparty = Document.SupplierName
-- CPE Price
association [0..1] to I_PrepaymentDocumentMarketData as CPEPrice on CPEPrice.PrepaymentWrkCtrDocPricingOptn = WCPrcConfig.PrepaymentWrkCtrDocPricingOptn
and CPEPrice.TradingContract = Document.TradingContract
and Material.Commodity is not initial
and CPEPrice.PrepaymentRefDocCondition = Document.PrepaymentRefDocCondition
and CPEPrice.PrepaymentRefDocConditionItem = DocumentItem.TradingContractItem
and CPEPrice.CompanyCode = Document.CompanyCode
and CPEPrice.Counterparty = Document.SupplierName
{
key DocTypes.PrepaymentAgrmtWorkCenterType as PrepaymentAgrmtWorkCenterType,
key DocTypes.PrepaymentAgrmtRefDocumentCat as PrepaymentAgrmtRefDocumentCat,
key 'BUS2124' as PrepaymentAgrmtRefBusObject,
key Document.TradingContract as DocNumber,
key DocumentItem.TradingContractItem as DocumentItemNumber,
cast('00000' as abap.numc(5)) as PurchasingDocumentItem,
lpad( Document.TradingContract, 25, '0' ) as PrepaymentAgrmtRefDocument,
Document.CompanyCode as CompanyCode,
Document.TradingContractType as DocumentType,
Document.SupplierName as Counterparty,
Document.TrdgContrApplicationStatus as TrdgContrApplicationStatus,
DocumentItem.PrepaymentRefDocItmValdFromDte as PrepaymentRefDocItmValdFromDte,
DocumentItem.PrepaymentRefDocItmValdToDte as PrepaymentRefDocItmValdToDte,
DocumentItem.Material as Material,
Material.Commodity,
@Semantics.quantity.unitOfMeasure: 'TrdgContractItemUnitOfMeasure'
DocumentItem.TradingContractItemQuantity,
DocumentItem.TrdgContractItemUnitOfMeasure,
@Semantics.amount.currencyCode: 'PrepaymentTotalAmtCrcy'
cast(cast(
case when WCPrcConfig.PrepaymentWrkCtrDocPricingOptn = '01' -- CMM Pricing
and Material.Commodity is not initial
then curr_to_decfloat_amount( CMMPrice.PrepaymentTotalAmt)
when WCPrcConfig.PrepaymentWrkCtrDocPricingOptn = '02' -- CPE Pricing
and Material.Commodity is not initial
then curr_to_decfloat_amount(CPEPrice.PrepaymentTotalAmt)
when WCPrcConfig.PrepaymentWrkCtrDocPricingOptn = '03' -- Item Net Amount
or WCPrcConfig.PrepaymentWrkCtrDocPricingOptn is null
or Material.Commodity is initial
then curr_to_decfloat_amount(DocumentItem.TrdgContrTotalNetAmount)
else 0 end as abap.dec(23,2) ) as abap.curr(23,2) ) as PrepaymentTotalAmt,
DocumentItem.TrdgContrTotalNetAmountCrcy as PrepaymentTotalAmtCrcy,
case when WCPrcConfig.PrepaymentWrkCtrDocPricingOptn = '01' -- CMM Pricing
and CMMPrice.PrepaymentDocCmmdtyMarketQty is initial
and Material.Commodity is not initial
then 'X'
when WCPrcConfig.PrepaymentWrkCtrDocPricingOptn = '02' -- CPE Pricing
and Material.Commodity is not initial
then CPEPrice.PrepaymentTotalAmtIsFixedPrice
when WCPrcConfig.PrepaymentWrkCtrDocPricingOptn = '03' -- Item Net Amount
or WCPrcConfig.PrepaymentWrkCtrDocPricingOptn is null
or Material.Commodity is initial
then 'X'
else '' end as PrepaymentTotalAmtIsFixedPrice,
WCPrcConfig.IncludeCropSeason
} where DocTypes.PrepaymentAgrmtRefDocumentCat = 'TC' and
DocTypes.PrepaymentAgrmtWorkCenterType = '1'
Learn More
- What Is a CDS View in SAP S/4HANA?
- Types of CDS Views: Basic, Composite, Consumption, and Transactional
- SAP Tables vs CDS Views — Key Differences
- Understanding Data Lineage in SAP S/4HANA
- VDM (Virtual Data Model) in SAP S/4HANA Explained
- CDS View Annotations — A Complete Guide
- CDS View Field Mapping and Associations
- Understanding the SAP S/4HANA Data Model
- CDS View Extensions and Custom Fields in SAP S/4HANA
- Released APIs and Stability Contracts in SAP S/4HANA