@AbapCatalog.sqlViewName: 'CEHSCOMBTASK'
@VDM.viewType: #CONSUMPTION
@AbapCatalog.compiler.compareFilter: true
@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.usageType:{ serviceQuality: #D, // < 100 msec
sizeCategory: #XL, // < 10.000.000
dataClass: #MIXED }
@AccessControl: {
authorizationCheck: #MANDATORY
}
// #NOT_REQUIRED as a start
@AccessControl.personalData.blocking: #NOT_REQUIRED
@EndUserText.label: 'Task Instances and Future Definitions'
@Consumption.semanticObject: 'EHSTask'
@ObjectModel.representativeKey: 'WorkflowTaskInternalID'
@ObjectModel.semanticKey: 'EHSPlannedTaskID'
@Metadata.allowExtensions: true
define view C_EHSCombinedTaskDefAndInstce
as select from I_EHSCombinedTaskDefAndInstce
association [0..*] to I_EHSTaskDefinitionTypeText as _EHSTaskDefinitionTypeText on $projection.EHSTaskDefinitionType = _EHSTaskDefinitionTypeText.EHSTaskDefinitionType
association [0..*] to I_EHSTaskRecurrenceTypeText as _EHSTaskRecurrenceTypeText on $projection.EHSTaskRecurrenceType = _EHSTaskRecurrenceTypeText.EHSTaskRecurrenceType
association [0..1] to I_BusinessUserBasic as _EHSTaskOwnerUser on $projection.EHSTaskOwnerBP = _EHSTaskOwnerUser.BusinessPartner
association [0..1] to I_BusinessUserBasic as _EHSTaskInstanceProcessorUser on $projection.EHSTaskInstanceProcessorBP = _EHSTaskInstanceProcessorUser.BusinessPartner
association [0..1] to I_BusinessUserBasic as _BusinessPartner on $projection.EHSTaskUser = _BusinessPartner.UserID
association [0..1] to I_BusinessUserBasic as _EHSTaskAssigneeUser on $projection.EHSTaskAssignedBP = _EHSTaskAssigneeUser.BusinessPartner
association [0..1] to I_BusinessUserBasic as _EHSTaskApprovingUser on $projection.EHSTaskApprovingBP = _EHSTaskApprovingUser.BusinessPartner
association [1..1] to C_EHSTaskDefinitionType as _EHSTaskDefinitionType on $projection.EHSTaskHostObjectAdapterClass = _EHSTaskDefinitionType.EHSTaskAdapterClass
and $projection.EHSTaskDefinitionType = _EHSTaskDefinitionType.EHSTaskDefinitionType
association [1..*] to I_TernaryLogicalStateText as _TernaryLogicalStateText on $projection.EHSTaskIsRecurrent = _TernaryLogicalStateText.TernaryLogicalState
association [1..1] to I_EHSTaskSortingStatus as _EHSTaskSortingStatus on $projection.EHSTaskStatusValueForSorting = _EHSTaskSortingStatus.EHSTaskStatusValueForSorting
association [0..*] to I_EHSLocationPersonRespRoleT as _EHSTaskAssigneeRoleT on $projection.EHSTaskAssignedLocRole = _EHSTaskAssigneeRoleT.EHSLocationPersonRespRole
association [0..*] to I_EHSLocationPersonRespRoleT as _EHSTaskApproverRoleT on $projection.EHSTaskApproverLocRole = _EHSTaskApproverRoleT.EHSLocationPersonRespRole
association [0..1] to I_EHSTaskDefinitionDraft as _DraftAdministrativeData on $projection.EHSTaskDefinitionUUID = _DraftAdministrativeData.EHSTaskDefinitionActiveUUID
association [1..1] to I_LocationDescFallbackLang as _LocTextDesc on $projection.EHSLocationUUID = _LocTextDesc.EHSLocationUUID
association [0..1] to I_EHSLocationRoot as _EHSLocationRoot on $projection.EHSLocationUUID = _EHSLocationRoot.EHSLocationUUID
{
key EHSTaskDefinitionUUID,
key WorkflowTaskInternalID,
key EHSPlannedTaskUUID,
EHSTaskHostObjectInstanceUUID,
EHSTaskHostObjectInstance,
EHSTaskHostObjectAdapterClass,
EHSTaskHostSemanticObject,
@ObjectModel.filter.enabled: true
@ObjectModel.sort.enabled: true
EHSTaskTitle,
@ObjectModel.filter.enabled: true
@ObjectModel.sort.enabled: true
cast(EHSPlannedTaskID as ehfnd_task_planned_id) as EHSPlannedTaskID,
@ObjectModel.text.association: '_EHSTaskDefinitionTypeText'
@ObjectModel.filter.enabled: true
@ObjectModel.sort.enabled: true
EHSTaskDefinitionType,
@ObjectModel:{ readOnly: true, virtualElement, virtualElementCalculatedBy: 'ABAP:CL_EHFND_TASK_STATUS_EXIT' }
@ObjectModel.filter.transformedBy: 'ABAP:CL_EHFND_TASK_STATUS_EXIT'
@ObjectModel.sort.transformedBy: 'ABAP:CL_EHFND_TASK_STATUS_EXIT'
@ObjectModel.filter.enabled: true
@ObjectModel.sort.enabled: false
@Semantics.text:true
cast ( '' as abap.char( 100 ) ) as EHSTaskStatusName,
@ObjectModel.foreignKey.association: '_EHSTaskPriority'
@EndUserText.label: 'Priority'
EHSTaskPriority,
_EHSTaskPriority.EHSTaskPriorityName,
_EHSTaskSortingStatus.EHSTaskStatusCriticality,
EHSTaskDueDate,
@ObjectModel.text.association: '_EHSTaskRecurrenceTypeText'
@EndUserText.label: 'Recurrence'
@Consumption.filter.hidden: true
@ObjectModel.filter.enabled: true
@ObjectModel.sort.enabled: false
EHSTaskRecurrenceType,
@Consumption.filter.hidden: true
@ObjectModel.filter.enabled: true
@ObjectModel.readOnly: true
case
when EHSTaskRecurrenceType = '001'
then cast( '' as ehfnd_task_def_is_recurrent preserving type )
else cast( 'X' as ehfnd_task_def_is_recurrent preserving type )
end as EHSTaskIsRecurrent,
@ObjectModel.foreignKey.association: '_BusinessPartner'
EHSTaskUser,
_BusinessPartner.PersonFullName as EHSTaskUserName,
EHSTaskOwnerUser,
@ObjectModel.foreignKey.association: '_EHSTaskOwnerUser'
EHSTaskOwnerBP,
_EHSTaskOwnerUser.PersonFullName as EHSTaskOwnerUserName,
@ObjectModel.foreignKey.association: '_EHSTaskInstanceProcessorUser'
EHSTaskInstanceProcessorBP,
_EHSTaskInstanceProcessorUser.UserID as EHSTaskInstanceProcessorUser,
_EHSTaskInstanceProcessorUser.PersonFullName as EHSTaskInstanceProcessorName,
@ObjectModel.foreignKey.association: '_EHSTaskAssigneeUser'
EHSTaskAssignedBP,
_EHSTaskAssigneeUser.PersonFullName as EHSTaskAssignedUserName,
EHSTaskAssignedLocRole,
_EHSTaskAssigneeRoleT[ 1: Language = $session.system_language ].EHSLocationPersonRespRoleName as EHSTaskAssignedLocRoleName,
@ObjectModel.foreignKey.association: '_EHSTaskApprovingUser'
EHSTaskApprovingBP,
_EHSTaskApprovingUser.PersonFullName as EHSTaskApprovingUserName,
EHSTaskApproverLocRole,
_EHSTaskApproverRoleT[ 1: Language = $session.system_language ].EHSLocationPersonRespRoleName as EHSTaskApproverLocRoleName,
'X' as HasActiveEntity,
@ObjectModel.filter.enabled: true
@ObjectModel.sort.enabled: true
EHSTaskStartDate,
@ObjectModel.filter.enabled: true
@ObjectModel.sort.enabled: true
EHSTaskInstceCompletionDate,
@Consumption.valueHelpDefinition: [{
entity: {
name: 'C_EHSTaskStatusValueHelp',
element: 'EHSTaskStatusValueForSorting'
}
}]
@ObjectModel.text.element: ['EHSTaskStatusName']
I_EHSCombinedTaskDefAndInstce.EHSTaskStatusValueForSorting as EHSTaskStatusValueForSorting,
@Consumption.valueHelpDefinition:
[{ entity: {
name: 'C_EHSLocationValueHelp',
element: 'EHSLocationUUID' } }]
@ObjectModel.text.element: ['EHSLocationIDAndName']
EHSLocationUUID,
_LocTextDesc._LocationNameText.EHSLocationName as EHSLocationName,
_EHSLocationRoot.EHSLocationID as EHSLocationID,
@ObjectModel: {
readOnly: true,
virtualElement: true,
virtualElementCalculatedBy: 'ABAP:CL_EHFND_TASK_LOCATION_EXIT',
sort.transformedBy: 'ABAP:CL_EHFND_TASK_LOCATION_EXIT',
filter.transformedBy: 'ABAP:CL_EHFND_TASK_LOCATION_EXIT'
}
@Semantics.text: true
cast('' as text132) as EHSLocationIDAndName,
EHSTaskTimeZone,
WrkflwTskCompletionUTCDateTime,
EHSTaskDateForSorting,
WorkflowTaskStatus,
EHSTaskHasWorkflow,
EHSTaskDefinitionStatus,
EHSTaskDefinitionIsPaused,
_EHSTaskDefinitionType.EHSTaskDefinitionManageAction,
_EHSTaskDefinitionType.EHSTaskInstanceDisplayAction,
// Draft Administrative Data
_DraftAdministrativeData.DraftEntityLastChangeDateTime,
_DraftAdministrativeData.DraftIsLastChangedByMe,
_DraftAdministrativeData.LastChangedByUserDescription,
_DraftAdministrativeData.DraftIsProcessedByMe,
_DraftAdministrativeData.InProcessByUser,
_DraftAdministrativeData.InProcessByUserDescription,
_DraftAdministrativeData.EHSTaskDefinitionUUID as DraftUUID,
// _DraftAdministrativeData,
@Semantics.booleanIndicator: true
case
when _DraftAdministrativeData.DraftEntityLastChangeDateTime is not null and EHSTaskHasWorkflow = '' // the only combination where we will show the Draft indicator
then 'X'
else ''
end as IsDraftEntity,
@Consumption.filter.hidden: true
@ObjectModel.filter.enabled: false
@ObjectModel.sort.enabled: false
_EHSTaskDefinitionTypeText,
@Consumption.filter.hidden: true
@ObjectModel.filter.enabled: false
@ObjectModel.sort.enabled: false
_EHSTaskRecurrenceTypeText,
@Consumption.filter.hidden: true
_TernaryLogicalStateText,
@Consumption.filter.hidden: true
_EHSTaskOwnerUser,
@Consumption.filter.hidden: true
_EHSTaskInstanceProcessorUser,
_BusinessPartner,
@Consumption.filter.hidden: true
_EHSTaskAssigneeUser,
@Consumption.filter.hidden: true
_EHSTaskApprovingUser,
@Consumption.filter.hidden: true
_EHSTaskSortingStatus,
@Consumption.filter.hidden: true
_EHSTaskAssigneeRoleT,
@Consumption.filter.hidden: true
_EHSTaskApproverRoleT,
// Associations for Authorization Check of Host BO
_EHSTaskAdapterClass,
_IncidentAuthorizationFields,
_EHSCtrlImplmtnAuthznFields,
_EHSRskAssessmentAuthznFields,
_EHSCmplncScenAuthznFields,
_CmplncRqmtAuthznFields,
@Consumption.filter.hidden: true
_EHSTaskPriority,
_EHSTaskDefinition,
IncidentHasAccessRestriction
}
// Add also pure draft definitions (which havent been saved at all)
// those draft record will be visible only be the user, who have created them
union all
select from I_EHSTaskDefinitionDraft
association [1..*] to I_TernaryLogicalStateText as _TernaryLogicalStateText on $projection.EHSTaskIsRecurrent = _TernaryLogicalStateText.TernaryLogicalState
association [0..*] to I_EHSTaskDefinitionTypeText as _EHSTaskDefinitionTypeText on $projection.EHSTaskDefinitionType = _EHSTaskDefinitionTypeText.EHSTaskDefinitionType
association [0..*] to I_EHSTaskRecurrenceTypeText as _EHSTaskRecurrenceTypeText on $projection.EHSTaskRecurrenceType = _EHSTaskRecurrenceTypeText.EHSTaskRecurrenceType
association [1..1] to I_EHSTaskSortingStatus as _EHSTaskSortingStatus on $projection.EHSTaskStatusValueForSorting = _EHSTaskSortingStatus.EHSTaskStatusValueForSorting
association [1..1] to I_EHSTaskDefinition as _EHSTaskDefinition on $projection.EHSTaskDefinitionUUID = _EHSTaskDefinition.EHSTaskDefinitionUUID
association [0..1] to I_BusinessUserBasic as _EHSTaskOwnerUser on $projection.EHSTaskOwnerBP = _EHSTaskOwnerUser.BusinessPartner
association [0..1] to I_BusinessUserBasic as _EHSTaskAssigneeUser on $projection.EHSTaskAssignedBP = _EHSTaskAssigneeUser.BusinessPartner
association [0..1] to I_BusinessUserBasic as _EHSTaskApprovingUser on $projection.EHSTaskApprovingBP = _EHSTaskApprovingUser.BusinessPartner
association [0..1] to I_BusinessUserBasic as _EHSTaskInstanceProcessorUser on $projection.EHSTaskInstanceProcessorBP = _EHSTaskInstanceProcessorUser.BusinessPartner
association [0..1] to I_BusinessUserBasic as _BusinessPartner on $projection.EHSTaskUser = _BusinessPartner.UserID
association [1..1] to I_LocationDescFallbackLang as _LocTextDesc on $projection.EHSLocationUUID = _LocTextDesc.EHSLocationUUID
association [0..1] to I_EHSLocationRoot as _EHSLocationRoot on $projection.EHSLocationUUID = _EHSLocationRoot.EHSLocationUUID
{
key EHSTaskDefinitionUUID,
key '000000000000' as WorkflowTaskInternalID,
key hextobin('00000000000000000000000000000000') as EHSPlannedTaskUUID,
EHSTaskHostObjectInstanceUUID,
EHSTaskHostObjectInstance,
EHSTaskHostObjectAdapterClass,
EHSTaskHostSemanticObject,
@ObjectModel.filter.enabled: true
@ObjectModel.sort.enabled: true
EHSTaskTitle,
@ObjectModel.filter.enabled: true
@ObjectModel.sort.enabled: true
cast('' as ehfnd_task_planned_id) as EHSPlannedTaskID,
@ObjectModel.text.association: '_EHSTaskDefinitionTypeText'
@ObjectModel.filter.enabled: true
@ObjectModel.sort.enabled: true
EHSTaskWorkflowEvent as EHSTaskDefinitionType,
@ObjectModel:{ readOnly: true, virtualElement, virtualElementCalculatedBy: 'ABAP:CL_EHFND_TASK_STATUS_EXIT' }
@ObjectModel.filter.transformedBy: 'ABAP:CL_EHFND_TASK_STATUS_EXIT'
@ObjectModel.sort.transformedBy: 'ABAP:CL_EHFND_TASK_STATUS_EXIT'
@ObjectModel.filter.enabled: true
@ObjectModel.sort.enabled: false
@Semantics.text:true
cast ( '' as abap.char( 100 ) ) as EHSTaskStatusName,
@ObjectModel.foreignKey.association: '_EHSTaskPriority'
@EndUserText.label: 'Priority'
EHSTaskPriority,
_EHSTaskPriority.EHSTaskPriorityName,
0 as EHSTaskStatusCriticality,
EHSTaskDueDate,
@ObjectModel.text.association: '_EHSTaskRecurrenceTypeText'
@EndUserText.label: 'Recurrence'
@Consumption.filter.hidden: true
@ObjectModel.filter.enabled: true
@ObjectModel.sort.enabled: false
EHSTaskRecurrenceType,
@Consumption.filter.hidden: true
@ObjectModel.filter.enabled: true
@ObjectModel.readOnly: true
case
when EHSTaskRecurrenceType = '001'
then cast( '' as ehfnd_task_def_is_recurrent preserving type )
else cast( 'X' as ehfnd_task_def_is_recurrent preserving type )
end as EHSTaskIsRecurrent,
@ObjectModel.foreignKey.association: '_BusinessPartner'
EHSTaskUser,
_BusinessPartner.PersonFullName as EHSTaskUserName,
EHSTaskOwnerUser,
@ObjectModel.foreignKey.association: '_EHSTaskOwnerUser'
I_EHSTaskDefinitionDraft.EHSTaskOwnerUser as EHSTaskOwnerBP,
_EHSTaskOwnerUser.PersonFullName as EHSTaskOwnerUserName,
@ObjectModel.foreignKey.association: '_EHSTaskInstanceProcessorUser'
'0000000000' as EHSTaskInstanceProcessorBP,
'0000000000' as EHSTaskInstanceProcessorUser,
'' as EHSTaskInstanceProcessorName,
@ObjectModel.foreignKey.association: '_EHSTaskAssigneeUser'
I_EHSTaskDefinitionDraft.EHSTaskAssignedUser as EHSTaskAssignedBP,
_EHSTaskAssignedUser.PersonFullName as EHSTaskAssignedUserName,
EHSTaskAssignedLocRole,
_EHSTaskAssigneeRoleT[ 1: Language = $session.system_language ].EHSLocationPersonRespRoleName as EHSTaskAssignedLocRoleName,
@ObjectModel.foreignKey.association: '_EHSTaskApprovingUser'
EHSTaskApprovingUser as EHSTaskApprovingBP,
_EHSTaskApprovingUser.PersonFullName as EHSTaskApprovingUserName,
EHSTaskApproverLocRole,
_EHSTaskApproverRoleT[ 1: Language = $session.system_language ].EHSLocationPersonRespRoleName as EHSTaskApproverLocRoleName,
HasActiveEntity,
@ObjectModel.filter.enabled: true
@ObjectModel.sort.enabled: true
EHSTaskStartDate,
@ObjectModel.filter.enabled: true
@ObjectModel.sort.enabled: true
'00000000' as EHSTaskInstceCompletionDate,
@Consumption.valueHelpDefinition: [{
entity: {
name: 'C_EHSTaskStatusValueHelp',
element: 'EHSTaskStatusValueForSorting'
}
}]
@ObjectModel.text.element: ['EHSTaskStatusName']
'00' as EHSTaskStatusValueForSorting, // so it can be shown first when sorting
@Consumption.valueHelpDefinition:
[{ entity: {
name: 'C_EHSLocationValueHelp',
element: 'EHSLocationUUID' } }]
@ObjectModel.text.element: ['EHSLocationIDAndName']
EHSLocationUUID,
_LocTextDesc._LocationNameText.EHSLocationName as EHSLocationName,
_EHSLocationRoot.EHSLocationID as EHSLocationID,
@ObjectModel: {
readOnly: true,
virtualElement: true,
virtualElementCalculatedBy: 'ABAP:CL_EHFND_TASK_LOCATION_EXIT',
sort.transformedBy: 'ABAP:CL_EHFND_TASK_LOCATION_EXIT',
filter.transformedBy: 'ABAP:CL_EHFND_TASK_LOCATION_EXIT'
}
@Semantics.text: true
cast('' as text132) as EHSLocationIDAndName,
'' as EHSTaskTimeZone,
0.0000000 as WrkflwTskCompletionUTCDateTime,
'00000000' as EHSTaskDateForSorting,
'' as WorkflowTaskStatus,
'' as EHSTaskHasWorkflow,
'01' as EHSTaskDefinitionStatus,
EHSTaskDefinitionIsPaused,
_EHSTaskDefinitionType.EHSTaskDefinitionManageAction,
_EHSTaskDefinitionType.EHSTaskInstanceDisplayAction,
// Draft Administrative Data
DraftEntityLastChangeDateTime,
DraftIsLastChangedByMe,
LastChangedByUserDescription,
DraftIsProcessedByMe,
InProcessByUser,
InProcessByUserDescription,
EHSTaskDefinitionActiveUUID as DraftUUID,
// _DraftAdministrativeData,
cast('X' as boolean) as IsDraftEntity,
@Consumption.filter.hidden: true
@ObjectModel.filter.enabled: false
@ObjectModel.sort.enabled: false
_EHSTaskDefinitionTypeText,
@Consumption.filter.hidden: true
@ObjectModel.filter.enabled: false
@ObjectModel.sort.enabled: false
_EHSTaskRecurrenceTypeText,
@Consumption.filter.hidden: true
_TernaryLogicalStateText,
@Consumption.filter.hidden: true
_EHSTaskOwnerUser,
@Consumption.filter.hidden: true
_EHSTaskInstanceProcessorUser,
_BusinessPartner,
@Consumption.filter.hidden: true
_EHSTaskAssigneeUser,
@Consumption.filter.hidden: true
_EHSTaskApprovingUser,
@Consumption.filter.hidden: true
_EHSTaskSortingStatus,
@Consumption.filter.hidden: true
_EHSTaskAssigneeRoleT,
@Consumption.filter.hidden: true
_EHSTaskApproverRoleT,
// Associations for Authorization Check of Host BO
_EHSTaskAdapterClass,
_IncidentAuthorizationFields,
_EHSCtrlImplmtnAuthznFields,
_EHSRskAssessmentAuthznFields,
_EHSCmplncScenAuthznFields,
_CmplncRqmtAuthznFields,
@Consumption.filter.hidden: true
_EHSTaskPriority,
_EHSTaskDefinition,
IncidentHasAccessRestriction
}
where
I_EHSTaskDefinitionDraft.CreatedByUser = $session.user and HasActiveEntity = ''
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"C_EHSTASKDEFINITIONTYPE",
"I_BUSINESSUSERBASIC",
"I_EHSCOMBINEDTASKDEFANDINSTCE",
"I_EHSLOCATIONPERSONRESPROLET",
"I_EHSLOCATIONREVISIONNAMET",
"I_EHSLOCATIONROOT",
"I_EHSTASKDEFINITIONDRAFT",
"I_EHSTASKDEFINITIONTYPE",
"I_EHSTASKPRIORITY",
"I_EHSTASKSORTINGSTATUS",
"I_LOCATIONDESCFALLBACKLANG"
],
"ASSOCIATED":
[
"C_EHSTASKDEFINITIONTYPE",
"I_BUSINESSUSERBASIC",
"I_CMPLNCRQMTAUTHZNFIELDS",
"I_EHSCMPLNCSCENAUTHZNFIELDS",
"I_EHSCTRLIMPLMTNAUTHZNFIELDS",
"I_EHSLOCATIONPERSONRESPROLET",
"I_EHSLOCATIONROOT",
"I_EHSRSKASSESSMENTAUTHZNFIELDS",
"I_EHSTASKADAPTERCLASS",
"I_EHSTASKDEFINITION",
"I_EHSTASKDEFINITIONDRAFT",
"I_EHSTASKDEFINITIONTYPETEXT",
"I_EHSTASKPRIORITY",
"I_EHSTASKRECURRENCETYPETEXT",
"I_EHSTASKSORTINGSTATUS",
"I_INCIDENTCOMBAUTHFIELDS",
"I_LOCATIONDESCFALLBACKLANG",
"I_TERNARYLOGICALSTATETEXT"
],
"BASE":
[
"I_EHSCOMBINEDTASKDEFANDINSTCE"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/