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.
@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}defineview I_LocationDescFallbackLang
asselectfrom 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 isin 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(distinctcasewhen _EHSLocationRevisionName[ 1: Language = $session.system_language].EHSLocationName isnotnullthen _EHSLocationRevisionName[1: Language = $session.system_language].EHSLocationName
when _EHSLocationRevisionName[1: Language = 'E'].EHSLocationName isnotnullthen _EHSLocationRevisionName[1: Language = 'E'].EHSLocationName
else _EHSLocationRevisionName[1: Language isnotnull].EHSLocationName
end ) as EHSLocationName,
EHSLocationType,
EHSLocationStatus,
EHSLocationAuthorizationGroup,
Plant,
CostCenter,
CompanyCode,
BusinessArea,
/* Associations */
_LocationNameText
}
where
RevisionStartDate <= $session.system_date
and RevisionEndDate >= $session.system_date
groupby
EHSLocationRevisionUUID,
EHSLocationUUID,
EHSLocationType,
EHSLocationStatus,
EHSLocationAuthorizationGroup,
Plant,
CostCenter,
CompanyCode,
BusinessArea