I_ServiceOrderPeriodCode is a Basic CDS View that provides data about "Service Order Period Code" in SAP S/4HANA. It reads from 1 data source (dd07l) and exposes 2 fields with key field ServiceOrderPeriodCode. It has 2 associations to related views.
@EndUserText.label: 'Service Order Period Code'
@ClientHandling.algorithm: #SESSION_VARIABLE@AbapCatalog:{
sqlViewName: 'ISRVCORDPRD',
compiler.compareFilter: true,
preserveKey: true
}@AccessControl.authorizationCheck: #NOT_REQUIRED@VDM.viewType: #BASIC// for the value help free text search bar
//@Search.searchable: true@ObjectModel.usageType.dataClass: #CUSTOMIZING@ObjectModel.usageType.serviceQuality: #X@ObjectModel.usageType.sizeCategory: #S//@ObjectModel.representativeKey: 'Issue'
@Metadata.ignorePropagatedAnnotations: truedefineview I_ServiceOrderPeriodCode
asselectfrom dd07l
// association [1..*] to I_ServiceOrderPeriodCodeText as _ServiceOrderPeriodCodeText on $projection.ConsecutiveWeekNumber = _ServiceOrderPeriodCodeText.ServiceOrderPeriodCode
association [1..*] to I_ServiceOrderPeriodCodeText as _ServiceOrderPeriodCodeText on $projection.ServiceOrderPeriodCode = _ServiceOrderPeriodCodeText.ServiceOrderPeriodCode
association [1..1] to P_CALENDARENDWEEK as _CalendarDate on _CalendarDate.CalendarDate = $session.system_date
// association [1..1] to P_CALENDARWEEK as _CalendarDate on _CalendarDate.CalendarDate = '20200101'
{
@UI.hidden: true// key valpos as ConsecutiveWeekNumber,
key valpos as ServiceOrderPeriodCode,
// valpos as ServiceOrderPeriodCode,
// for the value help free text search bar
// @Search: {
// defaultSearchElement: true,
// fuzzinessThreshold: 0.8,
// ranking: #HIGH
// }@EndUserText.label: 'Week Number'
@ObjectModel.text.association: '_ServiceOrderPeriodCodeText'
casewhen valpos between '0054' and '0062'
thencast(concat( '000', cast(cast(valpos as int4) - 53 asabap.char(12))) asabap.numc(4))
when valpos > '0053'
thencast(concat( '00', cast(cast(valpos as int4) - 53 asabap.char(12))) asabap.numc(4))
when valpos = '0053'
then valpos
else valpos
endas ConsecutiveWeekNumber,
// endas ServiceOrderPeriodCode,
// _CalendarDate.CalendarDate,
// _ServiceOrderPeriodCodeText.ServiceOrderPeriodCodeText,
// _ServiceOrderPeriodCodeText.Language,
// casewhen valpos > '0053'
// thencast(concat( '00', cast(cast(valpos as int4) - 53 asabap.char(12))) asabap.numc(4))
// else valpos
// endas ServiceOrderPeriodCode,
_ServiceOrderPeriodCodeText
}
where
domname = 'CRMS4_SRVC_ORD_PERIOD'
and as4local = 'A'
and valpos between _CalendarDate.CalendarWeek and _CalendarDate.EndDateWeek
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"P_CALENDARENDWEEK",
"DD07L"
],
"ASSOCIATED":
[
"I_SERVICEORDERPERIODCODETEXT",
"P_CALENDARENDWEEK"
],
"BASE":
[],
"ANNO_REF":
[],
"VERSION":0
}
}*/