R_WorkAssignment_2

DDL: R_WORKASSIGNMENT_2 Type: view_entity COMPOSITE Package: ODATA_CA_BUM_WF

Work assignment

R_WorkAssignment_2 is a Composite CDS View that provides data about "Work assignment" in SAP S/4HANA. It reads from 2 data sources (R_BPUsrRole_2, R_WorkAssignmentBP) and exposes 40 fields with key field WorkAssignmentBusinessPartner. It has 6 associations to related views. Part of development package ODATA_CA_BUM_WF.

Data Sources (2)

SourceAliasJoin Type
R_BPUsrRole_2 _BPUsrRole inner
R_WorkAssignmentBP _BuPaIdentification inner

Associations (6)

CardinalityTargetAliasCondition
[0..1] R_BPUsrRoleText _BPUsrRoleText _BPUsrRoleText.Role = $projection.BasicRoleCategory and _BPUsrRoleText.Language = $session.system_language
[1..1] I_BusinessPartner _WorkAssignmentBP _WorkAssignmentBP.BusinessPartner = $projection.WorkAssignmentBusinessPartner
[0..1] I_CompanyCode _CompanyCodeText _CompanyCodeText.CompanyCode = _AssignmentDetailsForKeyDate.CompanyCode
[0..1] I_CurrencyText _CurrencyText _CurrencyText.Currency = $projection.Currency and _CurrencyText.Language = $session.system_language
[0..1] I_CountryText _CountryText _CountryText.Country = $projection.CompanyCodeCountry and _CountryText.Language = $session.system_language
[0..1] R_WorkAssignmentDataSourceVH _EntrySourceText $projection.WorkAssignmentDataSource = _EntrySourceText.WorkAssignmentDataSource

Annotations (8)

NameValueLevelField
AccessControl.authorizationCheck #NOT_REQUIRED view
EndUserText.label Work assignment view
Metadata.ignorePropagatedAnnotations true view
VDM.viewType #COMPOSITE 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 (40)

KeyFieldSource TableSource FieldDescription
KEY WorkAssignmentBusinessPartner R_WorkAssignmentBP WorkAssignmentBusinessPartner
WorkAssignmentUUID _WorkAssignmentBP BusinessPartnerUUID
StartDate R_BPUsrRole_2 BPUsrRoleValidFromDate
EndDate R_BPUsrRole_2 BPUsrRoleValidToDate
WorkAssignment _AssignmentKeyMap WorkforceAssignment
WorkAssignmentExternalID _AssignmentKeyMap WorkAssignmentExternalID
WorkforcePersonID _AssignmentKeyMap WorkforcePersonID
WorkforcePersonUserID _AssignmentKeyMap WorkforcePersonUserID
BusinessPartner _AssignmentKeyMap BusinessPartner
CompanyCode _AssignmentDetailsForKeyDate CompanyCode
CompanyCodeCountry _CompanyCodeText Country
Currency _CompanyCodeText Currency
WorkAssignmentCountryISOCode _AssignmentDetailsForKeyDate Country2DigitISOCode
RoleCategory R_BPUsrRole_2 RoleCategory
BasicRoleCategoryendasBasicRoleCategory
BusinessPartnerRole R_BPUsrRole_2 BusinessPartnerRole
EmploymentSituation
BusPartRelshpSupplierIsVisible
BusinessPartnerRelshpSupplier
BusinessPartnerName
IsBlocked _AssignmentKeyMap IsBlocked
IsBusinessPurposeCompleted _WorkAssignmentBP IsBusinessPurposeCompleted
AuthorizationGroup _WorkAssignmentBP AuthorizationGroup
DataControllerSet _WorkAssignmentBP DataControllerSet
DataController1 _WorkAssignmentBP DataController1
DataController2 _WorkAssignmentBP DataController2
DataController3 _WorkAssignmentBP DataController3
DataController4 _WorkAssignmentBP DataController4
DataController5 _WorkAssignmentBP DataController5
DataController6 _WorkAssignmentBP DataController6
DataController7 _WorkAssignmentBP DataController7
DataController8 _WorkAssignmentBP DataController8
DataController9 _WorkAssignmentBP DataController9
DataController10 _WorkAssignmentBP DataController10
_WorkAssignmentBP _WorkAssignmentBP
_CompanyCodeText _CompanyCodeText
_CurrencyText _CurrencyText
_CountryText _CountryText
_BPUsrRoleText _BPUsrRoleText
_EntrySourceText _EntrySourceText
@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Work assignment'
@Metadata.ignorePropagatedAnnotations: true
@VDM: {
  viewType: #COMPOSITE,
  lifecycle.contract.type: #SAP_INTERNAL_API
}

@ObjectModel.usageType:{
  serviceQuality: #C,
  sizeCategory: #XL,
  dataClass: #MASTER
}
//@Consumption.dbHints: ['USE_HEX_PLAN']

@Consumption.dbHints: [ '&PREFER_JOIN_WITH_FDA 0&', 'USE_HEX_PLAN' ]
define view entity R_WorkAssignment_2
  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_2              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'

    left outer to one join I_WorkAssignmentDetailsAll as _AssignmentDetailsForKeyDate on  _AssignmentDetailsForKeyDate.WorkAssignment          = _AssignmentKeyMap.WorkforceAssignment
                                                                                      and _AssignmentDetailsForKeyDate.WorkAssignmentStartDate = _BPUsrRole.BPUsrRoleValidFromDate

  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 _WorkAssignmentBP on  _WorkAssignmentBP.BusinessPartner = $projection.WorkAssignmentBusinessPartner
  association [0..1] to I_CompanyCode                as _CompanyCodeText  on  _CompanyCodeText.CompanyCode = _AssignmentDetailsForKeyDate.CompanyCode
  association [0..1] to I_CurrencyText               as _CurrencyText     on  _CurrencyText.Currency = $projection.Currency
                                                                          and _CurrencyText.Language = $session.system_language
  association [0..1] to I_CountryText                as _CountryText      on  _CountryText.Country  = $projection.CompanyCodeCountry
                                                                          and _CountryText.Language = $session.system_language
  association [0..1] to R_WorkAssignmentDataSourceVH as _EntrySourceText  on  $projection.WorkAssignmentDataSource = _EntrySourceText.WorkAssignmentDataSource
{
  key   _BuPaIdentification.WorkAssignmentBusinessPartner                                               as WorkAssignmentBusinessPartner,
        _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

        //If the Original Entry Source is 'E', treat it as 'W'

        case _AssignmentKeyMap.WorkAssignmentDataSource
        when 'E'
        then 'W'
        else
        _AssignmentKeyMap.WorkAssignmentDataSource
        end                                                                                             as WorkAssignmentDataSource,
        _AssignmentKeyMap.BusinessPartner, //Workforce Person BusinessPartner

        _AssignmentDetailsForKeyDate.CompanyCode                                                        as CompanyCode, //select only first one

        _CompanyCodeText.Country                                                                        as CompanyCodeCountry,
        _CompanyCodeText.Currency                                                                       as Currency,
        _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.AuthorizationGroup,
        _WorkAssignmentBP.DataControllerSet,
        _WorkAssignmentBP.DataController1,
        _WorkAssignmentBP.DataController2,
        _WorkAssignmentBP.DataController3,
        _WorkAssignmentBP.DataController4,
        _WorkAssignmentBP.DataController5,
        _WorkAssignmentBP.DataController6,
        _WorkAssignmentBP.DataController7,
        _WorkAssignmentBP.DataController8,
        _WorkAssignmentBP.DataController9,
        _WorkAssignmentBP.DataController10,

        _WorkAssignmentBP,
        _CompanyCodeText,
        _CurrencyText,
        _CountryText,
        _BPUsrRoleText,
        _EntrySourceText

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