P_Empworkinghours

DDL: P_EMPWORKINGHOURS SQL: PEMPWORKHR Type: view COMPOSITE

P_Empworkinghours is a Composite CDS View in SAP S/4HANA. It reads from 3 data sources (I_CalendarDate, I_PersonWorkAgrmtStatus, I_PersonWorkAgrmtPlndWrkgTime) and exposes 4 fields with key fields PersonWorkAgreement, CalendarDate.

Data Sources (3)

SourceAliasJoin Type
I_CalendarDate CalendarDate left_outer
I_PersonWorkAgrmtStatus EmpStatus inner
I_PersonWorkAgrmtPlndWrkgTime WorkSchedule left_outer

Annotations (6)

NameValueLevelField
AbapCatalog.sqlViewName PEMPWORKHR view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #NOT_REQUIRED view
ClientHandling.algorithm #SESSION_VARIABLE view
VDM.viewType #COMPOSITE view
VDM.private true view

Fields (4)

KeyFieldSource TableSource FieldDescription
KEY PersonWorkAgreement Employment PersonWorkAgreement
KEY CalendarDate I_CalendarDate CalendarDate
Difference
UnitOfMeasure
@AbapCatalog.sqlViewName: 'PEMPWORKHR'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ClientHandling.algorithm: #SESSION_VARIABLE
@VDM.viewType: #COMPOSITE
@VDM.private: true
define view P_Empworkinghours
  as select distinct from I_PersonWorkAgrmtOrglDetails  as Employment
    inner join            I_PersonWorkAgrmtStatus       as EmpStatus    on  Employment.PersonWorkAgreement = EmpStatus.PersonWorkAgreement
    //and CalendarDate.CalendarDate      between EmpStatus.StartDate and EmpStatus.EndDate

                                                                        and EmpStatus.WorkAgreementStatus  = '1'
    left outer join       I_CalendarDate                as CalendarDate on CalendarDate.CalendarDate is not null //between $parameters.P_StartDate and $parameters.P_EndDate

    left outer join       I_PersonWorkAgrmtPlndWrkgTime as WorkSchedule on  Employment.PersonWorkAgreement =       WorkSchedule.PersonWorkAgreement
                                                                        and CalendarDate.CalendarDate      between WorkSchedule.StartDate and WorkSchedule.EndDate


{
  key    Employment.PersonWorkAgreement,
  key    CalendarDate.CalendarDate,
         // cast(Employment._EmploymentDetailsCurrent.WeeklyWorkdays as char7) as WeeklyWorkDays,

         ((WorkSchedule.WeeklyWorkdays)-cast(cast(CalendarDate._WeekDay.WeekDay as numc1 )as abap.dec(5,2))) as Difference,
         @Semantics.unitOfMeasure: true
         cast('H' as meinh)                                                                                  as UnitOfMeasure,
         //  @DefaultAggregation: #NONE

         @Semantics.quantity.unitOfMeasure: 'UnitOfMeasure'
         case
         when WorkSchedule.WeeklyWorkingHours > 0 and WorkSchedule.WeeklyWorkdays > 0
         then division(WorkSchedule.WeeklyWorkingHours,WorkSchedule.WeeklyWorkdays, 3)
         else
         cast(  0 as pt_datthrs) //changed 8 to 0 from 1708

         end                                                                                                 as TotalPlannedHours

}
where
  CalendarDate.CalendarDate between EmpStatus.StartDate and EmpStatus.EndDate
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_CALENDARDATE",
"I_PERSONWORKAGRMTORGLDETAILS",
"I_PERSONWORKAGRMTPLNDWRKGTIME",
"I_PERSONWORKAGRMTSTATUS",
"I_WEEKDAY"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/