SEPM_I_AddressTypeText is a CDS View that provides data about "EPM Demo: Address Type Text" in SAP S/4HANA. It reads from 1 data source (dd07t) and exposes 1 field. It has 1 association to related views.
-- Text view for the language-dependent text of a domain fix value
@EndUserText.label: 'EPM Demo: Address Type Text' -- label of the view, can be translated
@ObjectModel.dataCategory:#TEXT -- view contains language-dependent texts
@AccessControl.authorizationCheck: #NOT_REQUIRED -- instance-based access control not needed for text views
@Analytics.dataExtraction.enabled:true -- this viewis a good candidate for extraction of data for a data warehouse
//@VDM.viewType: #BASIC -- this would mark the viewas BASIC viewin the Virtual Data Model (VDM)
@ObjectModel.representativeKey: 'AddressType' -- the key field which is described by the text in this view@AbapCatalog.sqlViewName: 'SEPM_IADDRESSTPT' -- for technical reasons, a name for the generated SQL viewis needed
@ObjectModel.usageType.serviceQuality:#C@ObjectModel.usageType.sizeCategory:#S@ObjectModel.usageType.dataClass: #MASTERdefineview SEPM_I_AddressTypeText -- CDS view name; prefix "I_" indicates that it is a VDM interface view (released for reuse)
-- suffix "Text" indicates a TEXT viewasselectfrom dd07t -- selected from the text table for all domain fix values, filteris given below
association [0..1] to SEPM_I_Language as _Language -- association to the entityview for the Language field
on $projection.Language = _Language.Language -- join condition for the association, defined on the projection list ($projection) of
-- this text viewand the associated language entityview (via _Language)
association [1..1] to SEPM_I_AddressType as _AddressType
on $projection.AddressType =_AddressType.AddressType
{
@Semantics.language -- indicates the "language" semantics of the field named Language
@ObjectModel.foreignKey.association: '_Language' -- foreign keyassociation of this field, also used for basic value help
-- TODO: improve labels in data element orcast to better data element
key ddlanguage as Language, -- language field of this language-dependent text view@ObjectModel.foreignKey.association: '_AddressType'
keycast ( substring( domvalue_l, 1, 2 ) as snwd_address_type preserving type ) as AddressType,
-- shorten the generic char(10) format of domain fix values to the correct char(2) format of this domain
-- cast the data type to data element SNWD_ADDRESS_TYPE as proper semantic type incl. field labels
@Semantics.text -- indicates the "text" semantics of the field
-- ddtext as AddressTypeName, -- TODO: create data element with appropriate labels andcastcast ( ddtext as snwd_address_type_name preserving type ) as AddressTypeName,
_Language, -- expose the association to the Language view
_AddressType
}
where
domname = 'D_AD_TYPE' -- filteron the requested DDIC domain
and as4local = 'A' -- filteron the active version in DDIC