I_EHSRiskControl

DDL: I_EHSRISKCONTROL SQL: IEHSRSKCTRL Type: view BASIC

EHS Risk Control

I_EHSRiskControl is a Basic CDS View that provides data about "EHS Risk Control" in SAP S/4HANA. It reads from 1 data source (ehhssd_rsk_ctrl) and exposes 38 fields with key field EHSControlInstanceUUID. It has 13 associations to related views.

Data Sources (1)

SourceAliasJoin Type
ehhssd_rsk_ctrl ehhssd_rsk_ctrl from

Associations (13)

CardinalityTargetAliasCondition
[0..1] I_User _CreatedByUser $projection.CreatedByUser = _CreatedByUser.UserID
[0..1] I_User _LastChangedByUser $projection.LastChangedByUser = _LastChangedByUser.UserID
[1..1] I_EHSCtrlImplStatus _EHSCtrlImplementationStatus $projection.EHSControlImplStatus = _EHSCtrlImplementationStatus.EHSControlImplStatus
[0..1] I_EHSCtrlRefCat _EHSControlRefCategory $projection.EHSControlRefCategory = _EHSControlRefCategory.EHSControlRefCategory
[1..1] I_EHSRiskRoot _EHSRiskRoot $projection.EHSRiskUUID = _EHSRiskRoot.EHSRiskUUID
[1..1] I_EHSRiskRevision _EHSRiskRevision $projection.EHSRiskRevisionUUID = _EHSRiskRevision.EHSRiskRevisionUUID
[0..1] I_EHSControl _EHSControl $projection.EHSControlUUID = _EHSControl.EHSControlUUID
[0..1] I_EHSCtrlEffect _DesiredEHSControlEffect $projection.DesiredEHSControlEffect = _DesiredEHSControlEffect.DesiredEHSControlEffect
[0..1] I_EHSCtrlGoalTar _EHSControlTarget $projection.EHSControlTarget = _EHSControlTarget.EHSControlTarget
[1..1] I_Hazard _Hazard $projection.Hazard = _Hazard.Hazard
[0..*] I_EHSTextCollectionText _EHSControlRemarkText $projection.EHSControlRemarkUUID = _EHSControlRemarkText.TextCollectionUUID
[0..1] I_EHSControlType _EHSControlAdhocType $projection.EHSControlAdhocType = _EHSControlAdhocType.EHSControlType
[0..1] I_EHSControlSubtype _EHSControlAdhocSubtype $projection.EHSControlAdhocSubtype = _EHSControlAdhocSubtype.EHSControlSubtype

Annotations (11)

NameValueLevelField
EndUserText.label EHS Risk Control view
VDM.viewType #BASIC view
ObjectModel.representativeKey EHSControlInstanceUUID view
AccessControl.authorizationCheck #NOT_REQUIRED view
AbapCatalog.sqlViewName IEHSRSKCTRL view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
ClientHandling.algorithm #SESSION_VARIABLE view
ObjectModel.usageType.serviceQuality #C view
ObjectModel.usageType.sizeCategory #L view
ObjectModel.usageType.dataClass #MIXED view

Fields (38)

KeyFieldSource TableSource FieldDescription
KEY EHSControlInstanceUUID db_key
EHSControlInstanceUUIDHex
EHSRiskUUID
_EHSRiskRoot _EHSRiskRoot
EHSRiskRevisionUUID
_EHSRiskRevision _EHSRiskRevision
EHSControlUUID control_code
_EHSControl _EHSControl
ResponsiblePerson resp_id
EHSControlImplStatus
_EHSCtrlImplementationStatus _EHSCtrlImplementationStatus
Hazard hazard_code
_Hazard _Hazard
EHSControlTarget goal_target_code
_EHSControlTarget _EHSControlTarget
EHSControlObjective goal_object_code
DesiredEHSControlEffect goal_ctrl_effect
_DesiredEHSControlEffect _DesiredEHSControlEffect
EHSControlRemarkUUID
_EHSControlRemarkText _EHSControlRemarkText
EHSControlRefCategory ref_category
_EHSControlRefCategory _EHSControlRefCategory
EHSControlRefObject ref_id
ref_idelseendasmatnrasMaterial
ref_idelseendasequnrasEquipment
ref_idelseendastplnrasFunctionalLocation
EHSControlIsAdhoc proposal_ind
EHSControlAdhocTitle ehhssd_rsk_ctrl proposed_title
EHSControlAdhocType
_EHSControlAdhocType _EHSControlAdhocType
EHSControlAdhocSubtype
_EHSControlAdhocSubtype _EHSControlAdhocSubtype
CreationDateTime
CreatedByUser user_id_cr
_CreatedByUser _CreatedByUser
LastChangeDateTime
LastChangedByUser user_id_ch
_LastChangedByUser _LastChangedByUser
@EndUserText.label: 'EHS Risk Control'
@VDM.viewType: #BASIC
@ObjectModel.representativeKey: 'EHSControlInstanceUUID'
@AccessControl.authorizationCheck: #NOT_REQUIRED

@AbapCatalog.sqlViewName: 'IEHSRSKCTRL'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey:true

// Client handling by session

@ClientHandling.algorithm: #SESSION_VARIABLE

// used for BOBF Master Data Object

@ObjectModel.usageType:{ serviceQuality: #C,        // < 15 msec

                         sizeCategory:  #L,         // < 10.000.000

                         dataClass: #MIXED }

define view I_EHSRiskControl
  as select from ehhssd_rsk_ctrl

  association [0..1] to I_User                  as _CreatedByUser               on $projection.CreatedByUser = _CreatedByUser.UserID
  association [0..1] to I_User                  as _LastChangedByUser           on $projection.LastChangedByUser = _LastChangedByUser.UserID
  association [1..1] to I_EHSCtrlImplStatus     as _EHSCtrlImplementationStatus on $projection.EHSControlImplStatus = _EHSCtrlImplementationStatus.EHSControlImplStatus
  association [0..1] to I_EHSCtrlRefCat         as _EHSControlRefCategory       on $projection.EHSControlRefCategory = _EHSControlRefCategory.EHSControlRefCategory
  association [1..1] to I_EHSRiskRoot           as _EHSRiskRoot                 on $projection.EHSRiskUUID = _EHSRiskRoot.EHSRiskUUID
  association [1..1] to I_EHSRiskRevision       as _EHSRiskRevision             on $projection.EHSRiskRevisionUUID = _EHSRiskRevision.EHSRiskRevisionUUID
  association [0..1] to I_EHSControl            as _EHSControl                  on $projection.EHSControlUUID = _EHSControl.EHSControlUUID
  association [0..1] to I_EHSCtrlEffect         as _DesiredEHSControlEffect     on $projection.DesiredEHSControlEffect = _DesiredEHSControlEffect.DesiredEHSControlEffect
  association [0..1] to I_EHSCtrlGoalTar        as _EHSControlTarget            on $projection.EHSControlTarget = _EHSControlTarget.EHSControlTarget
  association [1..1] to I_Hazard                as _Hazard                      on $projection.Hazard = _Hazard.Hazard
  association [0..*] to I_EHSTextCollectionText as _EHSControlRemarkText        on $projection.EHSControlRemarkUUID = _EHSControlRemarkText.TextCollectionUUID
  association [0..1] to I_EHSControlType        as _EHSControlAdhocType         on $projection.EHSControlAdhocType = _EHSControlAdhocType.EHSControlType
  association [0..1] to I_EHSControlSubtype     as _EHSControlAdhocSubtype      on $projection.EHSControlAdhocSubtype = _EHSControlAdhocSubtype.EHSControlSubtype
{



  key db_key                                                                                as EHSControlInstanceUUID,
      bintohex(db_key)                                                                      as EHSControlInstanceUUIDHex,
      @ObjectModel.foreignKey.association: '_EHSRiskRoot'
      cast( ehhssd_rsk_ctrl.root_key as ehhss_risk_key_ref preserving type )                as EHSRiskUUID,
      _EHSRiskRoot,
      @ObjectModel.foreignKey.association: '_EHSRiskRevision'
      cast( parent_key as ehhss_risk_key_ref preserving type )                              as EHSRiskRevisionUUID,
      _EHSRiskRevision,
      @ObjectModel.foreignKey.association: '_EHSControl'
      control_code                                                                          as EHSControlUUID,
      _EHSControl,
      resp_id                                                                               as ResponsiblePerson,

      //    ResponsiblePersonFullName not determined here, because complex authority-checks would be needed

      //    check if conversion exits in the UI return the name


      @ObjectModel.foreignKey.association: '_EHSCtrlImplementationStatus'
      cast( impl_status as ehhss_ctrl_impl_status_nc preserving type )                      as EHSControlImplStatus,
      _EHSCtrlImplementationStatus,

      //    For testing show Status Text in English * remove me *

      //      _EHSCtrlImplStatus._Text[1: Language = $session.system_language ].EHSControlImplStatusName,


      @ObjectModel.foreignKey.association: '_Hazard'
      hazard_code                                                                           as Hazard,
      _Hazard,

      @ObjectModel.foreignKey.association: '_EHSControlTarget'
      goal_target_code                                                                      as EHSControlTarget,
      _EHSControlTarget,

      goal_object_code                                                                      as EHSControlObjective,
      @ObjectModel.foreignKey.association: '_DesiredEHSControlEffect'
      goal_ctrl_effect                                                                      as DesiredEHSControlEffect,
      _DesiredEHSControlEffect,

      @ObjectModel.text.association: '_EHSControlRemarkText'
      cast ( desc_key_ref as ehhss_ctrl_remark_uuid preserving type )                       as EHSControlRemarkUUID,
      _EHSControlRemarkText,

      @ObjectModel.foreignKey.association: '_EHSControlRefCategory'
      ref_category                                                                          as EHSControlRefCategory,
      _EHSControlRefCategory,

      //    For testing show Status Text in English * remove me *

      //      _EHSCtrlRefCat._Text[1: Language = $session.system_language ].EHSControlRefCategoryName as EHSControlRefCategoryName,


      ref_id                                                                                as EHSControlRefObject,

      //    has to be checked if case should be executed in higher view - example below returns the correct names

      cast ( case ref_category
        when '01' then ehhssd_rsk_ctrl.ref_id
        else ''
      end as matnr  )                                                                       as Material,

      cast ( case ref_category
        when '02' then ehhssd_rsk_ctrl.ref_id
        else ''
      end as equnr )                                                                        as Equipment,

      cast ( case ref_category
        when '03' then ehhssd_rsk_ctrl.ref_id
        else ''
      end as tplnr )                                                                        as FunctionalLocation,

      cast ( case ref_category
        when '02' then ehhssd_rsk_ctrl.ref_id
        when '03' then ehhssd_rsk_ctrl.ref_id
        else ''
      end as ehfnd_tmo_id_conv_eams )                                                       as MaintenanceObject,

      cast ( case ref_category
        when '02' then 'EAMS_EQUI'
        when '03' then 'EAMS_FL'
        else ''
      end as eams_tec_obj_type_value )                                                      as TechObjIsEquipOrFuncnlLoc,

      // Fields for Ad-Hoc Control

      proposal_ind                                                                          as EHSControlIsAdhoc,
      ehhssd_rsk_ctrl.proposed_title                                                        as EHSControlAdhocTitle,

      @ObjectModel.foreignKey.association: '_EHSControlAdhocType'
      cast ( ehhssd_rsk_ctrl.proposed_type as ehhss_control_type_code preserving type )     as EHSControlAdhocType,
      _EHSControlAdhocType,

      @ObjectModel.foreignKey.association: '_EHSControlAdhocSubtype'
      cast ( ehhssd_rsk_ctrl.proposed_subj  as ehhss_control_subtype_code preserving type ) as EHSControlAdhocSubtype,
      _EHSControlAdhocSubtype,

      // Admin data

      cast(datetime_cr as timestamp preserving type)                                        as CreationDateTime,
      user_id_cr                                                                            as CreatedByUser,
      _CreatedByUser,
      cast(datetime_ch as timestamp preserving type)                                        as LastChangeDateTime,
      user_id_ch                                                                            as LastChangedByUser,
      _LastChangedByUser

}