P_PrepaymentRefDocAmtDetailsPO
Prepayment Document Amount Details
P_PrepaymentRefDocAmtDetailsPO is a Composite CDS View that provides data about "Prepayment Document Amount Details" in SAP S/4HANA. It reads from 1 data source (P_PrepaymentRefDocTotalAmtPO) and exposes 31 fields with key fields PrepaymentAgrmtWorkCenterType, PrepaymentAgrmtRefDocumentCat, PrepaymentAgrmtRefBusObject, DocNumber, DocumentItemNumber. It has 3 associations to related views.
Data Sources (1)
| Source | Alias | Join Type |
|---|---|---|
| P_PrepaymentRefDocTotalAmtPO | DocTotAmt | from |
Parameters (2)
| Name | Type | Default |
|---|---|---|
| P_Currency | waers | |
| P_Date | dats |
Associations (3)
| Cardinality | Target | Alias | Condition |
|---|---|---|---|
| [0..1] | I_PrepayRefDocThresholdPercent | Threshold | Threshold.SAPBusinessObjectTypeCode = $projection.PrepaymentAgrmtRefBusObject and Threshold.PrepaymentAgrmtDocRef = $projection.PrepaymentAgrmtRefDocument and Threshold.PrepaymentReferenceDocItem = $projection.DocumentItemNumber -- PO Linked Amount |
| [0..1] | I_PreAgrmtPurchasingDocAmount | PODocAmt | PODocAmt.DocNumber = $projection.PrepaymentAgrmtRefDocument and PODocAmt.DocumentItemNumber = $projection.PurchasingDocumentITem -- Exchange Rates |
| [0..1] | P_PrepaymentRefDocExchangeRate | XRate | XRate.ExchangeRateType = 'M' and XRate.SourceCurrency = DocTotAmt.PrepaymentTotalAmtCrcy and XRate.TargetCurrency = $parameters.P_Currency |
Annotations (8)
| Name | Value | Level | Field |
|---|---|---|---|
| AccessControl.authorizationCheck | #NOT_REQUIRED | view | |
| VDM.private | true | view | |
| VDM.viewType | #COMPOSITE | view | |
| ObjectModel.usageType.sizeCategory | #XL | view | |
| ObjectModel.usageType.serviceQuality | #A | view | |
| ObjectModel.usageType.dataClass | #MIXED | view | |
| Metadata.ignorePropagatedAnnotations | true | view | |
| EndUserText.label | Prepayment Document Amount Details | view |
Fields (31)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| KEY | PrepaymentAgrmtWorkCenterType | P_PrepaymentRefDocTotalAmtPO | PrepaymentAgrmtWorkCenterType | |
| KEY | PrepaymentAgrmtRefDocumentCat | P_PrepaymentRefDocTotalAmtPO | PrepaymentAgrmtRefDocumentCat | |
| KEY | PrepaymentAgrmtRefBusObject | P_PrepaymentRefDocTotalAmtPO | PrepaymentAgrmtRefBusObject | Business Object Type |
| KEY | DocNumber | P_PrepaymentRefDocTotalAmtPO | DocNumber | Document Number |
| KEY | DocumentItemNumber | P_PrepaymentRefDocTotalAmtPO | DocumentItemNumber | Item |
| PrepaymentAgrmtRefDocument | P_PrepaymentRefDocTotalAmtPO | PrepaymentAgrmtRefDocument | Linking Document No. | |
| Material | P_PrepaymentRefDocTotalAmtPO | Material | Vehicle Model | |
| PrepaymentRefDocItmValdFromDte | P_PrepaymentRefDocTotalAmtPO | PrepaymentRefDocItmValdFromDte | Validity Start Date | |
| PrepaymentRefDocItmValdToDte | P_PrepaymentRefDocTotalAmtPO | PrepaymentRefDocItmValdToDte | ValidTo | |
| Commodity | P_PrepaymentRefDocTotalAmtPO | Commodity | Commodity Code | |
| OrderQuantity | P_PrepaymentRefDocTotalAmtPO | OrderQuantity | Quantity | |
| OrderQuantityUnit | P_PrepaymentRefDocTotalAmtPO | OrderQuantityUnit | Sales Unit | |
| PurchasingDocumentITem | P_PrepaymentRefDocTotalAmtPO | PurchasingDocumentITem | Purchasing Doc. Item | |
| CompanyCode | P_PrepaymentRefDocTotalAmtPO | CompanyCode | Receiver Company Code | |
| Counterparty | P_PrepaymentRefDocTotalAmtPO | Counterparty | Supplier | |
| DocumentType | P_PrepaymentRefDocTotalAmtPO | DocumentType | Order Type | |
| PrepaymentTotalAmtCrcy | ||||
| dec232asPrepaymentTotalAmt | ||||
| PrepaymentAgreementAmount | P_PrepaymentRefDocTotalAmtPO | PrepaymentTotalAmt | ||
| PrepaymentAgreementCurrency | P_PrepaymentRefDocTotalAmtPO | PrepaymentTotalAmtCrcy | Document Currency | |
| PrepaymentTotalAmtIsFixedPrice | P_PrepaymentRefDocTotalAmtPO | PrepaymentTotalAmtIsFixedPrice | ||
| curr232asPrepaymentAgrmtLinkAmount | ||||
| PrepaymentDocThresholdPercent | Threshold | PrepaymentDocThresholdPercent | ||
| PrepaymentAgreement | ||||
| PrepaymentDocumentItemNumber | ||||
| char4endasExchangeRateType | ||||
| datsendasExchangeRateDate | ||||
| char4endasAlternativeExchangeRateType | ||||
| PrepaymentRequestDocNumber | ||||
| Threshold | Threshold | Upper Threshold (%) | ||
| PODocAmt | PODocAmt |
Derived SQL interpretation, reconstructed from the parsed view metadata (data sources, associations, and field mappings). SAP annotations are omitted and the structure is reformulated as SQL — this is a functional approximation, not the verbatim SAP source.
-- Derived SQL interpretation of CDS view P_PrepaymentRefDocAmtDetailsPO.
-- Reconstructed from parsed metadata (data sources, associations, fields).
-- SAP annotations are omitted and the structure is reformulated as SQL;
-- this is a functional approximation, not the verbatim SAP source. Some join
-- conditions may be unavailable and a few CDS constructs are kept as-is.
-- Parameters: P_Currency : waers, P_Date : dats
CREATE VIEW P_PrepaymentRefDocAmtDetailsPO AS
SELECT
DocTotAmt.PrepaymentAgrmtWorkCenterType AS PrepaymentAgrmtWorkCenterType,
DocTotAmt.PrepaymentAgrmtRefDocumentCat AS PrepaymentAgrmtRefDocumentCat,
DocTotAmt.PrepaymentAgrmtRefBusObject AS PrepaymentAgrmtRefBusObject,
DocTotAmt.DocNumber AS DocNumber,
DocTotAmt.DocumentItemNumber AS DocumentItemNumber,
DocTotAmt.PrepaymentAgrmtRefDocument AS PrepaymentAgrmtRefDocument,
DocTotAmt.Material AS Material,
DocTotAmt.PrepaymentRefDocItmValdFromDte AS PrepaymentRefDocItmValdFromDte,
DocTotAmt.PrepaymentRefDocItmValdToDte AS PrepaymentRefDocItmValdToDte,
DocTotAmt.Commodity AS Commodity,
DocTotAmt.OrderQuantity AS OrderQuantity,
DocTotAmt.OrderQuantityUnit AS OrderQuantityUnit,
DocTotAmt.PurchasingDocumentITem AS PurchasingDocumentITem,
DocTotAmt.CompanyCode AS CompanyCode,
DocTotAmt.Counterparty AS Counterparty,
DocTotAmt.DocumentType AS DocumentType,
$parameters.P_Currency AS PrepaymentTotalAmtCrcy,
cast( case when DocTotAmt.PrepaymentTotalAmtCrcy <> $parameters.P_Currency then currency_conversion(amount => curr_to_decfloat_amount(DocTotAmt.PrepaymentTotalAmt), source_currency => DocTotAmt.PrepaymentTotalAmtCrcy, target_currency => $parameters.P_Currency, exchange_rate_date => $parameters.P_Date, error_handling => 'SET_TO_NULL') when DocTotAmt.PrepaymentTotalAmtCrcy = $parameters.P_Currency then curr_to_decfloat_amount( DocTotAmt.PrepaymentTotalAmt ) else 0 end as abap.dec(23,2) ) as PrepaymentTotalAmt AS dec232asPrepaymentTotalAmt,
DocTotAmt.PrepaymentTotalAmt AS PrepaymentAgreementAmount,
DocTotAmt.PrepaymentTotalAmtCrcy AS PrepaymentAgreementCurrency,
DocTotAmt.PrepaymentTotalAmtIsFixedPrice AS PrepaymentTotalAmtIsFixedPrice,
cast(cast( case when prepaymentagrmtworkcentertype = '1' and prepaymentagrmtrefdocumentcat = 'PO' then coalesce(curr_to_decfloat_amount(PODocAmt(P_Currency : $parameters.P_Currency, P_Date : $parameters.P_Date).PrepaymentAgrmtLinkAmount),0) else 0 end as abap.dec(23,2) )as abap.curr(23,2) ) as PrepaymentAgrmtLinkAmount AS curr232asPrepaymentAgrmtLinkAmount,
Threshold.PrepaymentDocThresholdPercent AS PrepaymentDocThresholdPercent,
'' AS PrepaymentAgreement,
'' AS PrepaymentDocumentItemNumber,
case when DocTotAmt.PrepaymentTotalAmtCrcy <> $parameters.P_Currency then cast('M' as abap.char(4)) else cast(' ' as abap.char(4)) end as ExchangeRateType AS char4endasExchangeRateType,
case when DocTotAmt.PrepaymentTotalAmtCrcy <> $parameters.P_Currency then cast($parameters.P_Date as abap.dats) else cast('00000000' as abap.dats) end as ExchangeRateDate AS datsendasExchangeRateDate,
case when DocTotAmt.PrepaymentTotalAmtCrcy <> $parameters.P_Currency then XRate(P_Date : $parameters.P_Date).ExchangeRate.AlternativeExchangeRateType else cast(' ' as abap.char(4)) end as AlternativeExchangeRateType AS char4endasAlternativeExchangeRateType,
coalesce(PaymentTerms.PrepaymentRequestDocNumber, '') AS PrepaymentRequestDocNumber,
Threshold,
PODocAmt
FROM P_PrepaymentRefDocTotalAmtPO AS DocTotAmt
LEFT OUTER JOIN I_PrepayRefDocThresholdPercent AS Threshold ON Threshold.SAPBusinessObjectTypeCode = PrepaymentAgrmtRefBusObject AND Threshold.PrepaymentAgrmtDocRef = PrepaymentAgrmtRefDocument AND Threshold.PrepaymentReferenceDocItem = DocumentItemNumber -- association [0..1]
LEFT OUTER JOIN I_PreAgrmtPurchasingDocAmount AS PODocAmt ON PODocAmt.DocNumber = PrepaymentAgrmtRefDocument AND PODocAmt.DocumentItemNumber = PurchasingDocumentITem -- association [0..1]
LEFT OUTER JOIN P_PrepaymentRefDocExchangeRate AS XRate ON XRate.ExchangeRateType = 'M' AND XRate.SourceCurrency = DocTotAmt.PrepaymentTotalAmtCrcy AND XRate.TargetCurrency = $parameters.P_Currency -- association [0..1]
;
Learn More
- VDM (Virtual Data Model) in SAP S/4HANA Explained
- Types of CDS Views: Basic, Composite, Consumption, and Transactional
- CDS View Annotations — A Complete Guide
- What Is a CDS View in SAP S/4HANA?
- SAP Tables vs CDS Views — Key Differences
- Understanding Data Lineage in SAP S/4HANA
- 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
- BSEG to ACDOCA: The Universal Journal Migration
- Business Partner Migration: KNA1/LFA1 to BUT000
- Material Document Migration: MSEG/MKPF to MATDOC
- How to Find the Right CDS View for an SAP Table
- BW Extractor to CDS View Migration Guide
- S/4HANA CDS View Deprecation: What You Need to Know
- ABAP CDS View Tutorial — From Basics to Real-World Examples
- RAP and CDS Views — Building Transactional Apps in SAP S/4HANA
- Sales Document Status Migration: VBUP/VBUK Removal in S/4HANA
- CO Tables in S/4HANA: COEP, COBK, COSS, COSP to ACDOCA