P_PrepaymentRefDocAmtDetailsPO

DDL: P_PREPAYMENTREFDOCAMTDETAILSPO Type: view_entity COMPOSITE

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)

SourceAliasJoin Type
P_PrepaymentRefDocTotalAmtPO DocTotAmt from

Parameters (2)

NameTypeDefault
P_Currency waers
P_Date dats

Associations (3)

CardinalityTargetAliasCondition
[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)

NameValueLevelField
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)

KeyFieldSource TableSource FieldDescription
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]
;