R_WorkAssignmentTP

DDL: R_WORKASSIGNMENTTP Type: view_entity TRANSACTIONAL

Work assignment TP

R_WorkAssignmentTP is a Transactional CDS View that provides data about "Work assignment TP" in SAP S/4HANA. It reads from 2 data sources (R_BPUsrRole, R_WorkAssignmentBP) and exposes 32 fields with key field WorkAssignmentUUID. It has 9 associations to related views.

Data Sources (2)

SourceAliasJoin Type
R_BPUsrRole _BPUsrRole inner
R_WorkAssignmentBP _BuPaIdentification inner

Associations (9)

CardinalityTargetAliasCondition
[0..1] R_BPUsrRoleText _BPUsrRoleText _BPUsrRoleText.Role = $projection.BasicRoleCategory and _BPUsrRoleText.Language = $session.system_language
[1..1] I_BusinessPartner _WorkforcePersonBP _WorkforcePersonBP.BusinessPartner = _AssignmentKeyMap.BusinessPartner
[1..1] I_BusinessPartner _WorkAssignmentBP _WorkAssignmentBP.BusinessPartner = _BuPaIdentification.WorkAssignmentBusinessPartner
[1..1] I_WorkAssignmentDetail_1 _AssignmentDetailsForKeyDate _AssignmentDetailsForKeyDate.WorkforceAssignment = _AssignmentKeyMap.WorkforceAssignment and _AssignmentDetailsForKeyDate.WorkforceAssgmtStartDate = _BPUsrRole.BPUsrRoleValidFromDate
[0..1] I_CompanyCode _CompanyCodeText _CompanyCodeText.CompanyCode = $projection.CompanyCode
[1..*] R_WorkAssignmentDetailsTP _WorkAssignmentDetails
[0..*] R_WorkAssgmtSrvcCostLvlTP _WorkAssgmtSrvcCostLvl
[0..*] R_BPRltnShipSupplierTP _BPRltnShipSupplier
[0..*] R_WorkAssgmtAltCostAssgmtTP _WorkAssgmtAltCostAssgmt

Annotations (8)

NameValueLevelField
AccessControl.authorizationCheck #CHECK view
EndUserText.label Work assignment TP view
Metadata.ignorePropagatedAnnotations true view
VDM.viewType #TRANSACTIONAL view
VDM.lifecycle.contract.type #SAP_INTERNAL_API view
ObjectModel.usageType.serviceQuality #C view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.dataClass #MASTER view

Fields (32)

KeyFieldSource TableSource FieldDescription
KEY WorkAssignmentUUID _WorkAssignmentBP BusinessPartnerUUID
StartDate R_BPUsrRole BPUsrRoleValidFromDate
EndDate R_BPUsrRole BPUsrRoleValidToDate
WorkAssignment _AssignmentKeyMap WorkforceAssignment
WorkAssignmentExternalID _AssignmentKeyMap WorkAssignmentExternalID
WorkforcePersonID _AssignmentKeyMap WorkforcePersonID
WorkforcePersonUserID _AssignmentKeyMap WorkforcePersonUserID
WorkAssignmentDataSource _AssignmentKeyMap WorkAssignmentDataSource
WorkAssignmentBusinessPartner R_WorkAssignmentBP WorkAssignmentBusinessPartner
Person _AssignmentKeyMap BusinessPartner
PersonUUID _WorkforcePersonBP BusinessPartnerUUID
CompanyCode _AssignmentDetailsForKeyDate CompanyCode
WorkAssignmentCountryISOCode _AssignmentDetailsForKeyDate Country2DigitISOCode
RoleCategory R_BPUsrRole RoleCategory
BasicRoleCategoryendasBasicRoleCategory
BusinessPartnerRole R_BPUsrRole BusinessPartnerRole
EmploymentSituation
BusPartRelshpSupplierIsVisible
BusinessPartnerRelshpSupplier
BusinessPartnerName
IsBlocked _AssignmentKeyMap IsBlocked
IsBusinessPurposeCompleted _WorkAssignmentBP IsBusinessPurposeCompleted
_WorkAssignmentBP _WorkAssignmentBP
_WorkforcePersonBP _WorkforcePersonBP
_WorkAssgmtSrvcCostLvl _WorkAssgmtSrvcCostLvl
_BPRltnShipSupplier _BPRltnShipSupplier
_WorkAssgmtAltCostAssgmt _WorkAssgmtAltCostAssgmt
_WorkforcePerson _WorkforcePerson
_WorkAssignmentDetails _WorkAssignmentDetails
_AssignmentDetailsForKeyDate _AssignmentDetailsForKeyDate
_CompanyCodeText _CompanyCodeText
_BPUsrRoleText _BPUsrRoleText
@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Work assignment TP'
@Metadata.ignorePropagatedAnnotations: true
@VDM: {
  viewType: #TRANSACTIONAL,
  lifecycle.contract.type: #SAP_INTERNAL_API
}
//@AccessControl.privilegedAssociations: [ '_BPDataControllerUsage' ]


@ObjectModel.usageType:{
  serviceQuality: #C,
  sizeCategory: #XL,
  dataClass: #MASTER
}
define view entity R_WorkAssignmentTP
  as select distinct from  R_WorkAssignmentKeyMap as _AssignmentKeyMap
  //Get the Employment BP (for both old and new BP Models)

    inner join             R_WorkAssignmentBP     as _BuPaIdentification on _BuPaIdentification.WorkforceAssignment = _AssignmentKeyMap.WorkforceAssignment
    inner join             R_BPUsrRole            as _BPUsrRole          on  _BPUsrRole.BusinessPartner         = _BuPaIdentification.WorkAssignmentBusinessPartner
                                                                         and _BPUsrRole.BPRoleCategoryUsageCode = _BuPaIdentification.BPRoleCategoryUsageCode

    left outer to one join R_WorkAssignmentKeyMapOldModel                on  R_WorkAssignmentKeyMapOldModel.BusinessPartner = _AssignmentKeyMap.BusinessPartner
                                                                         and _AssignmentKeyMap.WorkforceBPModelType         = 'O'
  association [0..1] to R_BPUsrRoleText              as _BPUsrRoleText               on  _BPUsrRoleText.Role     = $projection.BasicRoleCategory
                                                                                     and _BPUsrRoleText.Language = $session.system_language
  association [1..1] to I_BusinessPartner            as _WorkforcePersonBP           on  _WorkforcePersonBP.BusinessPartner = _AssignmentKeyMap.BusinessPartner

  association [1..1] to I_BusinessPartner            as _WorkAssignmentBP            on  _WorkAssignmentBP.BusinessPartner = _BuPaIdentification.WorkAssignmentBusinessPartner
  association [1..1] to I_WorkAssignmentDetail_1     as _AssignmentDetailsForKeyDate on  _AssignmentDetailsForKeyDate.WorkforceAssignment      = _AssignmentKeyMap.WorkforceAssignment
                                                                                     and _AssignmentDetailsForKeyDate.WorkforceAssgmtStartDate = _BPUsrRole.BPUsrRoleValidFromDate
  association [0..1] to I_CompanyCode                as _CompanyCodeText             on  _CompanyCodeText.CompanyCode = $projection.CompanyCode

  composition [1..*] of R_WorkAssignmentDetailsTP    as _WorkAssignmentDetails
  composition [0..*] of R_WorkAssgmtSrvcCostLvlTP    as _WorkAssgmtSrvcCostLvl
  composition [0..*] of R_BPRltnShipSupplierTP       as _BPRltnShipSupplier
  composition [0..*] of R_WorkAssgmtAltCostAssgmtTP  as _WorkAssgmtAltCostAssgmt
//  composition [0..*] of R_WorkAssgmtPaymentTP        as _WorkAssignmentPayment

//  composition [0..*] of R_WorkAssgmtPrivateAddressTP as _WorkAssgmtPrivateAddress

  association        to parent R_WorkforcePersonTP   as _WorkforcePerson             on  $projection.PersonUUID = _WorkforcePerson.PersonUUID
  //    association [0..*] to I_BPDataControllerUsage      as _BPDataControllerUsage       on  $projection.Person = _BPDataControllerUsage.BusinessPartner

{
  key   _WorkAssignmentBP.BusinessPartnerUUID                                                           as WorkAssignmentUUID,
        _BPUsrRole.BPUsrRoleValidFromDate                                                               as StartDate,
        _BPUsrRole.BPUsrRoleValidToDate                                                                 as EndDate,
        _AssignmentKeyMap.WorkforceAssignment                                                           as WorkAssignment, //PERNR

        _AssignmentKeyMap.WorkAssignmentExternalID                                                      as WorkAssignmentExternalID,
        //Replacing WorkAssignmentExternalID with User ID field in the UI because these fields could differ if in case of replication

        _AssignmentKeyMap.WorkforcePersonID                                                             as WorkforcePersonID,
        _AssignmentKeyMap.WorkforcePersonUserID                                                         as WorkforcePersonUserID, //Mandatory

        _AssignmentKeyMap.WorkAssignmentDataSource                                                      as WorkAssignmentDataSource,
        _BuPaIdentification.WorkAssignmentBusinessPartner                                               as WorkAssignmentBusinessPartner,
        _AssignmentKeyMap.BusinessPartner                                                               as Person,
        _WorkforcePersonBP.BusinessPartnerUUID                                                          as PersonUUID,
        _AssignmentDetailsForKeyDate.CompanyCode                                                        as CompanyCode, //select only first one

        _AssignmentDetailsForKeyDate.Country2DigitISOCode                                               as WorkAssignmentCountryISOCode,
        _BPUsrRole.RoleCategory                                                                         as RoleCategory,
        case _BPUsrRole.BasicRoleCategory
        when ''
        then _BPUsrRole.RoleCategory
        else
         _BPUsrRole.BasicRoleCategory
        end                                                                                             as BasicRoleCategory,
        _BPUsrRole.BusinessPartnerRole                                                                  as BusinessPartnerRole,
        cast( '' as bum_wf_employment_situation preserving type )                                       as EmploymentSituation,
        cast( ' ' as boolean preserving type )                                                          as BusPartRelshpSupplierIsVisible,
        @Semantics.systemDateTime.lastChangedAt: true
        cast (dats_tims_to_tstmp( _WorkAssignmentBP.CreationDate,
                                  _WorkAssignmentBP.CreationTime,
        abap_system_timezone( $session.client,'NULL' ), $session.client, 'NULL' ) as vdm_lastchangedon) as CreationDateTime,

        cast ( ''  as abap.char(10))                                                                    as BusinessPartnerRelshpSupplier,
        cast ( ''  as abap.char(100))                                                                   as BusinessPartnerName,

        //        Fields for DCL

        @Semantics.booleanIndicator
        _AssignmentKeyMap.IsBlocked                                                                     as IsBlocked,
        @Semantics.booleanIndicator
        _WorkAssignmentBP.IsBusinessPurposeCompleted                                                    as IsBusinessPurposeCompleted,
        _WorkAssignmentBP,
        _WorkforcePersonBP,
        _WorkAssgmtSrvcCostLvl,
        _BPRltnShipSupplier,
        _WorkAssgmtAltCostAssgmt,
//        _WorkAssignmentPayment,

//        _WorkAssgmtPrivateAddress,

        _WorkforcePerson,
        _WorkAssignmentDetails,
        _AssignmentDetailsForKeyDate,
        _CompanyCodeText,
        _BPUsrRoleText
        //        _SupplierBP

        //        _BPDataControllerUsage

}
where
       _AssignmentKeyMap.BusinessPartner                      is not initial
  and(
       R_WorkAssignmentKeyMapOldModel.NumberOfWorkAssignments <= 1
    or R_WorkAssignmentKeyMapOldModel.NumberOfWorkAssignments is null
  )