P_N_EmployStatDet is a Basic CDS View in SAP S/4HANA. It reads from 4 data sources (wfd_d_assgmt, wfd_d_assgmtdets, P_N_EmploymentMinPernr, wfd_d_keymap) and exposes 6 fields with key field EmploymentInternalID.
@AbapCatalog.sqlViewName: 'PNEMPLOYSTATDET'
@VDM.viewType: #BASIC//@EndUserText.label: 'Employment status'
@AccessControl.authorizationCheck: #NOT_REQUIRED@AccessControl.personalData.blocking: #BLOCKED_DATA_EXCLUDED@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_N_EmployStatDet
asselectfrom 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
// association [0..1] to P_EmploymentOp as Employment on assgmtdets.workforce_assgmt_id = Employment.EmploymentInternalID
innerjoin wfd_d_keymap as wfd_d_keymap on assgmt.workforce_assgmt_id = wfd_d_keymap.workforce_assgmt_id
innerjoin P_N_EmploymentMinPernr as mainEmployment on mainEmployment.PersonnelNumber = wfd_d_keymap.business_partner_id
{
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,
wfd_d_keymap.central_person as PersonnelNumber,
casewhen assgmtdets.workforce_assgmt_id = mainEmployment.EmploymentInternalID
then 'X'
else ''
endas IsMainEmployment,
assgmtdets.employment_status as EmploymentStatus,
'' as PersonWorkAgrmtAuthznGrpg
}
where
assgmtdets.block_ind = ''
and assgmt.block_ind = ''
and wfd_d_keymap.block_ind = ''
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"P_N_EMPLOYMENTMINPERNR",
"WFD_D_ASSGMT",
"WFD_D_ASSGMTDETS",
"WFD_D_KEYMAP"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/