P_ServiceContractDataCalc
P_ServiceContractDataCalc is a Composite CDS View in SAP S/4HANA. It reads from 1 data source (I_ServiceDocumentEnhcd) and exposes 71 fields with key fields ServiceObjectType, ServiceContract. It has 3 associations to related views.
Data Sources (1)
| Source | Alias | Join Type |
|---|---|---|
| I_ServiceDocumentEnhcd | I_ServiceDocumentEnhcd | from |
Associations (3)
| Cardinality | Target | Alias | Condition |
|---|---|---|---|
| [0..1] | I_ServiceDocumentType | _ServiceContractType | $projection.ServiceContractType = _ServiceContractType.ServiceDocumentType |
| [0..1] | I_ServiceDocumentStatus | _ServiceContractStatus | $projection.ServiceContractStatus = _ServiceContractStatus.ServiceDocumentStatus |
| [0..1] | I_CalendarDate | _CurrentDate | _CurrentDate.CalendarDate = $session.system_date |
Annotations (10)
| Name | Value | Level | Field |
|---|---|---|---|
| ClientHandling.algorithm | #SESSION_VARIABLE | view | |
| AbapCatalog.sqlViewName | PSRVCCONTRCALC | view | |
| AbapCatalog.compiler.compareFilter | true | view | |
| AbapCatalog.preserveKey | true | view | |
| VDM.private | true | view | |
| VDM.viewType | #COMPOSITE | view | |
| AccessControl.authorizationCheck | #NOT_REQUIRED | view | |
| ObjectModel.usageType.dataClass | #MIXED | view | |
| ObjectModel.usageType.serviceQuality | #D | view | |
| ObjectModel.usageType.sizeCategory | #XXL | view |
Fields (71)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| KEY | ServiceObjectType | ServiceObjectType | Object Type | |
| KEY | ServiceContract | ServiceDocument | Transaction ID | |
| ServiceContractUUID | ServiceDocumentUUID | Object GUID | ||
| ServiceDocumentDescription | ServiceDocumentDescription | |||
| ServiceDocumentType | ServiceDocumentType | Transaction Type | ||
| ServiceContractType | ServiceDocumentType | Transaction Type | ||
| RefBusinessSolutionOrder | RefBusinessSolutionOrder | |||
| ServiceDocumentStatus | ServiceDocumentStatus | |||
| ServiceContractStatus | ServiceDocumentStatus | |||
| ServiceDocumentIsOpen | ServiceDocumentIsOpen | |||
| TransactionCurrency | TransactionCurrency | Transaction Currency | ||
| PurchaseOrderByCustomer | PurchaseOrderByCustomer | Purchase Order Number | ||
| SalesOrganization | SalesOrganization | Sales Organization | ||
| DistributionChannel | DistributionChannel | RefDistCh-Cust/Mat. | ||
| Division | Division | Internal Division ID | ||
| SalesOffice | SalesOffice | Sales Office | ||
| SalesGroup | SalesGroup | Sales Group | ||
| SalesOrganizationOrgUnitID | SalesOrganizationOrgUnitID | |||
| SalesOfficeOrgUnitID | SalesOfficeOrgUnitID | |||
| SalesGroupOrgUnitID | SalesGroupOrgUnitID | |||
| ServiceOrganization | ServiceOrganization | |||
| SoldToPartyCountry | SoldToPartyCountry | |||
| SoldToPartyRegion | SoldToPartyRegion | |||
| SoldToParty | SoldToParty | Sold-to Party | ||
| ResponsibleEmployee | ResponsibleEmployee | Employee Resp. | ||
| ServiceTeam | ServiceTeam | |||
| ContactPerson | ContactPerson | Contact Person Key | ||
| ShipToParty | ShipToParty | Ship-To Party (obsolete) | ||
| ServiceContractStartDate | ServiceContractStartDate | |||
| ServiceContractEndDate | ServiceContractEndDate | |||
| ServiceContractStartDateTime | ServiceContractStartDateTime | |||
| ServiceContractEndDateTime | ServiceContractEndDateTime | |||
| CalendarDate | _CurrentDate | CalendarDate | Calendar Date | |
| ShiftedCalendarDate | ||||
| LastDayOfMonthDate | ||||
| ServiceDocNetAmount | ServiceDocNetAmount | |||
| int4endasNmbrOfExpiredSrvcContracts | ||||
| int4endasNmbrOfExpiredSrvcContrCurWeek | ||||
| int4endasNmbrOfExpiredSrvcContrNextWeek | ||||
| int4endasNmbrOfExpiredSrvcContrIn2Weeks | ||||
| int4endasNmbrOfExpiredSrvcContrIn3Weeks | ||||
| NumberOfDays | ||||
| _ServiceObjType | _ServiceObjType | |||
| _ServiceDocumentType | _ServiceDocumentType | |||
| _ServiceContractType | _ServiceContractType | |||
| _ServiceDocumentStatus | _ServiceDocumentStatus | |||
| _SrvcDocLifecycleStatus | _SrvcDocLifecycleStatus | |||
| _ServiceContractStatus | _ServiceContractStatus | |||
| _ServiceDocumentIsOpen | _ServiceDocumentIsOpen | |||
| _SoldToPartyRegion | _SoldToPartyRegion | |||
| _SoldToPartyCountry | _SoldToPartyCountry | |||
| _TransactionCurrency | _TransactionCurrency | |||
| _CurrentDate | _CurrentDate | |||
| _SoldToParty | _SoldToParty | |||
| _SalesOrganization | _SalesOrganization | |||
| _DistributionChannel | _DistributionChannel | |||
| _Division | _Division | |||
| _SalesOffice | _SalesOffice | |||
| _SalesGroup | _SalesGroup | |||
| _SalesOrganizationOrgUnit | _SalesOrganizationOrgUnit | |||
| _SalesOfficeOrgUnit | _SalesOfficeOrgUnit | |||
| _SalesGroupOrgUnit | _SalesGroupOrgUnit | |||
| _ServiceOrganizationOrgUnit | _ServiceOrganizationOrgUnit | |||
| _SalesOrganizationOrgUnit_2 | _SalesOrganizationOrgUnit_2 | |||
| _SalesOfficeOrgUnit_2 | _SalesOfficeOrgUnit_2 | |||
| _SalesGroupOrgUnit_2 | _SalesGroupOrgUnit_2 | |||
| _ServiceOrganizationOrgUnit_2 | _ServiceOrganizationOrgUnit_2 | |||
| _RespEmployee | _RespEmployee | |||
| _ServiceTeam | _ServiceTeam | |||
| _ContactPerson | _ContactPerson | |||
| _ShipToParty | _ShipToParty |
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_ServiceContractDataCalc.
-- 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.
CREATE VIEW P_ServiceContractDataCalc AS
SELECT
ServiceObjectType,
ServiceDocument AS ServiceContract,
ServiceDocumentUUID AS ServiceContractUUID,
ServiceDocumentDescription,
ServiceDocumentType,
ServiceDocumentType AS ServiceContractType,
RefBusinessSolutionOrder,
ServiceDocumentStatus,
ServiceDocumentStatus AS ServiceContractStatus,
ServiceDocumentIsOpen,
TransactionCurrency,
PurchaseOrderByCustomer,
SalesOrganization,
DistributionChannel,
Division,
SalesOffice,
SalesGroup,
SalesOrganizationOrgUnitID,
SalesOfficeOrgUnitID,
SalesGroupOrgUnitID,
ServiceOrganization,
SoldToPartyCountry,
SoldToPartyRegion,
SoldToParty,
ResponsibleEmployee,
ServiceTeam,
ContactPerson,
ShipToParty,
ServiceContractStartDate,
ServiceContractEndDate,
ServiceContractStartDateTime,
ServiceContractEndDateTime,
_CurrentDate.CalendarDate AS CalendarDate,
dats_add_months( _CurrentDate.CalendarDate, -6, 'FAIL') AS ShiftedCalendarDate,
dats_add_days( _CurrentDate.FirstDayOfMonthDate, -1, 'FAIL') AS LastDayOfMonthDate,
ServiceDocNetAmount,
case when ServiceContractEndDate < $session.system_date then cast (1 as abap.int4) end as NmbrOfExpiredSrvcContracts AS int4endasNmbrOfExpiredSrvcContracts,
case when ServiceContractEndDate >= $session.system_date and ServiceContractEndDate <= dats_add_days( _CurrentDate.FirstDayOfWeekDate,6,'FAIL') then cast (1 as abap.int4) end as NmbrOfExpiredSrvcContrCurWeek AS int4endasNmbrOfExpiredSrvcContrCurWeek,
case when ServiceContractEndDate >= dats_add_days( _CurrentDate.FirstDayOfWeekDate,7,'FAIL') and ServiceContractEndDate <= dats_add_days( _CurrentDate.FirstDayOfWeekDate,13,'FAIL') then cast (1 as abap.int4) end as NmbrOfExpiredSrvcContrNextWeek AS int4endasNmbrOfExpiredSrvcContrNextWeek,
case when ServiceContractEndDate >= dats_add_days( _CurrentDate.FirstDayOfWeekDate,14,'FAIL') and ServiceContractEndDate <= dats_add_days( _CurrentDate.FirstDayOfWeekDate,20,'FAIL') then cast (1 as abap.int4) end as NmbrOfExpiredSrvcContrIn2Weeks AS int4endasNmbrOfExpiredSrvcContrIn2Weeks,
case when ServiceContractEndDate >= dats_add_days( _CurrentDate.FirstDayOfWeekDate,21,'FAIL') and ServiceContractEndDate <= dats_add_days( _CurrentDate.FirstDayOfWeekDate,27,'FAIL') then cast (1 as abap.int4) end as NmbrOfExpiredSrvcContrIn3Weeks AS int4endasNmbrOfExpiredSrvcContrIn3Weeks,
dats_days_between(ServiceContractStartDate,ServiceContractEndDate) AS NumberOfDays
FROM I_ServiceDocumentEnhcd
LEFT OUTER JOIN I_ServiceDocumentType AS _ServiceContractType ON ServiceContractType = _ServiceContractType.ServiceDocumentType -- association [0..1]
LEFT OUTER JOIN I_ServiceDocumentStatus AS _ServiceContractStatus ON ServiceContractStatus = _ServiceContractStatus.ServiceDocumentStatus -- association [0..1]
LEFT OUTER JOIN I_CalendarDate AS _CurrentDate ON _CurrentDate.CalendarDate = $session.system_date -- association [0..1]
;
Learn More
- VDM (Virtual Data Model) in SAP S/4HANA Explained
- Types of CDS Views: Basic, Composite, Consumption, and Transactional
- CDS View Annotations — A Complete Guide
- What Is a CDS View in SAP S/4HANA?
- SAP Tables vs CDS Views — Key Differences
- Understanding Data Lineage in SAP S/4HANA
- 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
- BSEG to ACDOCA: The Universal Journal Migration
- Business Partner Migration: KNA1/LFA1 to BUT000
- Material Document Migration: MSEG/MKPF to MATDOC
- How to Find the Right CDS View for an SAP Table
- BW Extractor to CDS View Migration Guide
- S/4HANA CDS View Deprecation: What You Need to Know
- ABAP CDS View Tutorial — From Basics to Real-World Examples
- RAP and CDS Views — Building Transactional Apps in SAP S/4HANA
- Sales Document Status Migration: VBUP/VBUK Removal in S/4HANA
- CO Tables in S/4HANA: COEP, COBK, COSS, COSP to ACDOCA