@AbapCatalog.sqlViewName: 'PPERSONID'
@ClientHandling.algorithm: #SESSION_VARIABLE@VDM.private: true@VDM.viewType: #COMPOSITE@AbapCatalog.preserveKey:true// Per default the ID returned in HCM001. If it does not exist, it tries HCM030 and HCM031
defineview P_WFPersonIdentification
asselectdistinctfrom I_BuPaIdentification as BPIdentifier
{
key BPIdentifier.BusinessPartner,
// key BPIdentifier.BPIdentificationType,
key BPIdentifier.BPIdentificationNumber
}
where
BPIdentifier.BPIdentificationType = 'HCM001' // HCM001 - Employee ID
// or BPIdentifier.BPIdentificationType = 'HCM030' // HCM030 - Service Agent
// or BPIdentifier.BPIdentificationType = 'HCM031' // HCM031 - Freelancer
unionselectdistinctfrom I_BuPaIdentification as BPIdentifier
leftouter to one join I_BuPaIdentification as BPIdentifier001 on BPIdentifier001.BusinessPartner = BPIdentifier.BusinessPartner
and BPIdentifier001.BPIdentificationType = 'HCM001'
{
key BPIdentifier.BusinessPartner,
key BPIdentifier.BPIdentificationNumber
}
where
( BPIdentifier.BPIdentificationType = 'HCM030' // HCM001 - Employee ID
or BPIdentifier.BPIdentificationType = 'HCM031' )
and BPIdentifier001.BusinessPartner isnull