P_PurContrCalcValidityStatus

DDL: P_PURCONTRCALCVALIDITYSTATUS SQL: PPCCALTVALSTS Type: view COMPOSITE

P_PurContrCalcValidityStatus is a Composite CDS View in SAP S/4HANA. It reads from 1 data source (I_PurchaseContract) and exposes 5 fields with key field PurchaseContract.

Data Sources (1)

SourceAliasJoin Type
I_PurchaseContract _PurchaseContract from

Annotations (10)

NameValueLevelField
AbapCatalog.sqlViewName PPCCALTVALSTS view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
AccessControl.authorizationCheck #CHECK view
VDM.private true view
VDM.viewType #COMPOSITE view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.sizeCategory #L view
ObjectModel.usageType.dataClass #MIXED view
ClientHandling.algorithm #SESSION_VARIABLE view

Fields (5)

KeyFieldSource TableSource FieldDescription
KEY PurchaseContract PurchaseContract Purchasing Doc.
ValidityStartDate I_PurchaseContract ValidityStartDate Validity Start Date
ValidityEndDateendasValidityEndDate
ValidityEndDateendasTimeVarianceInDays
ActivePurchasingDocument ActivePurchasingDocument Active Purchase Doc

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_PurContrCalcValidityStatus.
-- 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: PPCCALTVALSTS

CREATE VIEW P_PurContrCalcValidityStatus AS
SELECT
  PurchaseContract,
  _PurchaseContract.ValidityStartDate AS ValidityStartDate,
  case when _PurchaseContract.ValidityEndDate is initial then '99991231' else _PurchaseContract.ValidityEndDate end as ValidityEndDate AS ValidityEndDateendasValidityEndDate,
  case when _PurchaseContract.ValidityEndDate is initial then dats_days_between(cast( substring( cast( tstmp_current_utctimestamp() as abap.char(17) ), 1, 8 ) as abap.dats), cast ('99991231' as abap.dats)) else dats_days_between(cast( substring( cast( tstmp_current_utctimestamp() as abap.char(17) ), 1, 8 ) as abap.dats), _PurchaseContract.ValidityEndDate) end as TimeVarianceInDays AS ValidityEndDateendasTimeVarianceInDays,
  ActivePurchasingDocument
FROM I_PurchaseContract AS _PurchaseContract
;