C_PPM_TaskPredecessor

DDL: C_PPM_TASKPREDECESSOR SQL: CPPMTASKPREDEC Type: view CONSUMPTION

Task Predecessor

C_PPM_TaskPredecessor is a Consumption CDS View that provides data about "Task Predecessor" in SAP S/4HANA. It reads from 3 data sources (I_PPM_SingleResponsibleForObj, I_PPM_TaskRelationship, I_PPM_TaskText) and exposes 15 fields with key fields TaskUUID, SuccessorTaskUUID. It has 5 associations to related views.

Data Sources (3)

SourceAliasJoin Type
I_PPM_SingleResponsibleForObj bupa left_outer
I_PPM_TaskRelationship rel from
I_PPM_TaskText text left_outer

Associations (5)

CardinalityTargetAliasCondition
[0..*] I_PPM_AuthznByUsrH _AuthUser _AuthUser.ReferencedObjectUUID = $projection.ReferencedObjectUUID and _AuthUser.UserID = $session.user and ( _AuthUser.Activity = 'Admin' or _AuthUser.Activity = 'Write' or _AuthUser.Activity = 'Read' )
[0..*] I_PPM_AuthznBySubstitH _AuthSubst _AuthSubst.ReferencedObjectUUID = $projection.ReferencedObjectUUID and _AuthSubst.UserID = $session.user and ( _AuthSubst.Activity = 'Admin' or _AuthSubst.Activity = 'Write' or _AuthSubst.Activity = 'Read' )
[0..*] I_PPM_AuthznByUserRoleH _AuthRole _AuthRole.ReferencedObjectUUID = $projection.ReferencedObjectUUID and _AuthRole.UserID = $session.user and ( _AuthRole.Activity = 'Admin' or _AuthRole.Activity = 'Write' or _AuthRole.Activity = 'Read' )
[0..*] I_PPM_AuthznByUsrGrpH _AuthGroup _AuthGroup.ReferencedObjectUUID = $projection.ReferencedObjectUUID and _AuthGroup.UserID = $session.user and ( _AuthGroup.Activity = 'Admin' or _AuthGroup.Activity = 'Write' or _AuthGroup.Activity = 'Read' )
[0..1] I_UnitOfMeasure _PercentageUnitOfMeasure _PercentageUnitOfMeasure.UnitOfMeasure = '%'

Annotations (14)

NameValueLevelField
EndUserText.label Task Predecessor view
VDM.viewType #CONSUMPTION view
AbapCatalog.sqlViewName CPPMTASKPREDEC view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #CHECK view
AccessControl.personalData.blocking #REQUIRED view
Search.searchable false view
ClientHandling.algorithm #SESSION_VARIABLE view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.dataClass #MIXED view
UI.headerInfo.typeName Project Task view
UI.headerInfo.typeNamePlural Project Tasks view
Consumption.semanticObject ProjectTask view

Fields (15)

KeyFieldSource TableSource FieldDescription
KEY TaskUUID
KEY SuccessorTaskUUID
ObjectName I_PPM_TaskText ObjectName
ReferencedObjectUUID I_PPM_TaskRelationship PredecessorTaskUUID
clientNULL1FAILendasLatestFinishDate Latest Finish
PercentageOfCompletion
BusinessPartnerName I_PPM_SingleResponsibleForObj BusinessPartnerName Responsible
BusinessPartnerUUID I_PPM_SingleResponsibleForObj BusinessPartnerUUID
CompletionUnit _PercentageUnitOfMeasure UnitOfMeasure
EPPMSettingsDefaultValue EPPMSettingsDefaultValue
_BusinessUser I_PPM_SingleResponsibleForObj _BusinessUser
_AuthUser _AuthUser
_AuthSubst _AuthSubst
_AuthRole _AuthRole
_AuthGroup _AuthGroup
@EndUserText.label: 'Task Predecessor'
@VDM.viewType: #CONSUMPTION
@AbapCatalog.sqlViewName: 'CPPMTASKPREDEC'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@AccessControl.personalData.blocking: #REQUIRED
@Search.searchable: false
@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.dataClass: #MIXED

@UI.headerInfo:{
  typeName:       'Project Task',
  typeNamePlural: 'Project Tasks'
}

@Consumption.semanticObject: 'ProjectTask'

define view C_PPM_TaskPredecessor

  as select from    I_PPM_TaskRelationship        as rel
    left outer join I_PPM_SingleResponsibleForObj as bupa             on bupa.ReferencedObjectUUID = rel.PredecessorTaskUUID
    left outer join I_PPM_TaskText                as text             on text.TaskUUID = rel.PredecessorTaskUUID

    // associations to authorization views

    association [0..*] to I_PPM_AuthznByUsrH        as _AuthUser
            on      _AuthUser.ReferencedObjectUUID   = $projection.ReferencedObjectUUID
             and    _AuthUser.UserID                 = $session.user
             and (  _AuthUser.Activity = 'Admin'     or _AuthUser.Activity = 'Write'      or _AuthUser.Activity = 'Read' )
    association [0..*] to I_PPM_AuthznBySubstitH    as _AuthSubst
            on      _AuthSubst.ReferencedObjectUUID  = $projection.ReferencedObjectUUID
             and    _AuthSubst.UserID                = $session.user
             and (  _AuthSubst.Activity = 'Admin'    or _AuthSubst.Activity = 'Write'     or _AuthSubst.Activity = 'Read' )
    association [0..*] to I_PPM_AuthznByUserRoleH   as _AuthRole
            on      _AuthRole.ReferencedObjectUUID   = $projection.ReferencedObjectUUID
             and    _AuthRole.UserID                 = $session.user
             and (  _AuthRole.Activity = 'Admin'     or _AuthRole.Activity = 'Write'      or _AuthRole.Activity = 'Read' )
    association [0..*] to I_PPM_AuthznByUsrGrpH     as _AuthGroup
            on      _AuthGroup.ReferencedObjectUUID  = $projection.ReferencedObjectUUID
             and    _AuthGroup.UserID                = $session.user
             and (  _AuthGroup.Activity = 'Admin'    or _AuthGroup.Activity = 'Write'     or _AuthGroup.Activity = 'Read' )


// other associations

    association [0..1] to I_UnitOfMeasure as _PercentageUnitOfMeasure on _PercentageUnitOfMeasure.UnitOfMeasure = '%'
{
      @UI.hidden: true
      @Consumption.semanticObject: 'ProjectTask'
  key bintohex(rel.PredecessorTaskUUID)                                                                                 as  TaskUUID,
      @UI.hidden: true
  key bintohex(rel.SuccessorTaskUUID)                                                                                   as  SuccessorTaskUUID,
      @UI.lineItem: { position: 10, importance: #HIGH }
      @EndUserText: {
        label: 'Element',
        quickInfo: 'Element'
      }
      text.ObjectName,
      @UI.hidden: true
      rel.PredecessorTaskUUID as ReferencedObjectUUID,



      @UI.lineItem: { position: 20, importance: #HIGH }
      @EndUserText.label: 'Latest Finish'
      case
      //if the duration is initial, don't substract one day.

        //Case 1: int-constraint_time = int-latest_start

        when rel._PredecessorTask.ProjectElementDuration = 0
          and rel._PredecessorTask.StartConstraintDateTime = rel._PredecessorTask.LatestStartDateTime then
            tstmp_to_dats(
            rel._PredecessorTask.LatestStartDateTime, //WebDynpro takes latest start

            abap_system_timezone( $session.client,'NULL' ),
            $session.client,
            'NULL' )
        //Case 2: int-constraint_time_fin = int-lates_start

        when rel._PredecessorTask.ProjectElementDuration = 0
          and rel._PredecessorTask.FinishConstraintDateTime = rel._PredecessorTask.LatestStartDateTime then
            dats_add_days(
              tstmp_to_dats(
              rel._PredecessorTask.LatestFinishDateTime,
              abap_system_timezone( $session.client,'NULL' ),
              $session.client,
              'NULL' ),
            -1,
            'FAIL')
        //TODO: Case 3: not sure if this will work in CDS: number of successor tasks is > 0

        //Case 4: this is the "else" for the duration = 0 logic

        when rel._PredecessorTask.ProjectElementDuration = 0 then
          dats_add_days(
              tstmp_to_dats(
              rel._PredecessorTask.LatestFinishDateTime,
              abap_system_timezone( $session.client,'NULL' ),
              $session.client,
              'NULL' ),
            -1,
            'FAIL')
        else //this should only happen if the duration is > 0

          dats_add_days(
              tstmp_to_dats(
              rel._PredecessorTask.LatestFinishDateTime,
              abap_system_timezone( $session.client,'NULL' ),
              $session.client,
              'NULL' ),
            -1,
            'FAIL')
      end                                                                                                              as  LatestFinishDate,
      @UI.lineItem: { position: 30, type: #AS_DATAPOINT }
      @UI.dataPoint: { visualization: #PROGRESS }
      @EndUserText: {
        label: 'Completion',
        quickInfo: 'Completion'
      }
      @Semantics.quantity.unitOfMeasure: 'CompletionUnit'
      @DefaultAggregation: #NONE
      @UI.hidden: true
      cast(rel._PredecessorTask.PercentageOfCompletion as abap.int1)                                                    as  PercentageOfCompletion,
      @UI.lineItem: { position: 40 }
      @EndUserText.label: 'Responsible'
      @Semantics.name.fullName: true
      bupa.BusinessPartnerName,

      @UI.hidden: true
      bupa.BusinessPartnerUUID,

      @UI.hidden: true
      _PercentageUnitOfMeasure.UnitOfMeasure                                                                          as CompletionUnit,

      @UI.hidden: true
      EPPMSettingsDefaultValue,
      // never expose the following associations, only used for authorization checks

    @UI.hidden:true
    bupa._BusinessUser,
    @UI.hidden:true
    _AuthUser,
    @UI.hidden:true
    _AuthSubst,
    @UI.hidden:true
    _AuthRole,
    @UI.hidden:true
    _AuthGroup



}