P_EmployStatDet is a Basic CDS View in SAP S/4HANA. It reads from 6 data sources and exposes 11 fields with key field EmploymentInternalID. It has 1 association to related views.
@AbapCatalog.sqlViewName: 'PEMPLOYSTATDET'
@VDM.viewType: #BASIC//@EndUserText.label: 'Employment status'
@AccessControl.authorizationCheck: #NOT_REQUIRED@VDM.private: true@AbapCatalog.preserveKey:true@AbapCatalog.compiler.compareFilter:true@ClientHandling.algorithm: #SESSION_VARIABLE@ObjectModel.usageType.dataClass: #MASTER@ObjectModel.usageType.serviceQuality: #C@ObjectModel.usageType.sizeCategory: #Ldefineview P_EmployStatDet
asselectfrom pa0000 as it0000
innerjoin pa0001 as it0001 on it0000.pernr = it0001.pernr
and it0001.sprps <> 'X'
and it0000.endda between it0001.begda and it0001.endda
leftouterjoin wfd_d_new_pers as switch on switch.mandt = it0000.mandt
association [0..1] to P_EmploymentOp as Employment on it0000.pernr = Employment.EmploymentInternalID
{
key it0000.pernr as EmploymentInternalID,
@Semantics.businessDate.from/to
key it0000.begda as StartDate,
@Semantics.businessDate.from/to
it0000.endda as EndDate,
Employment.PersonnelNumber as PersonnelNumber, //cast(Employment.PersonnelNumber as /shcm/employee_int_id) as PersonnelNumber,
Employment.IsMainEmployment as IsMainEmployment, //cast(Employment.IsMainEmployment as /shcm/main_employmnt_indicator) as IsMainEmployment,
case it0000.stat2
when '3' then '1'
else '0'
endas EmploymentStatus,
it0001.vdsk1 as PersonWorkAgrmtAuthznGrpg
}
where
(
switch.switch isnullor switch.switch <> 'NEW'
)
unionallselectfrom wfd_d_assgmtdets as assgmtdets
innerjoin wfd_d_assgmt as assgmt on assgmt.workforce_assgmt_id = assgmtdets.workforce_assgmt_id
and assgmtdets.end_date between assgmt.start_date and assgmt.end_date
innerjoin wfd_d_new_pers as switch on switch.mandt = assgmtdets.client
association [0..1] to P_EmploymentOp as Employment on assgmtdets.workforce_assgmt_id = Employment.EmploymentInternalID
{
key assgmtdets.workforce_assgmt_id as EmploymentInternalID,
@Semantics.businessDate.from/to
key assgmtdets.start_date as StartDate,
@Semantics.businessDate.from/to
key assgmtdets.end_date as EndDate,
Employment.PersonnelNumber as PersonnelNumber, //cast(Employment.PersonnelNumber as /shcm/employee_int_id) as PersonnelNumber,
Employment.IsMainEmployment as IsMainEmployment, //cast(Employment.IsMainEmployment as /shcm/main_employmnt_indicator) as IsMainEmployment,
assgmtdets.employment_status as EmploymentStatus,
'' as PersonWorkAgrmtAuthznGrpg
}
where
switch.switch = 'NEW'
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"P_EMPLOYMENTOP",
"PA0000",
"PA0001",
"WFD_D_ASSGMT",
"WFD_D_ASSGMTDETS",
"WFD_D_NEW_PERS"
],
"ASSOCIATED":
[
"P_EMPLOYMENTOP"
],
"BASE":
[],
"ANNO_REF":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/