P_PurchaseContractWithDraft

DDL: P_PURCHASECONTRACTWITHDRAFT SQL: PPURCHASECTRWD Type: view COMPOSITE

P_PurchaseContractWithDraft is a Composite CDS View in SAP S/4HANA. It reads from 4 data sources (I_PurchaseContract, purchasectr_d, purchasectr_d, I_DraftAdministrativeData) and exposes 55 fields with key fields PurchaseContractDraftUUID, ActivePurchaseContract.

Data Sources (4)

SourceAliasJoin Type
I_PurchaseContract ActiveDocument from
purchasectr_d DraftDocument left_outer
purchasectr_d DraftDocument union_all
I_DraftAdministrativeData I_DraftAdministrativeData inner

Annotations (8)

NameValueLevelField
AbapCatalog.sqlViewName PPURCHASECTRWD view
VDM.private true view
VDM.viewType #COMPOSITE view
AccessControl.authorizationCheck #NOT_REQUIRED view
ClientDependent true view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.sizeCategory #L view
ObjectModel.usageType.dataClass #MIXED view

Fields (55)

KeyFieldSource TableSource FieldDescription
KEY PurchaseContractDraftUUID
KEY ActivePurchaseContract I_PurchaseContract PurchaseContract Purchasing Doc.
PurchaseContract I_PurchaseContract PurchaseContract Purchasing Doc.
PurchaseContractType I_PurchaseContract PurchaseContractType Order Type
PurchasingDocumentCategory I_PurchaseContract PurchasingDocumentCategory Doc. Category
CreationDate I_PurchaseContract CreationDate Time Stamp
Supplier I_PurchaseContract Supplier Supplier
CompanyCode I_PurchaseContract CompanyCode Receiver Company Code
PurchasingOrganization I_PurchaseContract PurchasingOrganization Purchasing Organization
PurchasingGroup I_PurchaseContract PurchasingGroup Purchasing Group
DocumentCurrency I_PurchaseContract DocumentCurrency Document Currency
IncotermsClassification I_PurchaseContract IncotermsClassification Incoterms
IncotermsTransferLocation I_PurchaseContract IncotermsTransferLocation Incoterms 2
PaymentTerms I_PurchaseContract PaymentTerms Pyt Terms
CashDiscount1Days I_PurchaseContract CashDiscount1Days Days from Baseline Date for Payment
CashDiscount2Days I_PurchaseContract CashDiscount2Days Days from Baseline Date for Payment
NetPaymentDays I_PurchaseContract NetPaymentDays Net Pmt Terms Period
CashDiscount1Percent I_PurchaseContract CashDiscount1Percent Disc. Percent 1
CashDiscount2Percent I_PurchaseContract CashDiscount2Percent Disc. Percent 2
PurchaseContractTargetAmount I_PurchaseContract PurchaseContractTargetAmount Target Value
ValidityStartDate I_PurchaseContract ValidityStartDate Validity Start Date
ValidityEndDate I_PurchaseContract ValidityEndDate ValidTo
ReleaseCode I_PurchaseContract ReleaseCode Release ind.
CreatedByUser I_PurchaseContract CreatedByUser User Name
PurchasingDocumentDeletionCode I_PurchaseContract PurchasingDocumentDeletionCode Del. Indicator
SupplierAddressID I_PurchaseContract SupplierAddressID Address Number
SupplyingSupplier I_PurchaseContract SupplyingSupplier Goods Supplier
InvoicingParty I_PurchaseContract InvoicingParty Supplier
ExchangeRate I_PurchaseContract ExchangeRate Exchange rate
ExchangeRateIsFixed I_PurchaseContract ExchangeRateIsFixed Fixed Exch.Rate
QuotationSubmissionDate I_PurchaseContract QuotationSubmissionDate Quotation Date
SupplierQuotation I_PurchaseContract SupplierQuotation RFQ
ReleaseIsNotCompleted I_PurchaseContract ReleaseIsNotCompleted Subj.to Release
CorrespncExternalReference I_PurchaseContract CorrespncExternalReference Your Reference
CorrespncInternalReference I_PurchaseContract CorrespncInternalReference Our Reference
SupplierRespSalesPersonName I_PurchaseContract SupplierRespSalesPersonName Salesperson
SupplierPhoneNumber I_PurchaseContract SupplierPhoneNumber Telephone
IncotermsVersion I_PurchaseContract IncotermsVersion Inco. Version
IncotermsLocation1 I_PurchaseContract IncotermsLocation1 Inco. Location1
IncotermsLocation2 I_PurchaseContract IncotermsLocation2 Inco. Location2
PurchasingDocumentName I_PurchaseContract PurchasingDocumentName Purch. Doc. Name
DraftAdministrativeDataUUID purchasectr_d purchasecontractdraftuuid Key
ChangeRecordReferenceUUID purchasectr_d ctrtmplrefguid Key
IsActiveEntity
HasActiveEntity
creationdate purchasectr_d creationdate Time Stamp
supplier purchasectr_d supplier Supplier
companycode purchasectr_d companycode Receiver Company Code
paymentterms purchasectr_d paymentterms Pyt Terms
releasecode purchasectr_d releasecode Release ind.
exchangerate purchasectr_d exchangerate Exchange rate
DraftAdministrativeDataUUID purchasectr_d purchasecontractdraftuuid Key
ChangeRecordReferenceUUID purchasectr_d ctrtmplrefguid Key
IsActiveEntity
HasDraftEntity

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_PurchaseContractWithDraft.
-- 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.
-- SQL view name: PPURCHASECTRWD

CREATE VIEW P_PurchaseContractWithDraft AS
SELECT
  cast ( hextobin('00000000000000000000000000000000') as sysuuid_x preserving type ) AS PurchaseContractDraftUUID,
  ActiveDocument.PurchaseContract AS ActivePurchaseContract,
  ActiveDocument.PurchaseContract AS PurchaseContract,
  ActiveDocument.PurchaseContractType AS PurchaseContractType,
  ActiveDocument.PurchasingDocumentCategory AS PurchasingDocumentCategory,
  ActiveDocument.CreationDate AS CreationDate,
  ActiveDocument.Supplier AS Supplier,
  ActiveDocument.CompanyCode AS CompanyCode,
  ActiveDocument.PurchasingOrganization AS PurchasingOrganization,
  ActiveDocument.PurchasingGroup AS PurchasingGroup,
  ActiveDocument.DocumentCurrency AS DocumentCurrency,
  ActiveDocument.IncotermsClassification AS IncotermsClassification,
  ActiveDocument.IncotermsTransferLocation AS IncotermsTransferLocation,
  ActiveDocument.PaymentTerms AS PaymentTerms,
  ActiveDocument.CashDiscount1Days AS CashDiscount1Days,
  ActiveDocument.CashDiscount2Days AS CashDiscount2Days,
  ActiveDocument.NetPaymentDays AS NetPaymentDays,
  ActiveDocument.CashDiscount1Percent AS CashDiscount1Percent,
  ActiveDocument.CashDiscount2Percent AS CashDiscount2Percent,
  ActiveDocument.PurchaseContractTargetAmount AS PurchaseContractTargetAmount,
  ActiveDocument.ValidityStartDate AS ValidityStartDate,
  ActiveDocument.ValidityEndDate AS ValidityEndDate,
  ActiveDocument.ReleaseCode AS ReleaseCode,
  ActiveDocument.CreatedByUser AS CreatedByUser,
  ActiveDocument.PurchasingDocumentDeletionCode AS PurchasingDocumentDeletionCode,
  ActiveDocument.SupplierAddressID AS SupplierAddressID,
  ActiveDocument.SupplyingSupplier AS SupplyingSupplier,
  ActiveDocument.InvoicingParty AS InvoicingParty,
  ActiveDocument.ExchangeRate AS ExchangeRate,
  ActiveDocument.ExchangeRateIsFixed AS ExchangeRateIsFixed,
  ActiveDocument.QuotationSubmissionDate AS QuotationSubmissionDate,
  ActiveDocument.SupplierQuotation AS SupplierQuotation,
  ActiveDocument.ReleaseIsNotCompleted AS ReleaseIsNotCompleted,
  ActiveDocument.CorrespncExternalReference AS CorrespncExternalReference,
  ActiveDocument.CorrespncInternalReference AS CorrespncInternalReference,
  ActiveDocument.SupplierRespSalesPersonName AS SupplierRespSalesPersonName,
  ActiveDocument.SupplierPhoneNumber AS SupplierPhoneNumber,
  ActiveDocument.IncotermsVersion AS IncotermsVersion,
  ActiveDocument.IncotermsLocation1 AS IncotermsLocation1,
  ActiveDocument.IncotermsLocation2 AS IncotermsLocation2,
  ActiveDocument.PurchasingDocumentName AS PurchasingDocumentName,
  DraftDocument.purchasecontractdraftuuid AS DraftAdministrativeDataUUID,
  DraftDocument.ctrtmplrefguid AS ChangeRecordReferenceUUID,
  cast( 'X' as sdraft_is_active preserving type ) AS IsActiveEntity,
  cast( ' ' as sdraft_has_active preserving type ) AS HasActiveEntity,
  cast( ' ' as sdraft_has_draft preserving type ) AS HasDraftEntity
FROM I_PurchaseContract AS ActiveDocument
LEFT OUTER JOIN purchasectr_d AS DraftDocument ON /* join condition not captured in parsed metadata */
INNER JOIN I_DraftAdministrativeData ON /* join condition not captured in parsed metadata */
-- UNION ALL with additional select branch(es): purchasectr_d
;