I_PurContrVersionHistory
Purchase Contract Version History
I_PurContrVersionHistory is a Basic CDS View that provides data about "Purchase Contract Version History" in SAP S/4HANA. It reads from 2 data sources (R_PurchaseContract, erev) and exposes 71 fields with key field PurchaseContract. It has 9 associations to related views.
Data Sources (2)
| Source | Alias | Join Type |
|---|---|---|
| R_PurchaseContract | Document | inner |
| erev | VersionHistory | from |
Associations (9)
| Cardinality | Target | Alias | Condition |
|---|---|---|---|
| [1..1] | I_User | _UserDetails | $projection.CreatedByUser = _UserDetails.UserID |
| [1..1] | I_PurContrVersionType | _VersionType | $projection.PurgDocChangeRequestStatus = _VersionType.PurgDocChangeRequestStatus |
| [0..1] | I_PaymentTermsText | _PaymentTermsText | $projection.PaymentTerms = _PaymentTermsText.PaymentTerms and _PaymentTermsText.Language = $session.system_language |
| [0..1] | I_PurchasingGroup | _PurchasingGroup | _PurchasingGroup.PurchasingGroup = $projection.PurchasingGroup |
| [1..1] | I_CurrencyText | _DocumentCurrencyText | _DocumentCurrencyText.Language = $session.system_language and _DocumentCurrencyText.Currency = $projection.DocumentCurrency |
| [0..1] | I_IncotermsClassificationText | _IncotermsClassificationText | _IncotermsClassificationText.IncotermsClassification = $projection.IncotermsClassification and _IncotermsClassificationText.IncotermsClassificationName = $session.system_language |
| [0..1] | I_PurchasingOrganization | _PurchasingOrganization | _PurchasingOrganization.PurchasingOrganization = $projection.PurchasingOrganization |
| [0..1] | I_IncotermsClassification | _IncotermsClassification | _IncotermsClassification.IncotermsClassification = $projection.IncotermsClassification |
| [0..1] | I_Supplier | _InvoicingParty | $projection.InvoicingParty = _InvoicingParty.Supplier |
Annotations (12)
| Name | Value | Level | Field |
|---|---|---|---|
| AbapCatalog.sqlViewName | ICONTRVERSHIST | view | |
| AbapCatalog.compiler.compareFilter | true | view | |
| AbapCatalog.preserveKey | true | view | |
| AccessControl.authorizationCheck | #NOT_REQUIRED | view | |
| EndUserText.label | Purchase Contract Version History | view | |
| VDM.lifecycle.contract.type | #SAP_INTERNAL_API | view | |
| ObjectModel.usageType.serviceQuality | #B | view | |
| ObjectModel.usageType.sizeCategory | #L | view | |
| ObjectModel.usageType.dataClass | #TRANSACTIONAL | view | |
| VDM.viewType | #BASIC | view | |
| AccessControl.personalData.blocking | #REQUIRED | view | |
| ClientHandling.algorithm | #SESSION_VARIABLE | view |
Fields (71)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| KEY | PurchaseContract | R_PurchaseContract | PurchaseContract | |
| PurchaseContractType | R_PurchaseContract | PurchaseContractType | ||
| PurchasingDocumentCategory | R_PurchaseContract | PurchasingDocumentCategory | ||
| Supplier | R_PurchaseContract | Supplier | ||
| CompanyCode | R_PurchaseContract | CompanyCode | ||
| PurchasingOrganization | R_PurchaseContract | PurchasingOrganization | ||
| PurchasingGroup | R_PurchaseContract | PurchasingGroup | ||
| DocumentCurrency | R_PurchaseContract | DocumentCurrency | ||
| IncotermsClassification | R_PurchaseContract | IncotermsClassification | ||
| IncotermsTransferLocation | R_PurchaseContract | IncotermsTransferLocation | ||
| PaymentTerms | R_PurchaseContract | PaymentTerms | ||
| CashDiscount1Days | R_PurchaseContract | CashDiscount1Days | ||
| CashDiscount2Days | R_PurchaseContract | CashDiscount2Days | ||
| NetPaymentDays | R_PurchaseContract | NetPaymentDays | ||
| CashDiscount1Percent | R_PurchaseContract | CashDiscount1Percent | ||
| CashDiscount2Percent | R_PurchaseContract | CashDiscount2Percent | ||
| PurchaseContractTargetAmount | R_PurchaseContract | PurchaseContractTargetAmount | ||
| ValidityStartDate | R_PurchaseContract | ValidityStartDate | ||
| ValidityEndDate | R_PurchaseContract | ValidityEndDate | ||
| ReleaseCode | R_PurchaseContract | ReleaseCode | ||
| PurchasingDocumentDeletionCode | R_PurchaseContract | PurchasingDocumentDeletionCode | ||
| SupplyingSupplier | R_PurchaseContract | SupplyingSupplier | ||
| InvoicingParty | R_PurchaseContract | InvoicingParty | ||
| ExchangeRate | ||||
| ExchangeRateIsFixed | R_PurchaseContract | ExchangeRateIsFixed | ||
| QuotationSubmissionDate | R_PurchaseContract | QuotationSubmissionDate | ||
| SupplierQuotation | R_PurchaseContract | SupplierQuotation | ||
| ReleaseIsNotCompleted | R_PurchaseContract | ReleaseIsNotCompleted | ||
| CorrespncExternalReference | R_PurchaseContract | CorrespncExternalReference | ||
| CorrespncInternalReference | R_PurchaseContract | CorrespncInternalReference | ||
| SupplierRespSalesPersonName | R_PurchaseContract | SupplierRespSalesPersonName | ||
| SupplierPhoneNumber | R_PurchaseContract | SupplierPhoneNumber | ||
| IncotermsVersion | R_PurchaseContract | IncotermsVersion | ||
| IncotermsLocation1 | R_PurchaseContract | IncotermsLocation1 | ||
| IncotermsLocation2 | R_PurchaseContract | IncotermsLocation2 | ||
| PurchasingDocumentName | R_PurchaseContract | PurchasingDocumentName | ||
| LastChangeDateTime | R_PurchaseContract | LastChangeDateTime | ||
| PurchasingProcessingStatus | R_PurchaseContract | PurchasingProcessingStatus | ||
| IsEndOfPurposeBlocked | R_PurchaseContract | IsEndOfPurposeBlocked | ||
| ActivePurchasingDocument | R_PurchaseContract | ActivePurchasingDocument | ||
| PurgDocChangeRequestStatus | R_PurchaseContract | PurgDocChangeRequestStatus | ||
| PurchasingDocumentVersion | R_PurchaseContract | PurchasingDocumentVersion | ||
| PurgDocIsChgVers | R_PurchaseContract | PurgDocIsChgVers | ||
| PurgAggrgdProdCmplncSuplrSts | R_PurchaseContract | PurgAggrgdProdCmplncSuplrSts | ||
| CreatedByUser | erev | ernam | ||
| CreationDate | erev | erdat | ||
| CreationTime | erev | eruhr | ||
| PurchasingDocVersionReasonCode | erev | rscod | ||
| PurchasingDocVersionStatus | erev | strev | ||
| AccWorkflowApprover | ||||
| AccWorkflowApproverFirstName | ||||
| ApprovalStatusName | ||||
| ApproverUser | ||||
| PurgContractIsInPreparation | ||||
| PurchasingDocumentStatus | ||||
| IncotermsSupChnLoc1AddlUUID | IncotermsSupChnLoc1AddlUUID | |||
| IncotermsSupChnLoc2AddlUUID | IncotermsSupChnLoc2AddlUUID | |||
| IncotermsSupChnDvtgLocAddlUUID | IncotermsSupChnDvtgLocAddlUUID | |||
| PurchasingDocumentOrigin | PurchasingDocumentOrigin | |||
| CreatedByUserName | _CreatedByUser | UserDescription | ||
| PurgHasCatalogRelevantItems | PurgHasCatalogRelevantItems | |||
| _PaymentTermsText | _PaymentTermsText | |||
| _UserDetails | _UserDetails | |||
| _VersionType | _VersionType | |||
| _PurchasingGroup | _PurchasingGroup | |||
| _DocumentCurrency | R_PurchaseContract | _DocumentCurrency | ||
| _DocumentCurrencyText | _DocumentCurrencyText | |||
| _IncotermsClassificationText | _IncotermsClassificationText | |||
| _IncotermsClassification | _IncotermsClassification | |||
| _PurchasingOrganization | _PurchasingOrganization | |||
| _InvoicingParty | _InvoicingParty |
@AbapCatalog.sqlViewName: 'ICONTRVERSHIST'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Purchase Contract Version History'
@VDM.lifecycle.contract.type: #SAP_INTERNAL_API
@ObjectModel:{
usageType.serviceQuality: #B,
usageType.sizeCategory: #L,
usageType.dataClass: #TRANSACTIONAL
}
@VDM.viewType: #BASIC
@AccessControl.personalData.blocking: #REQUIRED
@ClientHandling.algorithm: #SESSION_VARIABLE
define view I_PurContrVersionHistory
as select from erev as VersionHistory
inner join R_PurchaseContract as Document on VersionHistory.edokn = Document.ActivePurchasingDocument
and VersionHistory.revno = Document.PurchasingDocumentVersion
and ( Document.PurgDocChangeRequestStatus = '1' or Document.PurgDocChangeRequestStatus = '2' or
Document.PurgDocChangeRequestStatus = '4' or Document.PurgDocChangeRequestStatus = '' )
association [1..1] to I_User as _UserDetails on $projection.CreatedByUser = _UserDetails.UserID
association [1..1] to I_PurContrVersionType as _VersionType on $projection.PurgDocChangeRequestStatus = _VersionType.PurgDocChangeRequestStatus
association [0..1] to I_PaymentTermsText as _PaymentTermsText on $projection.PaymentTerms = _PaymentTermsText.PaymentTerms
and _PaymentTermsText.Language = $session.system_language
association [0..1] to I_PurchasingGroup as _PurchasingGroup on _PurchasingGroup.PurchasingGroup = $projection.PurchasingGroup
association [1..1] to I_CurrencyText as _DocumentCurrencyText on _DocumentCurrencyText.Language = $session.system_language
and _DocumentCurrencyText.Currency = $projection.DocumentCurrency
association [0..1] to I_IncotermsClassificationText as _IncotermsClassificationText on _IncotermsClassificationText.IncotermsClassification = $projection.IncotermsClassification
and _IncotermsClassificationText.IncotermsClassificationName = $session.system_language
association [0..1] to I_PurchasingOrganization as _PurchasingOrganization on _PurchasingOrganization.PurchasingOrganization = $projection.PurchasingOrganization
association [0..1] to I_IncotermsClassification as _IncotermsClassification on _IncotermsClassification.IncotermsClassification = $projection.IncotermsClassification
association [0..1] to I_Supplier as _InvoicingParty on $projection.InvoicingParty = _InvoicingParty.Supplier
{
key Document.PurchaseContract,
Document.PurchaseContractType,
Document.PurchasingDocumentCategory,
Document.Supplier,
Document.CompanyCode,
Document.PurchasingOrganization,
Document.PurchasingGroup,
@Semantics.currencyCode:true
Document.DocumentCurrency,
Document.IncotermsClassification,
Document.IncotermsTransferLocation,
Document.PaymentTerms,
Document.CashDiscount1Days,
Document.CashDiscount2Days,
Document.NetPaymentDays,
Document.CashDiscount1Percent,
Document.CashDiscount2Percent,
Document.PurchaseContractTargetAmount,
Document.ValidityStartDate,
Document.ValidityEndDate,
Document.ReleaseCode,
Document.PurchasingDocumentDeletionCode,
case Document.ManualSupplierAddressID
when '' then _Supplier.AddressID
else Document.ManualSupplierAddressID
end as SupplierAddressID,
Document.SupplyingSupplier,
Document.InvoicingParty,
cast( Document.ExchangeRate as fis_exchange_rate preserving type ) as ExchangeRate,
//Document.ExchangeRate ,
Document.ExchangeRateIsFixed,
Document.QuotationSubmissionDate,
Document.SupplierQuotation,
Document.ReleaseIsNotCompleted,
Document.CorrespncExternalReference,
Document.CorrespncInternalReference,
Document.SupplierRespSalesPersonName,
Document.SupplierPhoneNumber,
Document.IncotermsVersion,
Document.IncotermsLocation1,
Document.IncotermsLocation2,
Document.PurchasingDocumentName,
Document.LastChangeDateTime,
Document.PurchasingProcessingStatus,
Document.IsEndOfPurposeBlocked,
Document.ActivePurchasingDocument,
Document.PurgDocChangeRequestStatus,
Document.PurchasingDocumentVersion,
Document.PurgDocIsChgVers,
Document.PurgAggrgdProdCmplncSuplrSts,
VersionHistory.ernam as CreatedByUser,
VersionHistory.erdat as CreationDate,
VersionHistory.eruhr as CreationTime,
VersionHistory.rscod as PurchasingDocVersionReasonCode,
VersionHistory.strev as PurchasingDocVersionStatus,
/** Fields for approval details starts...**/
@ObjectModel.readOnly: true
cast ('' as mm_oa_approver_id) as AccWorkflowApprover,
@ObjectModel.readOnly: true
cast ('' as mm_oa_approver_name) as AccWorkflowApproverFirstName,
@ObjectModel.readOnly: true
cast( '' as val_text ) as ApprovalStatusName,
@ObjectModel.readOnly: true
cast( '' as sww_aagent ) as ApproverUser,
/** Fields for approval details ends...**/
cast('' as boolean ) as PurgContractIsInPreparation,
@ObjectModel.readOnly: true
cast('' as mmpur_doc_status) as PurchasingDocumentStatus, //VDM
IncotermsSupChnLoc1AddlUUID,
IncotermsSupChnLoc2AddlUUID,
IncotermsSupChnDvtgLocAddlUUID,
PurchasingDocumentOrigin,
_CreatedByUser.UserDescription as CreatedByUserName,
PurgHasCatalogRelevantItems,
//_PurchasingDocumentTypeText,
_PaymentTermsText,
//_PurContrStatusText,
_UserDetails,
_VersionType,
_PurchasingGroup,
Document._DocumentCurrency,
_DocumentCurrencyText,
_IncotermsClassificationText,
_IncotermsClassification,
_PurchasingOrganization,
_InvoicingParty
}
where ( PurgDocChangeRequestStatus = '1' or
PurgDocChangeRequestStatus = '2' or
PurgDocChangeRequestStatus = '4' or
PurgDocChangeRequestStatus = '' ) and
VersionHistory.bstyp = 'K';
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_SUPPLIER",
"I_USER",
"R_PURCHASECONTRACT",
"EREV"
],
"ASSOCIATED":
[
"I_CURRENCY",
"I_CURRENCYTEXT",
"I_INCOTERMSCLASSIFICATION",
"I_INCOTERMSCLASSIFICATIONTEXT",
"I_PAYMENTTERMSTEXT",
"I_PURCHASINGGROUP",
"I_PURCHASINGORGANIZATION",
"I_PURCONTRVERSIONTYPE",
"I_SUPPLIER",
"I_USER"
],
"BASE":
[
"R_PURCHASECONTRACT"
],
"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