P_PurchaseContractWithDraft
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)
| Source | Alias | Join Type |
|---|---|---|
| I_PurchaseContract | ActiveDocument | from |
| purchasectr_d | DraftDocument | left_outer |
| purchasectr_d | DraftDocument | union_all |
| I_DraftAdministrativeData | I_DraftAdministrativeData | inner |
Annotations (8)
| Name | Value | Level | Field |
|---|---|---|---|
| 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)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| KEY | PurchaseContractDraftUUID | |||
| KEY | ActivePurchaseContract | I_PurchaseContract | PurchaseContract | |
| PurchaseContract | I_PurchaseContract | PurchaseContract | ||
| PurchaseContractType | I_PurchaseContract | PurchaseContractType | ||
| PurchasingDocumentCategory | I_PurchaseContract | PurchasingDocumentCategory | ||
| CreationDate | I_PurchaseContract | CreationDate | ||
| Supplier | I_PurchaseContract | Supplier | ||
| CompanyCode | I_PurchaseContract | CompanyCode | ||
| PurchasingOrganization | I_PurchaseContract | PurchasingOrganization | ||
| PurchasingGroup | I_PurchaseContract | PurchasingGroup | ||
| DocumentCurrency | I_PurchaseContract | DocumentCurrency | ||
| IncotermsClassification | I_PurchaseContract | IncotermsClassification | ||
| IncotermsTransferLocation | I_PurchaseContract | IncotermsTransferLocation | ||
| PaymentTerms | I_PurchaseContract | PaymentTerms | ||
| CashDiscount1Days | I_PurchaseContract | CashDiscount1Days | ||
| CashDiscount2Days | I_PurchaseContract | CashDiscount2Days | ||
| NetPaymentDays | I_PurchaseContract | NetPaymentDays | ||
| CashDiscount1Percent | I_PurchaseContract | CashDiscount1Percent | ||
| CashDiscount2Percent | I_PurchaseContract | CashDiscount2Percent | ||
| PurchaseContractTargetAmount | I_PurchaseContract | PurchaseContractTargetAmount | ||
| ValidityStartDate | I_PurchaseContract | ValidityStartDate | ||
| ValidityEndDate | I_PurchaseContract | ValidityEndDate | ||
| ReleaseCode | I_PurchaseContract | ReleaseCode | ||
| CreatedByUser | I_PurchaseContract | CreatedByUser | ||
| PurchasingDocumentDeletionCode | I_PurchaseContract | PurchasingDocumentDeletionCode | ||
| SupplierAddressID | I_PurchaseContract | SupplierAddressID | ||
| SupplyingSupplier | I_PurchaseContract | SupplyingSupplier | ||
| InvoicingParty | I_PurchaseContract | InvoicingParty | ||
| ExchangeRate | I_PurchaseContract | ExchangeRate | ||
| ExchangeRateIsFixed | I_PurchaseContract | ExchangeRateIsFixed | ||
| QuotationSubmissionDate | I_PurchaseContract | QuotationSubmissionDate | ||
| SupplierQuotation | I_PurchaseContract | SupplierQuotation | ||
| ReleaseIsNotCompleted | I_PurchaseContract | ReleaseIsNotCompleted | ||
| CorrespncExternalReference | I_PurchaseContract | CorrespncExternalReference | ||
| CorrespncInternalReference | I_PurchaseContract | CorrespncInternalReference | ||
| SupplierRespSalesPersonName | I_PurchaseContract | SupplierRespSalesPersonName | ||
| SupplierPhoneNumber | I_PurchaseContract | SupplierPhoneNumber | ||
| IncotermsVersion | I_PurchaseContract | IncotermsVersion | ||
| IncotermsLocation1 | I_PurchaseContract | IncotermsLocation1 | ||
| IncotermsLocation2 | I_PurchaseContract | IncotermsLocation2 | ||
| PurchasingDocumentName | I_PurchaseContract | PurchasingDocumentName | ||
| DraftAdministrativeDataUUID | purchasectr_d | purchasecontractdraftuuid | ||
| ChangeRecordReferenceUUID | purchasectr_d | ctrtmplrefguid | ||
| IsActiveEntity | ||||
| HasActiveEntity | ||||
| creationdate | purchasectr_d | creationdate | ||
| supplier | purchasectr_d | supplier | ||
| companycode | purchasectr_d | companycode | ||
| paymentterms | purchasectr_d | paymentterms | ||
| releasecode | purchasectr_d | releasecode | ||
| exchangerate | purchasectr_d | exchangerate | ||
| DraftAdministrativeDataUUID | purchasectr_d | purchasecontractdraftuuid | ||
| ChangeRecordReferenceUUID | purchasectr_d | ctrtmplrefguid | ||
| IsActiveEntity | ||||
| HasDraftEntity |
@AbapCatalog.sqlViewName: 'PPURCHASECTRWD'
@VDM.private: true
@VDM.viewType: #COMPOSITE
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ClientDependent: true
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.sizeCategory: #L
@ObjectModel.usageType.dataClass: #MIXED
define view P_PurchaseContractWithDraft
as select from I_PurchaseContract as ActiveDocument
left outer join purchasectr_d as DraftDocument on DraftDocument.activepurchasecontract = ActiveDocument.PurchaseContract
{
key cast ( hextobin('00000000000000000000000000000000') as sysuuid_x preserving type ) as PurchaseContractDraftUUID,
key ActiveDocument.PurchaseContract as ActivePurchaseContract,
ActiveDocument.PurchaseContract,
ActiveDocument.PurchaseContractType,
ActiveDocument.PurchasingDocumentCategory,
ActiveDocument.CreationDate,
ActiveDocument.Supplier,
ActiveDocument.CompanyCode,
ActiveDocument.PurchasingOrganization,
ActiveDocument.PurchasingGroup,
ActiveDocument.DocumentCurrency,
ActiveDocument.IncotermsClassification,
ActiveDocument.IncotermsTransferLocation,
ActiveDocument.PaymentTerms,
ActiveDocument.CashDiscount1Days,
ActiveDocument.CashDiscount2Days,
ActiveDocument.NetPaymentDays,
ActiveDocument.CashDiscount1Percent,
ActiveDocument.CashDiscount2Percent,
ActiveDocument.PurchaseContractTargetAmount,
ActiveDocument.ValidityStartDate,
ActiveDocument.ValidityEndDate,
ActiveDocument.ReleaseCode,
ActiveDocument.CreatedByUser,
ActiveDocument.PurchasingDocumentDeletionCode,
ActiveDocument.SupplierAddressID,
ActiveDocument.SupplyingSupplier,
ActiveDocument.InvoicingParty,
// ActiveDocument.SupplierName,
ActiveDocument.ExchangeRate,
ActiveDocument.ExchangeRateIsFixed,
ActiveDocument.QuotationSubmissionDate,
ActiveDocument.SupplierQuotation,
ActiveDocument.ReleaseIsNotCompleted,
ActiveDocument.CorrespncExternalReference,
ActiveDocument.CorrespncInternalReference,
ActiveDocument.SupplierRespSalesPersonName,
ActiveDocument.SupplierPhoneNumber,
ActiveDocument.IncotermsVersion,
ActiveDocument.IncotermsLocation1,
ActiveDocument.IncotermsLocation2,
ActiveDocument.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(
case
when DraftDocument.purchasecontractdraftuuid is null then ' '
else 'X'
end as sdraft_has_draft preserving type ) as HasDraftEntity,
cast( ' ' as mm_oa_template_flag) as IsPurContrTemplate
}
union all select from purchasectr_d as DraftDocument
inner join I_DraftAdministrativeData as I_DraftAdministrativeData on I_DraftAdministrativeData.DraftUUID = DraftDocument.purchasecontractdraftuuid
{
key DraftDocument.purchasecontractdraftuuid,
key DraftDocument.activepurchasecontract,
DraftDocument.purchasecontract,
DraftDocument.purchasecontracttype,
DraftDocument.purchasingdocumentcategory,
DraftDocument.creationdate,
DraftDocument.supplier,
DraftDocument.companycode,
DraftDocument.purchasingorganization,
DraftDocument.purchasinggroup,
DraftDocument.documentcurrency,
DraftDocument.incotermsclassification,
DraftDocument.incotermstransferlocation,
DraftDocument.paymentterms,
DraftDocument.cashdiscount1days,
DraftDocument.cashdiscount2days,
DraftDocument.netpaymentdays,
DraftDocument.cashdiscount1percent,
DraftDocument.cashdiscount2percent,
DraftDocument.purchasecontracttargetamount,
DraftDocument.validitystartdate,
DraftDocument.validityenddate,
DraftDocument.releasecode,
DraftDocument.createdbyuser,
DraftDocument.purchasingdocumentdeletioncode,
DraftDocument.supplieraddressid,
DraftDocument.supplyingsupplier,
DraftDocument.invoicingparty,
// DraftDocument.suppliername,
DraftDocument.exchangerate,
DraftDocument.exchangerateisfixed,
DraftDocument.quotationsubmissiondate,
DraftDocument.supplierquotation,
DraftDocument.releaseisnotcompleted,
DraftDocument.correspncexternalreference,
DraftDocument.correspncinternalreference,
DraftDocument.supplierrespsalespersonname,
DraftDocument.supplierphonenumber,
DraftDocument.incotermsversion,
DraftDocument.incotermslocation1,
DraftDocument.incotermslocation2,
DraftDocument.purchasingdocumentname,
DraftDocument.purchasecontractdraftuuid as DraftAdministrativeDataUUID,
DraftDocument.ctrtmplrefguid as ChangeRecordReferenceUUID,
cast( ' ' as sdraft_is_active preserving type ) as IsActiveEntity,
DraftDocument.hasactiveentity,
cast( ' ' as sdraft_has_draft preserving type ) as HasDraftEntity,
DraftDocument.ispurcontrtemplate
}
where
((((I_DraftAdministrativeData.CreatedByUser = $session.user
or I_DraftAdministrativeData.InProcessByUser = $session.user) and DraftDocument.ispurcontrtemplate = '' )
or DraftDocument.ispurcontrtemplate = 'X' )
)
//and DraftDocument.ctrtmplrefguid = hextobin('00000000000000000000000000000000'))
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_DRAFTADMINISTRATIVEDATA",
"I_PURCHASECONTRACT",
"PURCHASECTR_D"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/
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