I_LocationDescFallbackLang

DDL: I_LOCATIONDESCFALLBACKLANG SQL: EHSLOCDESC Type: view COMPOSITE

Location Description Fallback

I_LocationDescFallbackLang is a Composite CDS View that provides data about "Location Description Fallback" in SAP S/4HANA. It reads from 1 data source (I_EHSLocationRevision) and exposes 11 fields with key field EHSLocationUUID. It has 1 association to related views.

Data Sources (1)

SourceAliasJoin Type
I_EHSLocationRevision I_EHSLocationRevision from

Associations (1)

CardinalityTargetAliasCondition
[0..1] I_EHSLocationNameDistinct _LocationNameText $projection.EHSLocationRevisionUUID = _LocationNameText.EHSLocationRevisionUUID and $projection.EHSLocationUUID = _LocationNameText.EHSLocationUUID and $projection.EHSLocationName = _LocationNameText.EHSLocationName

Annotations (10)

NameValueLevelField
EndUserText.label Location Description Fallback view
VDM.viewType #COMPOSITE view
ObjectModel.representativeKey EHSLocationUUID view
AccessControl.authorizationCheck #CHECK view
AbapCatalog.sqlViewName EHSLOCDESC view
AbapCatalog.compiler.compareFilter true view
ClientHandling.algorithm #SESSION_VARIABLE view
ObjectModel.usageType.serviceQuality #C view
ObjectModel.usageType.sizeCategory #M view
ObjectModel.usageType.dataClass #MASTER view

Fields (11)

KeyFieldSource TableSource FieldDescription
KEY EHSLocationUUID I_EHSLocationRevision EHSLocationUUID
EHSLocationRevisionUUID I_EHSLocationRevision EHSLocationRevisionUUID
EHSLocationNameendasEHSLocationName
EHSLocationType EHSLocationType
EHSLocationStatus EHSLocationStatus
EHSLocationAuthorizationGroup EHSLocationAuthorizationGroup
Plant Plant
CostCenter CostCenter
CompanyCode CompanyCode
BusinessArea BusinessArea
_LocationNameText _LocationNameText
@EndUserText.label: 'Location Description Fallback'

@VDM.viewType: #COMPOSITE

@ObjectModel.representativeKey: 'EHSLocationUUID'
// Begin Correction 3410675 07.12.2023 ************************************

@AccessControl: {
  authorizationCheck: #CHECK,
  privilegedAssociations: [ '_LocationNameText' ]
}
// End Correction 3410675 07.12.2023 **************************************

@AbapCatalog.sqlViewName: 'EHSLOCDESC'
@AbapCatalog.compiler.compareFilter: true
// Begin Correction 3410675 07.12.2023 ************************************

// code removed

// End Correction 3410675 07.12.2023 **************************************

@ClientHandling.algorithm: #SESSION_VARIABLE

@ObjectModel.usageType: {serviceQuality: #C, sizeCategory: #M, dataClass: #MASTER}

define view I_LocationDescFallbackLang
  as select from I_EHSLocationRevision

  // the assosiaction is needed for the Free Text Search for Location

  // As we have different description in the system we have to make sure

  // that we will show the same results when searching by free text with the same

  // results that we see in the table


  // before this assosiation we had direct _text[1: Language = system_language].ehslocation name but it happened, for example

  // we see a location with description "test in German"(the description in the system is in DE) and if we are logged with English and we try to search for it

  // it cannot be found

  // Begin Correction 3410675 07.12.2023 ************************************

 association [0..1] to I_EHSLocationNameDistinct as _LocationNameText  on  $projection.EHSLocationRevisionUUID = _LocationNameText.EHSLocationRevisionUUID
                                                                            and $projection.EHSLocationUUID = _LocationNameText.EHSLocationUUID
                                                                            and $projection.EHSLocationName = _LocationNameText.EHSLocationName
  // End Correction 3410675 07.12.2023 **************************************

{

  key I_EHSLocationRevision.EHSLocationUUID,
      I_EHSLocationRevision.EHSLocationRevisionUUID,

      //  This field is shown in the table As location

      // first try to take the description in the system languange; if not found, try to take in english

      // if again not found, try to take any description

      min(distinct case
        when _EHSLocationRevisionName[ 1: Language = $session.system_language].EHSLocationName is not null
          then _EHSLocationRevisionName[1: Language = $session.system_language].EHSLocationName
        when  _EHSLocationRevisionName[1: Language = 'E'].EHSLocationName is not null
          then  _EHSLocationRevisionName[1: Language = 'E'].EHSLocationName
        else    _EHSLocationRevisionName[1: Language is not null].EHSLocationName
       end ) as EHSLocationName,

      EHSLocationType,
      EHSLocationStatus,
      EHSLocationAuthorizationGroup,
      Plant,
      CostCenter,
      CompanyCode,
      BusinessArea,

      /* Associations */
      _LocationNameText

}
where
      RevisionStartDate <= $session.system_date
  and RevisionEndDate   >= $session.system_date
group by
  EHSLocationRevisionUUID,
  EHSLocationUUID,
  EHSLocationType,
  EHSLocationStatus,
  EHSLocationAuthorizationGroup,
  Plant,
  CostCenter,
  CompanyCode,
  BusinessArea